@@ -164108,11 +164108,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164108164108 function isSignatureSupportingReturnAnnotation(node) {
164109164109 return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
164110164110 }
164111- function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile ) {
164111+ function addParameterHints(text, parameter, position, isFirstVariadicArgument) {
164112164112 let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
164113164113 let displayParts;
164114164114 if (shouldUseInteractiveInlayHints(preferences)) {
164115- displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile ), { text: ":" }];
164115+ displayParts = [getNodeDisplayPart(hintText, parameter), { text: ":" }];
164116164116 hintText = "";
164117164117 } else {
164118164118 hintText += ":";
@@ -164185,7 +164185,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164185164185 return;
164186164186 }
164187164187 let signatureParamPos = 0;
164188- const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
164189164188 for (const originalArg of args) {
164190164189 const arg = skipParentheses(originalArg);
164191164190 if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
@@ -164218,7 +164217,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164218164217 if (leadingCommentsContainsParameterName(arg, name)) {
164219164218 continue;
164220164219 }
164221- addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile );
164220+ addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument);
164222164221 }
164223164222 }
164224164223 }
@@ -164354,7 +164353,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164354164353 }
164355164354 return true;
164356164355 }
164357- function getNodeDisplayPart(text, node, sourceFile) {
164356+ function getNodeDisplayPart(text, node) {
164357+ const sourceFile = node.getSourceFile();
164358164358 return {
164359164359 text,
164360164360 span: createTextSpanFromNode(node, sourceFile),
@@ -181073,14 +181073,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181073181073 return {
181074181074 ...hint,
181075181075 position: scriptInfo.positionToLineOffset(position),
181076- displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
181077- text,
181078- span: span && {
181079- start: scriptInfo.positionToLineOffset(span.start),
181080- end: scriptInfo.positionToLineOffset(span.start + span.length),
181081- file: file2
181076+ displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => {
181077+ if (span) {
181078+ Debug.assertIsDefined(file2, "Target file should be defined together with its span.");
181079+ const scriptInfo2 = this.projectService.getScriptInfo(file2);
181080+ return {
181081+ text,
181082+ span: {
181083+ start: scriptInfo2.positionToLineOffset(span.start),
181084+ end: scriptInfo2.positionToLineOffset(span.start + span.length),
181085+ file: file2
181086+ }
181087+ };
181088+ } else {
181089+ return { text };
181082181090 }
181083- }))
181091+ })
181084181092 };
181085181093 });
181086181094 }
0 commit comments