mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -05:00
Closes #138 - adds ignore whitespace setting
This commit is contained in:
21
CHANGELOG.md
21
CHANGELOG.md
@@ -58,13 +58,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
||||
- Quickly switch between views using the `Switch to Repository View` or `Switch to History View` commands
|
||||
- Provides toolbar commands to `Search Commits`, `Switch to Repository View` or `Switch to History View`, and `Refresh`
|
||||
|
||||
- Adds command-links to the `details` hover annotation
|
||||
- Clicking the commit id will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||
- Adds command-links to the `changes` hover annotation
|
||||
- Clicking on `Changes` will run the `Compare File Revisions` command (`gitlens.diffWith`)
|
||||
- Clicking the current and previous commit ids will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||
- Adds support for remote services with custom domains - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||
- Adds support for the Bitbucket Server (previously called Stash) remote service - see [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||
- Adds all-new interactivity to the hover annotations
|
||||
|
||||

|
||||
|
||||
- Adds the following command-links to the `details` hover annotation
|
||||
- Clicking the commit id will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||
- Adds the following command-links to the `changes` hover annotation
|
||||
- Clicking on `Changes` will run the `Compare File Revisions` command (`gitlens.diffWith`)
|
||||
- Clicking the current and previous commit ids will run the `Show Commit Details` command (`gitlens.showQuickCommitDetails`)
|
||||
|
||||
- Adds support for remote services with custom domains -- closes [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||
- Adds support for the Bitbucket Server (previously called Stash) remote service -- closes [#120](https://github.com/eamodio/vscode-gitlens/issues/120)
|
||||
- Adds `gitlens.blame.ignoreWhitespace` setting to specify whether or not to ignore whitespace when comparing revisions during blame operations -- closes [#138](https://github.com/eamodio/vscode-gitlens/issues/138)
|
||||
- Adds `Compare File Revisions` command (`gitlens.diffWith`) - compares the specified file revisions
|
||||
- Adds `Open Branches in Remote` command (`gitlens.openBranchesInRemote`) - opens the branches in the supported remote service
|
||||
- Adds `Stash Changes` command (`gitlens.stashSave`) to the source control group context menu -- can now stash a group of files
|
||||
@@ -97,7 +103,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
||||
- Fixes an issue where double hover annotations could be shown on blank lines
|
||||
- Fixes an issue where remote branches couldn't be opened properly in their remote service
|
||||
- Fixes [#130](https://github.com/eamodio/vscode-gitlens/issues/130) - First-run "Thank you for choosing GitLens! [...]" info message shown on every start up
|
||||
- Fixes [#120](https://github.com/eamodio/vscode-gitlens/issues/120) - Feature Request: "Open in Remote" support for custom repositories
|
||||
- Fixes an issue where sometimes diffs (via branch name) wouldn't open properly
|
||||
- Fixes an issue where remotes are queried more than once on startup
|
||||
|
||||
|
||||
@@ -287,7 +287,11 @@ GitLens is highly customizable and provides many configuration settings to allow
|
||||
|`gitlens.insiders`|Opts into the insiders channel -- provides access to upcoming features
|
||||
|`gitlens.outputLevel`|Specifies how much (if any) output will be sent to the GitLens output channel
|
||||
|
||||
### Blame Annotation Settings
|
||||
### Blame Settings
|
||||
|
||||
|Name | Description
|
||||
|-----|------------
|
||||
|`gitlens.blame.ignoreWhitespace`|Specifies whether or not to ignore whitespace when comparing revisions during blame operations
|
||||
|
||||
#### File Blame Annotation Settings
|
||||
|
||||
|
||||
@@ -172,6 +172,11 @@
|
||||
"default": false,
|
||||
"description": "Specifies whether or not to trigger hover annotations over the whole line"
|
||||
},
|
||||
"gitlens.blame.ignoreWhitespace": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Specifies whether or not to ignore whitespace when comparing revisions during blame operations"
|
||||
},
|
||||
"gitlens.blame.file.annotationType": {
|
||||
"type": "string",
|
||||
"default": "gutter",
|
||||
|
||||
@@ -275,6 +275,8 @@ export interface IConfig {
|
||||
};
|
||||
|
||||
blame: {
|
||||
ignoreWhitespace: boolean;
|
||||
|
||||
file: {
|
||||
annotationType: FileAnnotationType;
|
||||
lineHighlight: {
|
||||
|
||||
@@ -177,15 +177,17 @@ export class Git {
|
||||
|
||||
// Git commands
|
||||
|
||||
static blame(repoPath: string | undefined, fileName: string, sha?: string, startLine?: number, endLine?: number) {
|
||||
static blame(repoPath: string | undefined, fileName: string, sha?: string, options: { ignoreWhitespace?: boolean, startLine?: number, endLine?: number } = {}) {
|
||||
const [file, root] = Git.splitPath(fileName, repoPath);
|
||||
|
||||
const params = [`blame`, `--root`, `--incremental`];
|
||||
|
||||
if (startLine != null && endLine != null) {
|
||||
params.push(`-L ${startLine},${endLine}`);
|
||||
if (options.ignoreWhitespace) {
|
||||
params.push('-w');
|
||||
}
|
||||
if (options.startLine != null && options.endLine != null) {
|
||||
params.push(`-L ${options.startLine},${options.endLine}`);
|
||||
}
|
||||
|
||||
if (sha) {
|
||||
params.push(sha);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,14 @@ export class GitService extends Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
const ignoreWhitespace = this.config && this.config.blame.ignoreWhitespace;
|
||||
|
||||
this.config = cfg;
|
||||
|
||||
if (this.config.blame.ignoreWhitespace !== ignoreWhitespace) {
|
||||
this._gitCache.clear();
|
||||
this._fireGitCacheChange();
|
||||
}
|
||||
}
|
||||
|
||||
private _onRemoteProviderChanged() {
|
||||
@@ -428,7 +435,7 @@ export class GitService extends Disposable {
|
||||
}
|
||||
|
||||
try {
|
||||
const data = await Git.blame(root, file, uri.sha);
|
||||
const data = await Git.blame(root, file, uri.sha, { ignoreWhitespace: this.config.blame.ignoreWhitespace });
|
||||
const blame = GitBlameParser.parse(data, root, file);
|
||||
return blame;
|
||||
}
|
||||
@@ -477,7 +484,7 @@ export class GitService extends Disposable {
|
||||
const fileName = uri.fsPath;
|
||||
|
||||
try {
|
||||
const data = await Git.blame(uri.repoPath, fileName, uri.sha, line + 1, line + 1);
|
||||
const data = await Git.blame(uri.repoPath, fileName, uri.sha, { ignoreWhitespace: this.config.blame.ignoreWhitespace, startLine: line + 1, endLine: line + 1 });
|
||||
const blame = GitBlameParser.parse(data, uri.repoPath, fileName);
|
||||
if (blame === undefined) return undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user