mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Stops trying to set the line if we don't have one
This commit is contained in:
@@ -79,6 +79,8 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(gitUri.fsPath)} (${gitUri.shortSha})`,
|
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(gitUri.fsPath)} (${gitUri.shortSha})`,
|
||||||
args.showOptions);
|
args.showOptions);
|
||||||
|
|
||||||
|
if (args.line === undefined || args.line === 0) return undefined;
|
||||||
|
|
||||||
// TODO: Figure out how to focus the left pane
|
// TODO: Figure out how to focus the left pane
|
||||||
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
|
|||||||
`${path.basename(gitUri.fsPath)} (${branch}) ${GlyphChars.ArrowLeftRight} ${path.basename(gitUri.fsPath)}`,
|
`${path.basename(gitUri.fsPath)} (${branch}) ${GlyphChars.ArrowLeftRight} ${path.basename(gitUri.fsPath)}`,
|
||||||
args.showOptions);
|
args.showOptions);
|
||||||
|
|
||||||
|
if (args.line === undefined || args.line === 0) return undefined;
|
||||||
|
|
||||||
// TODO: Figure out how to focus the left pane
|
// TODO: Figure out how to focus the left pane
|
||||||
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
|
|||||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.nextUri.fsPath)} (${args.commit.nextShortSha})`,
|
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.nextUri.fsPath)} (${args.commit.nextShortSha})`,
|
||||||
args.showOptions);
|
args.showOptions);
|
||||||
|
|
||||||
|
if (args.line === undefined || args.line === 0) return undefined;
|
||||||
|
|
||||||
// TODO: Figure out how to focus the left pane
|
// TODO: Figure out how to focus the left pane
|
||||||
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,14 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
uri = getCommandUri(uri, editor);
|
uri = getCommandUri(uri, editor);
|
||||||
if (uri === undefined) return undefined;
|
if (uri === undefined) return undefined;
|
||||||
|
|
||||||
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
|
if (args.commit !== undefined && args.commit.type !== 'file') {
|
||||||
|
args.line = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
|
||||||
|
}
|
||||||
|
|
||||||
if (args.commit === undefined || (args.commit.type !== 'file') || args.range !== undefined) {
|
if (args.commit === undefined || args.commit.type !== 'file' || args.range !== undefined) {
|
||||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -62,6 +67,8 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
`${path.basename(args.commit.previousUri.fsPath)} (${args.commit.previousShortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha})`,
|
`${path.basename(args.commit.previousUri.fsPath)} (${args.commit.previousShortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha})`,
|
||||||
args.showOptions);
|
args.showOptions);
|
||||||
|
|
||||||
|
if (args.line === undefined || args.line === 0) return undefined;
|
||||||
|
|
||||||
// TODO: Figure out how to focus the left pane
|
// TODO: Figure out how to focus the left pane
|
||||||
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
|
|||||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(workingFileName)}`,
|
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(workingFileName)}`,
|
||||||
args.showOptions);
|
args.showOptions);
|
||||||
|
|
||||||
|
if (args.line === undefined || args.line === 0) return undefined;
|
||||||
|
|
||||||
// TODO: Figure out how to focus the left pane
|
// TODO: Figure out how to focus the left pane
|
||||||
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user