This commit is contained in:
Michael Zhao 2025-12-20 08:31:21 +01:00 committed by GitHub
commit 7588d4fe31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View file

@ -547,6 +547,18 @@ export interface TypeScriptWorker {
* @returns `Promise<typescript.InlayHint[]>`
*/
provideInlayHints(fileName: string, start: number, end: number): Promise<ReadonlyArray<any>>;
/**
* Get encoded semantic classifications in the range of the file.
*
* The returned number array is encoded as triples of [start, length, ClassificationType, ...].
* @returns `Promise<typescript.Classifications | undefined>`
*/
getEncodedSemanticClassifications(
fileName: string,
start: number,
end: number
): Promise<{ spans: number[] } | undefined>;
}
// --- TypeScript configuration and defaults ---------

View file

@ -473,6 +473,21 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
return [];
}
}
async getEncodedSemanticClassifications(
fileName: string,
start: number,
end: number
): Promise<ts.Classifications | undefined> {
if (fileNameIsLib(fileName)) {
return undefined;
}
return this._languageService.getEncodedSemanticClassifications(
fileName,
{ start, length: end - start },
'2020' as ts.SemanticClassificationFormat
);
}
}
export interface ICreateData {