mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Scrolls to the correct position in the diff
This commit is contained in:
@@ -65,7 +65,7 @@ export class DiffWithPreviousCommand extends EditorCommand {
|
|||||||
// which for a diff could be the first difference
|
// which for a diff could be the first difference
|
||||||
return Promise.all([this.git.getVersionedFile(uri.fsPath, sha), this.git.getVersionedFile(uri.fsPath, compareWithSha)])
|
return Promise.all([this.git.getVersionedFile(uri.fsPath, sha), this.git.getVersionedFile(uri.fsPath, compareWithSha)])
|
||||||
.then(values => commands.executeCommand(BuiltInCommands.Diff, Uri.file(values[1]), Uri.file(values[0]), `${basename(compareWithUri.fsPath)} (${compareWithSha}) ↔ ${basename(shaUri.fsPath)} (${sha})`)
|
.then(values => commands.executeCommand(BuiltInCommands.Diff, Uri.file(values[1]), Uri.file(values[0]), `${basename(compareWithUri.fsPath)} (${compareWithSha}) ↔ ${basename(shaUri.fsPath)} (${sha})`)
|
||||||
.then(() => commands.executeCommand(BuiltInCommands.CursorMove, { to: 'down', value: line })));
|
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, {lineNumber: line, at: 'center'})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ export class DiffWithWorkingCommand extends EditorCommand {
|
|||||||
// which for a diff could be the first difference
|
// which for a diff could be the first difference
|
||||||
return this.git.getVersionedFile(shaUri.fsPath, sha)
|
return this.git.getVersionedFile(shaUri.fsPath, sha)
|
||||||
.then(compare => commands.executeCommand(BuiltInCommands.Diff, Uri.file(compare), uri, `${basename(shaUri.fsPath)} (${sha}) ↔ ${basename(uri.fsPath)} (index)`)
|
.then(compare => commands.executeCommand(BuiltInCommands.Diff, Uri.file(compare), uri, `${basename(shaUri.fsPath)} (${sha}) ↔ ${basename(uri.fsPath)} (index)`)
|
||||||
.then(() => commands.executeCommand(BuiltInCommands.CursorMove, { to: 'down', value: line })));
|
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, {lineNumber: line, at: 'center'})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ export const DiagnosticCollectionName = 'gitlens';
|
|||||||
export const DiagnosticSource = 'GitLens';
|
export const DiagnosticSource = 'GitLens';
|
||||||
export const RepoPath = 'repoPath';
|
export const RepoPath = 'repoPath';
|
||||||
|
|
||||||
export type BuiltInCommands = 'cursorMove' | 'vscode.diff' | 'vscode.executeDocumentSymbolProvider' | 'vscode.executeCodeLensProvider' | 'editor.action.showReferences' | 'editor.action.toggleRenderWhitespace';
|
export type BuiltInCommands = 'cursorMove' | 'editor.action.showReferences' | 'editor.action.toggleRenderWhitespace' | 'editorScroll' | 'revealLine' | 'vscode.diff' | 'vscode.executeDocumentSymbolProvider' | 'vscode.executeCodeLensProvider';
|
||||||
export const BuiltInCommands = {
|
export const BuiltInCommands = {
|
||||||
CursorMove: 'cursorMove' as BuiltInCommands,
|
CursorMove: 'cursorMove' as BuiltInCommands,
|
||||||
Diff: 'vscode.diff' as BuiltInCommands,
|
Diff: 'vscode.diff' as BuiltInCommands,
|
||||||
|
EditorScroll: 'editorScroll' as BuiltInCommands,
|
||||||
ExecuteDocumentSymbolProvider: 'vscode.executeDocumentSymbolProvider' as BuiltInCommands,
|
ExecuteDocumentSymbolProvider: 'vscode.executeDocumentSymbolProvider' as BuiltInCommands,
|
||||||
ExecuteCodeLensProvider: 'vscode.executeCodeLensProvider' as BuiltInCommands,
|
ExecuteCodeLensProvider: 'vscode.executeCodeLensProvider' as BuiltInCommands,
|
||||||
|
RevealLine: 'revealLine' as BuiltInCommands,
|
||||||
ShowReferences: 'editor.action.showReferences' as BuiltInCommands,
|
ShowReferences: 'editor.action.showReferences' as BuiltInCommands,
|
||||||
ToggleRenderWhitespace: 'editor.action.toggleRenderWhitespace' as BuiltInCommands
|
ToggleRenderWhitespace: 'editor.action.toggleRenderWhitespace' as BuiltInCommands
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user