Selaa lähdekoodia

Fixes issue w/ previous line diff line # being off

main
Eric Amodio 4 vuotta sitten
vanhempi
commit
66d4cf81f5
2 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. +1
    -1
      src/commands/diffLineWithPrevious.ts
  2. +6
    -2
      src/git/gitService.ts

+ 1
- 1
src/commands/diffLineWithPrevious.ts Näytä tiedosto

@ -53,7 +53,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
sha: diffUris.current.sha || '', sha: diffUris.current.sha || '',
uri: diffUris.current.documentUri(), uri: diffUris.current.documentUri(),
}, },
line: args.line,
line: diffUris.line,
showOptions: args.showOptions, showOptions: args.showOptions,
}; };
return commands.executeCommand(Commands.DiffWith, diffArgs); return commands.executeCommand(Commands.DiffWith, diffArgs);

+ 6
- 2
src/git/gitService.ts Näytä tiedosto

@ -2270,7 +2270,7 @@ export class GitService implements Disposable {
editorLine: number, editorLine: number,
ref: string | undefined, ref: string | undefined,
skip: number = 0, skip: number = 0,
): Promise<{ current: GitUri; previous: GitUri | undefined } | undefined> {
): Promise<{ current: GitUri; previous: GitUri | undefined; line: number } | undefined> {
if (ref === GitService.deletedOrMissingSha) return undefined; if (ref === GitService.deletedOrMissingSha) return undefined;
let fileName = GitUri.relativeTo(uri, repoPath); let fileName = GitUri.relativeTo(uri, repoPath);
@ -2302,6 +2302,7 @@ export class GitService implements Disposable {
return { return {
current: GitUri.fromFile(fileName, repoPath, undefined), current: GitUri.fromFile(fileName, repoPath, undefined),
previous: GitUri.fromFile(fileName, repoPath, GitService.uncommittedStagedSha), previous: GitUri.fromFile(fileName, repoPath, GitService.uncommittedStagedSha),
line: editorLine,
}; };
} }
} }
@ -2310,6 +2311,7 @@ export class GitService implements Disposable {
return { return {
current: GitUri.fromFile(fileName, repoPath, undefined), current: GitUri.fromFile(fileName, repoPath, undefined),
previous: await this.getPreviousUri(repoPath, uri, undefined, skip, editorLine), previous: await this.getPreviousUri(repoPath, uri, undefined, skip, editorLine),
line: editorLine,
}; };
} }
@ -2353,6 +2355,7 @@ export class GitService implements Disposable {
return { return {
current: current, current: current,
previous: await this.getPreviousUri(repoPath, uri, undefined, skip, editorLine), previous: await this.getPreviousUri(repoPath, uri, undefined, skip, editorLine),
line: editorLine,
}; };
} }
@ -2379,7 +2382,8 @@ export class GitService implements Disposable {
return { return {
current: current, current: current,
previous: previous || (await this.getPreviousUri(repoPath, uri, ref, skip, editorLine)),
previous: previous ?? (await this.getPreviousUri(repoPath, uri, ref, skip, editorLine)),
line: editorLine,
}; };
} }

Ladataan…
Peruuta
Tallenna