Remove lib.d.ts line info in inlay hint baselines (#55426)

This commit is contained in:
Maria José Solano
2023-08-22 11:14:20 -07:00
committed by GitHub
parent 97d8c83bce
commit 507fd31d8b

View File

@@ -839,6 +839,15 @@ export class TestState {
const fileName = this.activeFile.fileName;
const hints = this.languageService.provideInlayHints(fileName, span, preferences);
const annotations = ts.map(hints.sort(sortHints), hint => {
if (hint.displayParts) {
hint.displayParts = ts.map(hint.displayParts, part => {
if (part.file && /lib(?:.*)\.d\.ts$/.test(part.file)) {
part.span!.start = -1;
}
return part;
});
}
const span = { start: hint.position, length: hint.text.length };
const { character, line } = this.languageServiceAdapterHost.positionToLineAndCharacter(fileName, span.start);
const underline = " ".repeat(character) + "^";