Use own version of toJson

This avoids having the uri transformed unexpectedly
This commit is contained in:
Matt Bierner 2020-07-12 13:54:55 -07:00
parent 5e96337121
commit 1cfd3a1b28

View file

@ -32,10 +32,19 @@ export class OpenDocumentLinkCommand implements Command {
path: vscode.Uri,
fragment: string,
): vscode.Uri {
const toJson = (uri: vscode.Uri) => {
return {
scheme: uri.scheme,
authority: uri.authority,
path: uri.path,
fragment: uri.fragment,
query: uri.query,
};
};
return vscode.Uri.parse(`command:${OpenDocumentLinkCommand.id}?${encodeURIComponent(JSON.stringify(<OpenDocumentLinkArgs>{
path: path.toJSON(),
path: toJson(path),
fragment,
fromResource: fromResource.toJSON(),
fromResource: toJson(fromResource),
}))}`);
}