[PATCH] D69996: [clangd] Fixed colon escaping on Windows
liu hui via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 02:01:12 PST 2019
lh123 created this revision.
lh123 added reviewers: sammccall, ilya-biryukov, hokein.
lh123 added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.
vscode always escapes the colon on the file uri, which causes the semantic highlighting fails on windows.
fixes: https://github.com/clangd/clangd/issues/176
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D69996
Files:
clang-tools-extra/clangd/clients/clangd-vscode/package.json
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===================================================================
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -116,9 +116,9 @@
this.subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(
(editors: vscode.TextEditor[]) =>
editors.forEach((e) => this.highlighter.applyHighlights(
- e.document.uri.toString()))));
+ e.document.uri.toString(true)))));
this.subscriptions.push(vscode.workspace.onDidCloseTextDocument(
- (doc) => this.highlighter.removeFileHighlightings(doc.uri.toString())));
+ (doc) => this.highlighter.removeFileHighlightings(doc.uri.toString(true))));
}
handleNotification(params: SemanticHighlightingParams) {
@@ -224,7 +224,8 @@
// TextEditorDecorationType is used per scope.
const ranges = this.getDecorationRanges(fileUri);
vscode.window.visibleTextEditors.forEach((e) => {
- if (e.document.uri.toString() !== fileUri)
+ // Pass true to prevent escaped colon
+ if (e.document.uri.toString(true) !== fileUri)
return;
this.decorationTypes.forEach((d, i) => e.setDecorations(d, ranges[i]));
});
@@ -239,8 +240,8 @@
// Gets the uris as strings for the currently visible text editors.
protected getVisibleTextEditorUris(): string[] {
- return vscode.window.visibleTextEditors.map((e) =>
- e.document.uri.toString());
+ return vscode.window.visibleTextEditors.map(
+ (e) => e.document.uri.toString(true));
}
// Returns the ranges that should be used when decorating. Index i in the
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===================================================================
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
"name": "vscode-clangd",
"displayName": "vscode-clangd",
"description": "Clang Language Server",
- "version": "0.0.18",
+ "version": "0.0.19",
"publisher": "llvm-vs-code-extensions",
"homepage": "https://clang.llvm.org/extra/clangd.html",
"engines": {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69996.228382.patch
Type: text/x-patch
Size: 2422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191108/70b38d4e/attachment.bin>
More information about the cfe-commits
mailing list