mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 22:32:33 -05:00
[Interactive inlay hints] Get source file from parameter node (#55476)
This commit is contained in:
committed by
GitHub
parent
12d9f04d33
commit
5fe88ea044
@@ -1875,14 +1875,24 @@ export class Session<TMessage = string> implements EventSender {
|
||||
return {
|
||||
...hint,
|
||||
position: scriptInfo.positionToLineOffset(position),
|
||||
displayParts: displayParts?.map(({ text, span, file }) => ({
|
||||
text,
|
||||
span: span && {
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
||||
file: file!,
|
||||
},
|
||||
})),
|
||||
displayParts: displayParts?.map(({ text, span, file }) => {
|
||||
if (span) {
|
||||
Debug.assertIsDefined(file, "Target file should be defined together with its span.");
|
||||
const scriptInfo = this.projectService.getScriptInfo(file)!;
|
||||
|
||||
return {
|
||||
text,
|
||||
span: {
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
||||
file,
|
||||
},
|
||||
};
|
||||
}
|
||||
else {
|
||||
return { text };
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user