Quellcode durchsuchen

Ensures uri matches editor before getting a range

main
Eric Amodio vor 5 Jahren
Ursprung
Commit
5c03903da5
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. +5
    -4
      src/commands/copyRemoteFileUrlToClipboard.ts
  2. +2
    -1
      src/commands/openFileInRemote.ts

+ 5
- 4
src/commands/copyRemoteFileUrlToClipboard.ts Datei anzeigen

@ -24,10 +24,11 @@ export class CopyRemoteFileUrlToClipboardCommand extends ActiveEditorCommand {
}
protected preExecute(context: CommandContext, args: CopyRemoteFileUrlToClipboardCommandArgs = { range: true }) {
if (isCommandViewContextWithCommit(context)) {
args = { ...args };
args.range = false;
args.sha = context.node.commit.sha;
if (context.type === 'uri' || context.type === 'scm-states') {
args = { ...args, range: false };
}
else if (isCommandViewContextWithCommit(context)) {
args = { ...args, range: false, sha: context.node.commit.sha };
// If it is a StatusFileNode then don't include the sha, since it hasn't been pushed yet
if (context.node instanceof StatusFileNode) {

+ 2
- 1
src/commands/openFileInRemote.ts Datei anzeigen

@ -16,6 +16,7 @@ import {
} from './common';
import { OpenInRemoteCommandArgs } from './openInRemote';
import { Strings } from '../system';
import { UriComparer } from '../comparers';
export interface OpenFileInRemoteCommandArgs {
branch?: string;
@ -58,7 +59,7 @@ export class OpenFileInRemoteCommand extends ActiveEditorCommand {
try {
const remotes = await Container.git.getRemotes(gitUri.repoPath);
const range =
args.range && editor != null
args.range && editor != null && UriComparer.equals(editor.document.uri, uri)
? new Range(
editor.selection.start.with({ line: editor.selection.start.line + 1 }),
editor.selection.end.with({ line: editor.selection.end.line + 1 })

Laden…
Abbrechen
Speichern