Skip to content

Commit 9d25e59

Browse files
author
Orta Therox
authored
Adds Format param to the tsserver session (#41614)
* Adds the format flag for encodedSemanticClassifications in session.ts and protocol.ts * Update baselines * Whitespace"
1 parent f1e53da commit 9d25e59

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/server/protocol.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,6 @@ namespace ts.server.protocol {
838838
export interface EncodedSemanticClassificationsRequest extends FileRequest {
839839
arguments: EncodedSemanticClassificationsRequestArgs;
840840
}
841-
842841
/**
843842
* Arguments for EncodedSemanticClassificationsRequest request.
844843
*/
@@ -852,6 +851,10 @@ namespace ts.server.protocol {
852851
* Length of the span.
853852
*/
854853
length: number;
854+
/**
855+
* Optional for backwards compat, use "2020" for modern LSP-like classifications
856+
*/
857+
format?: ts.SemanticClassificationFormat
855858
}
856859

857860
/**
@@ -3318,6 +3321,8 @@ namespace ts.server.protocol {
33183321
Preserve = "Preserve",
33193322
ReactNative = "ReactNative",
33203323
React = "React",
3324+
ReactJSX = "ReactJSX",
3325+
ReactJSXDev = "ReactJSXDev",
33213326
}
33223327

33233328
export const enum ModuleKind {
@@ -3328,6 +3333,7 @@ namespace ts.server.protocol {
33283333
System = "System",
33293334
ES6 = "ES6",
33303335
ES2015 = "ES2015",
3336+
ES2020 = "ES2020",
33313337
ESNext = "ESNext"
33323338
}
33333339

@@ -3351,6 +3357,7 @@ namespace ts.server.protocol {
33513357
ES2018 = "ES2018",
33523358
ES2019 = "ES2019",
33533359
ES2020 = "ES2020",
3360+
JSON = "JSON",
33543361
ESNext = "ESNext"
33553362
}
33563363
}

src/server/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ namespace ts.server {
10811081

10821082
private getEncodedSemanticClassifications(args: protocol.EncodedSemanticClassificationsRequestArgs) {
10831083
const { file, project } = this.getFileAndProject(args);
1084-
return project.getLanguageService().getEncodedSemanticClassifications(file, args);
1084+
return project.getLanguageService().getEncodedSemanticClassifications(file, args, args.format);
10851085
}
10861086

10871087
private getProject(projectFileName: string | undefined): Project | undefined {

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9084,7 +9084,9 @@ declare namespace ts.server.protocol {
90849084
None = "None",
90859085
Preserve = "Preserve",
90869086
ReactNative = "ReactNative",
9087-
React = "React"
9087+
React = "React",
9088+
ReactJSX = "ReactJSX",
9089+
ReactJSXDev = "ReactJSXDev"
90889090
}
90899091
enum ModuleKind {
90909092
None = "None",
@@ -9094,6 +9096,7 @@ declare namespace ts.server.protocol {
90949096
System = "System",
90959097
ES6 = "ES6",
90969098
ES2015 = "ES2015",
9099+
ES2020 = "ES2020",
90979100
ESNext = "ESNext"
90989101
}
90999102
enum ModuleResolutionKind {
@@ -9114,6 +9117,7 @@ declare namespace ts.server.protocol {
91149117
ES2018 = "ES2018",
91159118
ES2019 = "ES2019",
91169119
ES2020 = "ES2020",
9120+
JSON = "JSON",
91179121
ESNext = "ESNext"
91189122
}
91199123
}

0 commit comments

Comments
 (0)