Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/server/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,6 @@ namespace ts.server.protocol {
export interface EncodedSemanticClassificationsRequest extends FileRequest {
arguments: EncodedSemanticClassificationsRequestArgs;
}

/**
* Arguments for EncodedSemanticClassificationsRequest request.
*/
Expand All @@ -852,6 +851,10 @@ namespace ts.server.protocol {
* Length of the span.
*/
length: number;
/**
* Optional for backwards compat, use "2020" for modern LSP-like classifications
*/
format?: ts.SemanticClassificationFormat
Copy link
Contributor

@mjbvz mjbvz Nov 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orta Just want to check that this will also update the protocol.d.ts file that we consume. I didn't see the semantic APIs in the d.ts when I last checked

}

/**
Expand Down Expand Up @@ -3318,6 +3321,8 @@ namespace ts.server.protocol {
Preserve = "Preserve",
ReactNative = "ReactNative",
React = "React",
ReactJSX = "ReactJSX",
ReactJSXDev = "ReactJSXDev",
}

export const enum ModuleKind {
Expand All @@ -3328,6 +3333,7 @@ namespace ts.server.protocol {
System = "System",
ES6 = "ES6",
ES2015 = "ES2015",
ES2020 = "ES2020",
ESNext = "ESNext"
}

Expand All @@ -3351,6 +3357,7 @@ namespace ts.server.protocol {
ES2018 = "ES2018",
ES2019 = "ES2019",
ES2020 = "ES2020",
JSON = "JSON",
ESNext = "ESNext"
}
}
2 changes: 1 addition & 1 deletion src/server/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ namespace ts.server {

private getEncodedSemanticClassifications(args: protocol.EncodedSemanticClassificationsRequestArgs) {
const { file, project } = this.getFileAndProject(args);
return project.getLanguageService().getEncodedSemanticClassifications(file, args);
return project.getLanguageService().getEncodedSemanticClassifications(file, args, args.format);
}

private getProject(projectFileName: string | undefined): Project | undefined {
Expand Down
6 changes: 5 additions & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9084,7 +9084,9 @@ declare namespace ts.server.protocol {
None = "None",
Preserve = "Preserve",
ReactNative = "ReactNative",
React = "React"
React = "React",
ReactJSX = "ReactJSX",
ReactJSXDev = "ReactJSXDev"
}
enum ModuleKind {
None = "None",
Expand All @@ -9094,6 +9096,7 @@ declare namespace ts.server.protocol {
System = "System",
ES6 = "ES6",
ES2015 = "ES2015",
ES2020 = "ES2020",
ESNext = "ESNext"
}
enum ModuleResolutionKind {
Expand All @@ -9114,6 +9117,7 @@ declare namespace ts.server.protocol {
ES2018 = "ES2018",
ES2019 = "ES2019",
ES2020 = "ES2020",
JSON = "JSON",
ESNext = "ESNext"
}
}
Expand Down