Skip to content

Commit 55b1a66

Browse files
committed
Adds 'gitlens.diffWithWorking' status bar command option
Changes 'gitlens.diffWithPrevious' status bar command option behavior
1 parent 522e5a4 commit 55b1a66

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ GitLens is highly customizable and provides many configuration settings to allow
211211
|`gitlens.menus.diff.enabled`|Specifies whether diff commands will be added to the context menus
212212
|`gitlens.statusBar.enabled`|Specifies whether blame information is shown in the status bar
213213
|`gitlens.statusBar.alignment`|Specifies the blame alignment in the status bar. `left` - align to the left, `right` - align to the right
214-
|`gitlens.statusBar.command`|"Specifies the command executed when the blame status bar item is clicked. `gitlens.toggleBlame` - toggles blame annotations. `gitlens.showBlameHistory` - opens the blame history explorer. `gitlens.showFileHistory` - opens the file history explorer. `gitlens.diffWithPrevious` - compares the current committed file with the previous commit. `gitlens.toggleCodeLens` - toggles Git code lens. `gitlens.showQuickCommitDetails` - shows a commit details quick pick. `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick. `gitlens.showQuickFileHistory` - shows a file history quick pick. `gitlens.showQuickRepoHistory` - shows a branch history quick pick
214+
|`gitlens.statusBar.command`|Specifies the command executed when the blame status bar item is clicked. `gitlens.toggleBlame` - toggles blame annotations. `gitlens.showBlameHistory` - opens the blame history explorer. `gitlens.showFileHistory` - opens the file history explorer. `gitlens.diffWithPrevious` - compares the current line commit with the previous. `gitlens.diffWithWorking` - compares the current line commit with the working tree. `gitlens.toggleCodeLens` - toggles Git code lens. `gitlens.showQuickCommitDetails` - shows a commit details quick pick. `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick. `gitlens.showQuickFileHistory` - shows a file history quick pick. `gitlens.showQuickRepoHistory` - shows a branch history quick pick
215215
|`gitlens.statusBar.date`|Specifies whether and how the commit date will be shown in the blame status bar. `off` - no date. `relative` - relative date (e.g. 1 day ago). `absolute` - date format specified by `gitlens.statusBar.dateFormat`
216216
|`gitlens.statusBar.dateFormat`|Specifies the date format of how absolute dates will be shown in the blame status bar. See https://momentjs.com/docs/#/displaying/format/ for valid formats
217217

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,14 @@
308308
"gitlens.showBlameHistory",
309309
"gitlens.showFileHistory",
310310
"gitlens.diffWithPrevious",
311+
"gitlens.diffWithWorking",
311312
"gitlens.toggleCodeLens",
312313
"gitlens.showQuickCommitDetails",
313314
"gitlens.showQuickCommitFileDetails",
314315
"gitlens.showQuickFileHistory",
315316
"gitlens.showQuickRepoHistory"
316317
],
317-
"description": "Specifies the command executed when the blame status bar item is clicked. `gitlens.toggleBlame` - toggles blame annotations. `gitlens.showBlameHistory` - opens the blame history explorer. `gitlens.showFileHistory` - opens the file history explorer. `gitlens.diffWithPrevious` - compares the current committed file with the previous commit. `gitlens.toggleCodeLens` - toggles Git code lens. `gitlens.showQuickCommitDetails` - shows a commit details quick pick. `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick. `gitlens.showQuickFileHistory` - shows a file history quick pick. `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
318+
"description": "Specifies the command executed when the blame status bar item is clicked. `gitlens.toggleBlame` - toggles blame annotations. `gitlens.showBlameHistory` - opens the blame history explorer. `gitlens.showFileHistory` - opens the file history explorer. `gitlens.diffWithPrevious` - compares the current line commit with the previous. `gitlens.diffWithWorking` - compares the current line commit with the working tree. `gitlens.toggleCodeLens` - toggles Git code lens. `gitlens.showQuickCommitDetails` - shows a commit details quick pick. `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick. `gitlens.showQuickFileHistory` - shows a file history quick pick. `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
318319
},
319320
"gitlens.statusBar.date": {
320321
"type": "string",
@@ -391,7 +392,7 @@
391392
},
392393
{
393394
"command": "gitlens.diffLineWithPrevious",
394-
"title": "Compare Line Commit with Previous",
395+
"title": "Compare Line Commit with Previous",
395396
"category": "GitLens"
396397
},
397398
{
@@ -401,7 +402,7 @@
401402
},
402403
{
403404
"command": "gitlens.diffLineWithWorking",
404-
"title": "Compare Line Commit with Working Tree",
405+
"title": "Compare Line Commit with Working Tree",
405406
"category": "GitLens"
406407
},
407408
{

src/blameActiveLineController.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Functions, Objects } from './system';
33
import { DecorationInstanceRenderOptions, DecorationOptions, DecorationRenderOptions, Disposable, ExtensionContext, Range, StatusBarAlignment, StatusBarItem, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
44
import { BlameAnnotationController } from './blameAnnotationController';
55
import { BlameAnnotationFormat, BlameAnnotationFormatter } from './blameAnnotationFormatter';
6+
import { Commands } from './commands';
67
import { TextEditorComparer } from './comparers';
78
import { IBlameConfig, IConfig, StatusBarCommand } from './configuration';
89
import { DocumentSchemes, ExtensionKey } from './constants';
@@ -244,7 +245,12 @@ export class BlameActiveLineController extends Disposable {
244245
this._statusBarItem.tooltip = 'Open File History Explorer';
245246
break;
246247
case StatusBarCommand.DiffWithPrevious:
247-
this._statusBarItem.tooltip = 'Compare with Previous Commit';
248+
this._statusBarItem.command = Commands.DiffLineWithPrevious;
249+
this._statusBarItem.tooltip = 'Compare File with Previous';
250+
break;
251+
case StatusBarCommand.DiffWithWorking:
252+
this._statusBarItem.command = Commands.DiffLineWithWorking;
253+
this._statusBarItem.tooltip = 'Compare File with Working Tree';
248254
break;
249255
case StatusBarCommand.ToggleCodeLens:
250256
this._statusBarItem.tooltip = 'Toggle Git CodeLens';

src/configuration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ export interface ICodeLensesConfig {
7373
authors: ICodeLensConfig;
7474
}
7575

76-
export type StatusBarCommand = 'gitlens.toggleBlame' | 'gitlens.showBlameHistory' | 'gitlens.showFileHistory' | 'gitlens.toggleCodeLens' | 'gitlens.diffWithPrevious' | 'gitlens.showQuickCommitDetails' | 'gitlens.showQuickCommitFileDetails' | 'gitlens.showQuickFileHistory' | 'gitlens.showQuickRepoHistory';
76+
export type StatusBarCommand = 'gitlens.toggleBlame' | 'gitlens.showBlameHistory' | 'gitlens.showFileHistory' | 'gitlens.toggleCodeLens' | 'gitlens.diffWithPrevious' | 'gitlens.diffWithWorking' | 'gitlens.showQuickCommitDetails' | 'gitlens.showQuickCommitFileDetails' | 'gitlens.showQuickFileHistory' | 'gitlens.showQuickRepoHistory';
7777
export const StatusBarCommand = {
7878
BlameAnnotate: Commands.ToggleBlame as StatusBarCommand,
7979
ShowBlameHistory: Commands.ShowBlameHistory as StatusBarCommand,
8080
ShowFileHistory: Commands.ShowFileHistory as CodeLensCommand,
8181
DiffWithPrevious: Commands.DiffWithPrevious as StatusBarCommand,
82+
DiffWithWorking: Commands.DiffWithWorking as StatusBarCommand,
8283
ToggleCodeLens: Commands.ToggleCodeLens as StatusBarCommand,
8384
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as StatusBarCommand,
8485
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as StatusBarCommand,

0 commit comments

Comments
 (0)