Skip to content

Commit 6e50853

Browse files
committed
Trivially expose getEncodedSyntacticClassifications
1 parent 7ed3896 commit 6e50853

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/server/protocol.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ namespace ts.server.protocol {
9494
ApplyChangedToOpenFiles = "applyChangedToOpenFiles",
9595
UpdateOpen = "updateOpen",
9696
/* @internal */
97+
EncodedSyntacticClassificationsFull = "encodedSyntacticClassifications-full",
98+
/* @internal */
9799
EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full",
98100
/* @internal */
99101
Cleanup = "cleanup",
@@ -764,6 +766,28 @@ namespace ts.server.protocol {
764766
body?: string[];
765767
}
766768

769+
/**
770+
* A request to get encoded Syntactic classifications for a span in the file
771+
*/
772+
/** @internal */
773+
export interface EncodedSyntacticClassificationsRequest extends FileRequest {
774+
arguments: EncodedSyntacticClassificationsRequestArgs;
775+
}
776+
777+
/**
778+
* Arguments for EncodedSyntacticClassificationsRequest request.
779+
*/
780+
export interface EncodedSyntacticClassificationsRequestArgs extends FileRequestArgs {
781+
/**
782+
* Start position of the span.
783+
*/
784+
start: number;
785+
/**
786+
* Length of the span.
787+
*/
788+
length: number;
789+
}
790+
767791
/**
768792
* A request to get encoded semantic classifications for a span in the file
769793
*/

src/server/session.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,11 @@ namespace ts.server {
881881
}
882882
}
883883

884+
private getEncodedSyntacticClassifications(args: protocol.EncodedSyntacticClassificationsRequestArgs) {
885+
const { file, project } = this.getFileAndProject(args);
886+
return project.getLanguageService().getEncodedSyntacticClassifications(file, args);
887+
}
888+
884889
private getEncodedSemanticClassifications(args: protocol.EncodedSemanticClassificationsRequestArgs) {
885890
const { file, project } = this.getFileAndProject(args);
886891
return project.getLanguageService().getEncodedSemanticClassifications(file, args);
@@ -2299,6 +2304,9 @@ namespace ts.server {
22992304
[CommandNames.CompilerOptionsDiagnosticsFull]: (request: protocol.CompilerOptionsDiagnosticsRequest) => {
23002305
return this.requiredResponse(this.getCompilerOptionsDiagnostics(request.arguments));
23012306
},
2307+
[CommandNames.EncodedSyntacticClassificationsFull]: (request: protocol.EncodedSyntacticClassificationsRequest) => {
2308+
return this.requiredResponse(this.getEncodedSyntacticClassifications(request.arguments));
2309+
},
23022310
[CommandNames.EncodedSemanticClassificationsFull]: (request: protocol.EncodedSemanticClassificationsRequest) => {
23032311
return this.requiredResponse(this.getEncodedSemanticClassifications(request.arguments));
23042312
},

0 commit comments

Comments
 (0)