mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #31988 from amcasey/SyntacticClassifications
Trivially expose getEncodedSyntacticClassifications
This commit is contained in:
@@ -94,6 +94,8 @@ namespace ts.server.protocol {
|
||||
ApplyChangedToOpenFiles = "applyChangedToOpenFiles",
|
||||
UpdateOpen = "updateOpen",
|
||||
/* @internal */
|
||||
EncodedSyntacticClassificationsFull = "encodedSyntacticClassifications-full",
|
||||
/* @internal */
|
||||
EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full",
|
||||
/* @internal */
|
||||
Cleanup = "cleanup",
|
||||
@@ -764,6 +766,29 @@ namespace ts.server.protocol {
|
||||
body?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A request to get encoded Syntactic classifications for a span in the file
|
||||
*/
|
||||
/** @internal */
|
||||
export interface EncodedSyntacticClassificationsRequest extends FileRequest {
|
||||
arguments: EncodedSyntacticClassificationsRequestArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for EncodedSyntacticClassificationsRequest request.
|
||||
*/
|
||||
/** @internal */
|
||||
export interface EncodedSyntacticClassificationsRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* Start position of the span.
|
||||
*/
|
||||
start: number;
|
||||
/**
|
||||
* Length of the span.
|
||||
*/
|
||||
length: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A request to get encoded semantic classifications for a span in the file
|
||||
*/
|
||||
@@ -775,6 +800,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* Arguments for EncodedSemanticClassificationsRequest request.
|
||||
*/
|
||||
/** @internal */
|
||||
export interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* Start position of the span.
|
||||
|
||||
@@ -881,6 +881,11 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
private getEncodedSyntacticClassifications(args: protocol.EncodedSyntacticClassificationsRequestArgs) {
|
||||
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
|
||||
return languageService.getEncodedSyntacticClassifications(file, args);
|
||||
}
|
||||
|
||||
private getEncodedSemanticClassifications(args: protocol.EncodedSemanticClassificationsRequestArgs) {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
return project.getLanguageService().getEncodedSemanticClassifications(file, args);
|
||||
@@ -2299,6 +2304,9 @@ namespace ts.server {
|
||||
[CommandNames.CompilerOptionsDiagnosticsFull]: (request: protocol.CompilerOptionsDiagnosticsRequest) => {
|
||||
return this.requiredResponse(this.getCompilerOptionsDiagnostics(request.arguments));
|
||||
},
|
||||
[CommandNames.EncodedSyntacticClassificationsFull]: (request: protocol.EncodedSyntacticClassificationsRequest) => {
|
||||
return this.requiredResponse(this.getEncodedSyntacticClassifications(request.arguments));
|
||||
},
|
||||
[CommandNames.EncodedSemanticClassificationsFull]: (request: protocol.EncodedSemanticClassificationsRequest) => {
|
||||
return this.requiredResponse(this.getEncodedSemanticClassifications(request.arguments));
|
||||
},
|
||||
|
||||
+1
-13
@@ -6415,19 +6415,6 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
body?: string[];
|
||||
}
|
||||
/**
|
||||
* Arguments for EncodedSemanticClassificationsRequest request.
|
||||
*/
|
||||
interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* Start position of the span.
|
||||
*/
|
||||
start: number;
|
||||
/**
|
||||
* Length of the span.
|
||||
*/
|
||||
length: number;
|
||||
}
|
||||
/**
|
||||
* Arguments in document highlight request; include: filesToSearch, file,
|
||||
* line, offset.
|
||||
@@ -9076,6 +9063,7 @@ declare namespace ts.server {
|
||||
private updateErrorCheck;
|
||||
private cleanProjects;
|
||||
private cleanup;
|
||||
private getEncodedSyntacticClassifications;
|
||||
private getEncodedSemanticClassifications;
|
||||
private getProject;
|
||||
private getConfigFileAndProject;
|
||||
|
||||
Reference in New Issue
Block a user