Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./"
},
"dependencies": {
"git-blame": "^0.1.1",
"git-blame": "^1.1.0",
"moment": "^2.10.6",
"path": "^0.12.7",
"typescript": "^1.6.2",
Expand All @@ -46,6 +46,26 @@
"commands": [{
"command": "extension.blame",
"title": "Git Blame"
}]
}],
"configuration": {
"title": "Git Blame configuration",
"properties": {
"git-blame.ignore-whitespace-change":{
"type": "boolean",
"default": true,
"description" : "If set to true, git blame command will ignore any whitespace change applied to currently selected line"
},
"git-blame.status-message":{
"type": "string",
"default": "Blame %s ( %s )",
"description" : "Output message shown in status bar"
},
"git-blame.popup-message":{
"type": "string",
"default": "%s %s",
"description": "Output message shown in tooltip bar"
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import {Disposable, window, TextEditor, TextEditorSelectionChangeEvent} from 'vscode';
import {Disposable, window, TextEditor, TextEditorSelectionChangeEvent, workspace} from 'vscode';
import {GitBlame} from './gitblame';
import * as path from 'path';
import * as moment from 'moment';
Expand Down Expand Up @@ -75,7 +75,7 @@ export class TextDecorator {
const author = commit['author'];
const dateText = this.toDateText(dateNow, new Date(author['timestamp'] * 1000));

return 'Blame ' + author['name'] + ' ( ' + dateText + ' )';
return require('util').format(workspace.getConfiguration('git-blame').get<string>('status-message', 'Blame %s ( %s )'), author['name'], dateText);
}

toDateText(dateNow: Date, dateThen: Date) : string {
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function showMessage(context: ExtensionContext, repoDir: string) {
const hash = info['lines'][lineNumber]['hash'];
const commitInfo = info['commits'][hash];

window.showInformationMessage(hash + ' ' + commitInfo['summary']);
window.showInformationMessage(require('util').format(workspace.getConfiguration('git-blame').get<string>('popup-message', '%s %s'), hash, commitInfo['summary']));
}
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/gitblame.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import * as vscode from 'vscode';

export class GitBlame {

Expand Down Expand Up @@ -38,7 +38,8 @@ export class GitBlame {
};

self.gitBlameProcess(repo, {
file: fileName
file: fileName,
ignoreWhitespaces: vscode.workspace.getConfiguration('git-blame').get<boolean>("ignore-whitespace-change", true)
}).on('data', (type, data) => {
// outputs in Porcelain format.
if (type === 'line') {
Expand Down