mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-25 18:02:01 -05:00
Adds Apply Changes command to custom view files
Adds Stash Changes command to SCM view items
This commit is contained in:
@@ -43,6 +43,7 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
||||
commands.registerCommand('gitlens.gitExplorer.openFileRevisionInRemote', this.openFileRevisionInRemote, this);
|
||||
commands.registerCommand('gitlens.gitExplorer.openChangedFiles', this.openChangedFiles, this);
|
||||
commands.registerCommand('gitlens.gitExplorer.openChangedFileRevisions', this.openChangedFileRevisions, this);
|
||||
commands.registerCommand('gitlens.gitExplorer.applyChanges', this.applyChanges, this);
|
||||
|
||||
const fn = Functions.debounce(this.onActiveEditorChanged, 500);
|
||||
context.subscriptions.push(window.onDidChangeActiveTextEditor(fn, this));
|
||||
@@ -110,6 +111,11 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
private async applyChanges(node: CommitNode | StashNode) {
|
||||
await this.git.checkoutFile(node.uri);
|
||||
return this.openFile(node);
|
||||
}
|
||||
|
||||
private openChanges(node: CommitNode | StashNode) {
|
||||
const command = node.getCommand();
|
||||
if (command === undefined || command.arguments === undefined) return;
|
||||
|
||||
Reference in New Issue
Block a user