mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-23 01:35:37 -05:00
Uses current branch when opening remote file
Adds current branch name to quick pick description
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { GitRemote, RemoteProviderOpenType } from '../gitService';
|
||||
import { GitRemote, RemoteOpenType } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickPicks';
|
||||
|
||||
@@ -11,7 +11,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
|
||||
super(Commands.OpenInRemote);
|
||||
}
|
||||
|
||||
async execute(editor: TextEditor, uri?: Uri, remotes?: GitRemote[], type?: RemoteProviderOpenType, args?: string[], name?: string, goBackCommand?: CommandQuickPickItem) {
|
||||
async execute(editor: TextEditor, uri?: Uri, remotes?: GitRemote[], type?: RemoteOpenType, args?: string[], goBackCommand?: CommandQuickPickItem) {
|
||||
if (!(uri instanceof Uri)) {
|
||||
uri = editor && editor.document && editor.document.uri;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
|
||||
if (!remotes) return undefined;
|
||||
|
||||
if (remotes.length === 1) {
|
||||
const command = new OpenRemoteCommandQuickPickItem(remotes[0], type, ...args, name);
|
||||
const command = new OpenRemoteCommandQuickPickItem(remotes[0], type, ...args);
|
||||
return command.execute();
|
||||
}
|
||||
|
||||
@@ -34,14 +34,15 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
|
||||
placeHolder = `open commit ${shortSha} in\u2026`;
|
||||
break;
|
||||
case 'file':
|
||||
const shortFileSha = (args[1] && args[1].substring(0, 8)) || '';
|
||||
case 'working-file':
|
||||
const shortFileSha = (args[2] && args[2].substring(0, 8)) || '';
|
||||
const shaSuffix = shortFileSha ? ` \u00a0\u2022\u00a0 ${shortFileSha}` : '';
|
||||
|
||||
placeHolder = `open ${args[0]}${shaSuffix} in\u2026`;
|
||||
break;
|
||||
}
|
||||
|
||||
const pick = await RemotesQuickPick.show(remotes, placeHolder, type, args, name, goBackCommand);
|
||||
const pick = await RemotesQuickPick.show(remotes, placeHolder, type, args, goBackCommand);
|
||||
return pick && pick.execute();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user