From ac1ac4d95ab780d576749ae5ebb138fc9eaed8e7 Mon Sep 17 00:00:00 2001 From: Orta Date: Tue, 12 Jan 2021 21:24:41 +0000 Subject: [PATCH] WIP-semantic in session based TS --- src/server/protocol.ts | 5 +++++ src/server/session.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 9b406411dfd2d..237ce1fd5a05f 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -861,6 +861,11 @@ namespace ts.server.protocol { * Length of the span. */ length: number; + /** + * Optional parameter for the semantic highlighting response, if absent it + * defaults to "original". + */ + format?: "original" | "2020" } /** diff --git a/src/server/session.ts b/src/server/session.ts index a3fcdc7787e7a..99133fbbff865 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1115,7 +1115,8 @@ namespace ts.server { private getEncodedSemanticClassifications(args: protocol.EncodedSemanticClassificationsRequestArgs) { const { file, project } = this.getFileAndProject(args); - return project.getLanguageService().getEncodedSemanticClassifications(file, args); + const format = args.format === "2020" ? SemanticClassificationFormat.TwentyTwenty : SemanticClassificationFormat.Original; + return project.getLanguageService().getEncodedSemanticClassifications(file, args, format); } private getProject(projectFileName: string | undefined): Project | undefined {