mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-16 09:35:40 -05:00
Adds line support to Open File in Remote command
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { Arrays } from '../system';
|
||||
import { commands, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { commands, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands } from './commands';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
@@ -22,7 +22,8 @@ export class OpenFileInRemoteCommand extends ActiveEditorCommand {
|
||||
|
||||
try {
|
||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.repoPath), _ => _.url, _ => !!_.provider);
|
||||
return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'file', [gitUri.getRelativePath(), branch.name, gitUri.sha]);
|
||||
const range = editor && new Range(editor.selection.start.with({ line: editor.selection.start.line + 1 }), editor.selection.end.with({ line: editor.selection.end.line + 1 }));
|
||||
return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'file', [gitUri.getRelativePath(), branch.name, gitUri.sha, range]);
|
||||
}
|
||||
catch (ex) {
|
||||
Logger.error(ex, 'OpenFileInRemoteCommand');
|
||||
|
||||
Reference in New Issue
Block a user