Expose EncodedSemanticClassificationsRequest in protocol.d.ts (#42640)

* Expose EncodedSemanticClassificationsRequest in protocol.d.ts

* Adds the response for encoded semantic highlights too

* Update types:

* Also include classificationtype anyway

* Fix feedback
This commit is contained in:
Orta Therox 2021-02-25 21:40:52 +00:00 committed by GitHub
parent 576bfbd9d5
commit a2f09ed4fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 102 additions and 2 deletions

View file

@ -843,7 +843,6 @@ 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;
}
@ -851,7 +850,6 @@ namespace ts.server.protocol {
/**
* Arguments for EncodedSemanticClassificationsRequest request.
*/
/** @internal */
export interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
/**
* Start position of the span.
@ -868,6 +866,18 @@ namespace ts.server.protocol {
format?: "original" | "2020"
}
/** The response for a EncodedSemanticClassificationsRequest */
export interface EncodedSemanticClassificationsResponse extends Response {
body?: EncodedSemanticClassificationsResponseBody
}
/**
* Implementation response message. Gives series of text spans depending on the format ar.
*/
export interface EncodedSemanticClassificationsResponseBody {
endOfLineState: EndOfLineState;
spans: number[];
}
/**
* Arguments in document highlight request; include: filesToSearch, file,
* line, offset.
@ -3390,4 +3400,32 @@ namespace ts.server.protocol {
ES2020 = "ES2020",
ESNext = "ESNext"
}
export const enum ClassificationType {
comment = 1,
identifier = 2,
keyword = 3,
numericLiteral = 4,
operator = 5,
stringLiteral = 6,
regularExpressionLiteral = 7,
whiteSpace = 8,
text = 9,
punctuation = 10,
className = 11,
enumName = 12,
interfaceName = 13,
moduleName = 14,
typeParameterName = 15,
typeAliasName = 16,
parameterName = 17,
docCommentTagName = 18,
jsxOpenTagName = 19,
jsxCloseTagName = 20,
jsxSelfClosingTagName = 21,
jsxAttribute = 22,
jsxText = 23,
jsxAttributeStringLiteralValue = 24,
bigintLiteral = 25,
}
}

View file

@ -7138,6 +7138,41 @@ declare namespace ts.server.protocol {
*/
body?: string[];
}
/**
* A request to get encoded semantic classifications for a span in the file
*/
interface EncodedSemanticClassificationsRequest extends FileRequest {
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?: EncodedSemanticClassificationsResponseBody;
}
/**
* Implementation response message. Gives series of text spans depending on the format ar.
*/
interface EncodedSemanticClassificationsResponseBody {
endOfLineState: EndOfLineState;
spans: number[];
}
/**
* Arguments in document highlight request; include: filesToSearch, file,
* line, offset.
@ -9161,6 +9196,33 @@ declare namespace ts.server.protocol {
ES2020 = "ES2020",
ESNext = "ESNext"
}
enum ClassificationType {
comment = 1,
identifier = 2,
keyword = 3,
numericLiteral = 4,
operator = 5,
stringLiteral = 6,
regularExpressionLiteral = 7,
whiteSpace = 8,
text = 9,
punctuation = 10,
className = 11,
enumName = 12,
interfaceName = 13,
moduleName = 14,
typeParameterName = 15,
typeAliasName = 16,
parameterName = 17,
docCommentTagName = 18,
jsxOpenTagName = 19,
jsxCloseTagName = 20,
jsxSelfClosingTagName = 21,
jsxAttribute = 22,
jsxText = 23,
jsxAttributeStringLiteralValue = 24,
bigintLiteral = 25
}
}
declare namespace ts.server {
interface ScriptInfoVersion {