diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 1ce0c66019f6d..297e0705fa3f9 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -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, + } } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index d2e7603a3c959..32e43fc0c4c77 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -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 {