Browse Source

Closes #1529: adds diff previous w/ working

main
Eric Amodio 3 years ago
parent
commit
d2a5141743
3 changed files with 37 additions and 7 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +21
    -7
      package.json
  3. +15
    -0
      src/views/viewCommands.ts

+ 1
- 0
CHANGELOG.md View File

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Added
- Adds new _Open Previous Changes with Working File_ command to commit files in views — closes [#1529](https://github.com/eamodio/vscode-gitlens/issues/1529)
- Adopts new vscode `createStatusBarItem` API to allow for independent toggling — closes [#1543](https://github.com/eamodio/vscode-gitlens/issues/1543)
### Fixed

+ 21
- 7
package.json View File

@ -4125,6 +4125,11 @@
}
},
{
"command": "gitlens.views.openPreviousChangesWithWorking",
"title": "Open Previous Changes with Working File",
"category": "GitLens"
},
{
"command": "gitlens.views.openFile",
"title": "Open File",
"category": "GitLens",
@ -5829,6 +5834,10 @@
"when": "false"
},
{
"command": "gitlens.views.openPreviousChangesWithWorking",
"when": "false"
},
{
"command": "gitlens.views.openFile",
"when": "false"
},
@ -8835,32 +8844,37 @@
],
"gitlens/commit/file/changes": [
{
"command": "gitlens.externalDiff",
"command": "gitlens.views.openChangesWithWorking",
"when": "viewItem =~ /gitlens:file\\b(?!.*?\\b\\+conflicted\\b)/",
"group": "1_gitlens@1"
},
{
"command": "gitlens.views.openChangesWithWorking",
"whsen": "viewItem =~ /gitlens:file\\b(?!.*?\\b\\+conflicted\\b)/",
"command": "gitlens.views.openPreviousChangesWithWorking",
"when": "viewItem =~ /gitlens:file\\b(?!.*?\\b\\+(conflicted|stashed|staged|unstaged)\\b)/",
"group": "1_gitlens@2"
},
{
"command": "gitlens.diffWithRevision",
"group": "2_gitlens@1"
"group": "1_gitlens@3"
},
{
"command": "gitlens.diffWithRevisionFrom",
"group": "2_gitlens@2"
"group": "1_gitlens@4"
},
{
"command": "gitlens.externalDiff",
"when": "viewItem =~ /gitlens:file\\b(?!.*?\\b\\+conflicted\\b)/",
"group": "1_gitlens@5"
},
{
"command": "gitlens.views.highlightChanges",
"when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+(committed|stashed)\\b)|:results)/",
"group": "3_gitlens@1"
"group": "2_gitlens@1"
},
{
"command": "gitlens.views.highlightRevisionChanges",
"when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results)/",
"group": "3_gitlens@2"
"group": "2_gitlens@2"
}
],
"gitlens/editor/annotations": [

+ 15
- 0
src/views/viewCommands.ts View File

@ -153,6 +153,11 @@ export class ViewCommands {
commands.registerCommand('gitlens.views.openChanges', this.openChanges, this);
commands.registerCommand('gitlens.views.openChangesWithWorking', this.openChangesWithWorking, this);
commands.registerCommand(
'gitlens.views.openPreviousChangesWithWorking',
this.openPreviousChangesWithWorking,
this,
);
commands.registerCommand('gitlens.views.openFile', this.openFile, this);
commands.registerCommand('gitlens.views.openFileRevision', this.openRevision, this);
commands.registerCommand('gitlens.views.openChangedFiles', this.openFiles, this);
@ -1008,6 +1013,16 @@ export class ViewCommands {
}
@debug()
private async openPreviousChangesWithWorking(node: ViewRefFileNode) {
if (!(node instanceof ViewRefFileNode)) return Promise.resolve();
return GitActions.Commit.openChangesWithWorking(node.file, {
repoPath: node.repoPath,
ref: `${node.ref.ref}^`,
});
}
@debug()
private openFile(
node: ViewRefFileNode | MergeConflictFileNode | StatusFileNode | FileHistoryNode | LineHistoryNode,
options?: TextDocumentShowOptions,

Loading…
Cancel
Save