Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/harness/fourslashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

span is definitely defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If the file is defined, the span definitely is.

}
return part;
});
}

const span = { start: hint.position, length: hint.text.length };
const { character, line } = this.languageServiceAdapterHost.positionToLineAndCharacter(fileName, span.start);
const underline = " ".repeat(character) + "^";
Expand Down