-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose EncodedSemanticClassificationsRequest in protocol.d.ts #42640
Changes from 2 commits
863f7ea
4a10aee
6d0cee4
f320c77
26a0afd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -843,15 +843,13 @@ namespace ts.server.protocol { | |
/** | ||
* A request to get encoded semantic classifications for a span in the file | ||
*/ | ||
/** @internal */ | ||
export interface EncodedSemanticClassificationsRequest extends FileRequest { | ||
arguments: EncodedSemanticClassificationsRequestArgs; | ||
} | ||
|
||
/** | ||
* Arguments for EncodedSemanticClassificationsRequest request. | ||
*/ | ||
/** @internal */ | ||
export interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { | ||
/** | ||
* Start position of the span. | ||
|
@@ -868,6 +866,14 @@ namespace ts.server.protocol { | |
format?: "original" | "2020" | ||
} | ||
|
||
/** The response for a EncodedSemanticClassificationsRequest */ | ||
export interface EncodedSemanticClassificationsResponse extends Response { | ||
body?: { | ||
endOfLineState: EndOfLineState; | ||
spans: number[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dont we need specific enum for classifications returned otherwise vscode would need separate list? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, maybe, the spans looks like
When it's the older format, so I've included it but it's not referenced up here |
||
}; | ||
} | ||
|
||
/** | ||
* Arguments in document highlight request; include: filesToSearch, file, | ||
* line, offset. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7133,6 +7133,37 @@ declare namespace ts.server.protocol { | |
*/ | ||
body?: string[]; | ||
} | ||
/** | ||
* A request to get encoded semantic classifications for a span in the file | ||
*/ | ||
interface EncodedSemanticClassificationsRequest extends FileRequest { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we also need to add the response types? We currently have to maintain a copy of them in VS Code: https://github.com/microsoft/vscode/blob/3d500ebd8b4a919e8631e916f417e5c68eb90d3f/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts#L275 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren’t they in typescript/tsserver .d.ts ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We currently only use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, added |
||
arguments: EncodedSemanticClassificationsRequestArgs; | ||
} | ||
/** | ||
* Arguments for EncodedSemanticClassificationsRequest request. | ||
*/ | ||
interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { | ||
/** | ||
* Start position of the span. | ||
*/ | ||
start: number; | ||
/** | ||
* Length of the span. | ||
*/ | ||
length: number; | ||
/** | ||
* Optional parameter for the semantic highlighting response, if absent it | ||
* defaults to "original". | ||
*/ | ||
format?: "original" | "2020"; | ||
} | ||
/** The response for a EncodedSemanticClassificationsRequest */ | ||
interface EncodedSemanticClassificationsResponse extends Response { | ||
body?: { | ||
endOfLineState: EndOfLineState; | ||
spans: number[]; | ||
}; | ||
} | ||
/** | ||
* Arguments in document highlight request; include: filesToSearch, file, | ||
* line, offset. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull this out as
EncodedSemanticClassificationsResponseBody
interface