Skip to content

Commit d10ff1d

Browse files
authored
Revert "feat: add semantic tokens (#2191)" (#2197)
This reverts commit 1c0fd4e. This change has had unintended consequences for highlighting outside template regions. fixes #2196
1 parent 54f11e3 commit d10ff1d

File tree

3 files changed

+0
-99
lines changed

3 files changed

+0
-99
lines changed

client/src/client.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,6 @@ export class AngularLanguageClient implements vscode.Disposable {
171171
}
172172
return next(document, context, token);
173173
},
174-
provideDocumentSemanticTokens: async (document, token, next) => {
175-
if (await this.isInAngularProject(document)) {
176-
return next(document, token);
177-
}
178-
},
179-
provideDocumentRangeSemanticTokens: async (document, range, token, next) => {
180-
if (await this.isInAngularProject(document)) {
181-
return next(document, range, token);
182-
}
183-
},
184174
}
185175
};
186176
}

server/src/semantic_tokens.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

server/src/session.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {GetComponentsWithTemplateFile, GetTcbParams, GetTcbRequest, GetTcbRespon
2020
import {readNgCompletionData, tsCompletionEntryToLspCompletionItem} from './completion';
2121
import {tsDiagnosticToLspDiagnostic} from './diagnostic';
2222
import {getHTMLVirtualContent} from './embedded_support';
23-
import {getSemanticTokens} from './semantic_tokens';
2423
import {ServerHost} from './server_host';
2524
import {documentationToMarkdown} from './text_render';
2625
import {filePathToUri, getMappedDefinitionInfo, isConfiguredProject, isDebugMode, lspPositionToTsPosition, lspRangeToTsPositions, MruTracker, tsDisplayPartsToText, tsFileTextChangesToLspWorkspaceEdit, tsTextSpanToLspRange, uriToFilePath} from './utils';
@@ -218,38 +217,8 @@ export class Session {
218217
conn.onSignatureHelp(p => this.onSignatureHelp(p));
219218
conn.onCodeAction(p => this.onCodeAction(p));
220219
conn.onCodeActionResolve(async p => await this.onCodeActionResolve(p));
221-
conn.onRequest(lsp.SemanticTokensRequest.type, p => this.onSemanticTokensRequest(p));
222-
conn.onRequest(lsp.SemanticTokensRangeRequest.type, p => this.onSemanticTokensRangeRequest(p));
223220
}
224221

225-
private onSemanticTokensRequest(params: lsp.SemanticTokensParams): lsp.SemanticTokens|null {
226-
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
227-
if (lsInfo === null) {
228-
return null;
229-
}
230-
const {languageService, scriptInfo} = lsInfo;
231-
const span = {start: 0, length: scriptInfo.getSnapshot().getLength()};
232-
const classifications = languageService.getEncodedSemanticClassifications(
233-
scriptInfo.fileName, span, ts.SemanticClassificationFormat.TwentyTwenty);
234-
return getSemanticTokens(languageService, classifications, scriptInfo);
235-
}
236-
237-
private onSemanticTokensRangeRequest(params: lsp.SemanticTokensRangeParams): lsp.SemanticTokens
238-
|null {
239-
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
240-
if (lsInfo === null) {
241-
return null;
242-
}
243-
const {languageService, scriptInfo} = lsInfo;
244-
const start = lspPositionToTsPosition(lsInfo.scriptInfo, params.range.start);
245-
const end = lspPositionToTsPosition(lsInfo.scriptInfo, params.range.end);
246-
const span = {start, length: end - start};
247-
const classifications = languageService.getEncodedSemanticClassifications(
248-
scriptInfo.fileName, span, ts.SemanticClassificationFormat.TwentyTwenty);
249-
return getSemanticTokens(languageService, classifications, scriptInfo);
250-
}
251-
252-
253222
private onCodeAction(params: lsp.CodeActionParams): lsp.CodeAction[]|null {
254223
const filePath = uriToFilePath(params.textDocument.uri);
255224
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
@@ -840,17 +809,6 @@ export class Session {
840809
// [here](https://github.com/angular/vscode-ng-language-service/issues/1828)
841810
codeActionKinds: [lsp.CodeActionKind.QuickFix],
842811
},
843-
semanticTokensProvider: {
844-
documentSelector: null,
845-
legend: {
846-
tokenTypes: [
847-
'class',
848-
],
849-
tokenModifiers: [],
850-
},
851-
full: true,
852-
range: true
853-
}
854812
},
855813
serverOptions,
856814
};

0 commit comments

Comments
 (0)