Skip to content

Commit 2228637

Browse files
authored
Merge pull request #5059 from JoeRobich/only-highlight-files
Only semantically highlight documents from uri.scheme 'file'
2 parents 8689c41 + c671cf6 commit 2228637

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/features/semanticTokensProvider.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,18 @@ export default class SemanticTokensProvider extends AbstractProvider implements
190190
}
191191

192192
async _provideSemanticTokens(document: vscode.TextDocument, range: protocol.V2.Range, token: vscode.CancellationToken): Promise<vscode.SemanticTokens | null> {
193+
// We can only semantically highlight file from disk.
194+
if (document.uri.scheme !== "file") {
195+
return null;
196+
}
197+
193198
const options = this.optionProvider.GetLatestOptions();
194199
if (!options.useSemanticHighlighting) {
195200
return null;
196201
}
197202

198203
let req = createRequest<protocol.V2.SemanticHighlightRequest>(document, new vscode.Position(0, 0));
199204
req.Range = range;
200-
// We need to include the document contents in our request for cases where we are highlighting
201-
// a version of the document other than the current version, such as in the Diff view.
202-
req.VersionedText = document.getText();
203205

204206
const versionBeforeRequest = document.version;
205207

0 commit comments

Comments
 (0)