Skip to content

Commit

Permalink
Use original scheme (fixes #29872)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Jun 29, 2017
1 parent 605ee59 commit 8da3ea9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions extensions/merge-conflict/src/commandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ export default class CommandHandler implements vscode.Disposable {
}
}

const scheme = editor.document.uri.scheme;
let range = conflict.current.content;
const leftUri = editor.document.uri.with({
scheme: ContentProvider.scheme,
query: JSON.stringify(range)
query: JSON.stringify({ scheme, range })
});

range = conflict.incoming.content;
const rightUri = leftUri.with({ query: JSON.stringify(range) });
const rightUri = leftUri.with({ query: JSON.stringify({ scheme, range }) });

const title = localize('compareChangesTitle', '{0}: Current Changes ⟷ Incoming Changes', fileName);
vscode.commands.executeCommand('vscode.diff', leftUri, rightUri, title);
Expand Down
5 changes: 3 additions & 2 deletions extensions/merge-conflict/src/contentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export default class MergeConflictContentProvider implements vscode.TextDocument

async provideTextDocumentContent(uri: vscode.Uri): Promise<string | null> {
try {
const [start, end] = JSON.parse(uri.query) as { line: number, character: number }[];
const { scheme, range } = JSON.parse(uri.query) as { scheme: string; range: { line: number, character: number }[] };
const [start, end] = range;

const document = await vscode.workspace.openTextDocument(uri.with({ scheme: 'file', query: '' }));
const document = await vscode.workspace.openTextDocument(uri.with({ scheme, query: '' }));
const text = document.getText(new vscode.Range(start.line, start.character, end.line, end.character));
return text;
}
Expand Down

0 comments on commit 8da3ea9

Please sign in to comment.