Skip to content

Commit a295492

Browse files
committed
Merge changes after signature help work
1 parent d07b845 commit a295492

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

src/services/services.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3699,9 +3699,9 @@ module ts {
36993699

37003700
// Reset writer back to undefined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in getEmitOutput
37013701
writer = undefined;
3702-
return emitOutput;
3703-
}
3704-
3702+
return emitOutput;
3703+
}
3704+
37053705
// Signature help
37063706
/**
37073707
* This is a semantic operation.

src/services/signatureHelp.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ module ts.SignatureHelp {
261261
display += "?";
262262
}
263263
display += ": " + typeInfoResolver.typeToString(typeInfoResolver.getTypeOfSymbol(p), argumentListOrTypeArgumentList);
264-
return new SignatureHelpParameter(p.name, "", display, isOptional);
264+
return { name: p.name, documentation: "", display: display, isOptiona: isOptional };
265265
});
266266
var callTargetNode = (<CallExpression>argumentListOrTypeArgumentList.parent).func;
267267
var callTargetSymbol = typeInfoResolver.getSymbolInfo(callTargetNode);
@@ -273,7 +273,14 @@ module ts.SignatureHelp {
273273
}
274274
prefix += "(";
275275
var suffix = "): " + typeInfoResolver.typeToString(candidateSignature.getReturnType(), argumentListOrTypeArgumentList);
276-
return new SignatureHelpItem(candidateSignature.hasRestParameter, prefix, suffix, ", ", parameterHelpItems, "");
276+
return {
277+
isVariadic: candidateSignature.hasRestParameter,
278+
prefix: prefix,
279+
suffix: suffix,
280+
separator: ", ",
281+
parameters: parameterHelpItems,
282+
documentation: ""
283+
};
277284
});
278285
var selectedItemIndex = candidates.indexOf(bestSignature);
279286
if (selectedItemIndex < 0) {
@@ -291,7 +298,11 @@ module ts.SignatureHelp {
291298
var applicableSpanStart = argumentListOrTypeArgumentList.getFullStart();
292299
var applicableSpanEnd = skipTrivia(sourceFile.text, argumentListOrTypeArgumentList.end, /*stopAfterLineBreak*/ false);
293300
var applicableSpan = new TypeScript.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
294-
return new SignatureHelpItems(items, applicableSpan, selectedItemIndex);
301+
return {
302+
items: items,
303+
applicableSpan: applicableSpan,
304+
selectedItemIndex: selectedItemIndex
305+
};
295306
}
296307
}
297308

@@ -327,7 +338,7 @@ module ts.SignatureHelp {
327338
var numberOfCommas = countWhere(argumentListOrTypeArgumentList.getChildren(), arg => arg.kind === SyntaxKind.CommaToken);
328339
var argumentCount = numberOfCommas + 1;
329340
if (argumentCount <= 1) {
330-
return new SignatureHelpState(/*argumentIndex*/ 0, argumentCount);
341+
return { argumentIndex: 0, argumentCount: argumentCount };
331342
}
332343

333344
var indexOfNodeContainingPosition = findListItemIndexContainingPosition(argumentListOrTypeArgumentList, position);
@@ -338,12 +349,12 @@ module ts.SignatureHelp {
338349
// Alternatively, we could be in range of one of the arguments, in which case we need to divide
339350
// by 2 to exclude commas. Use bit shifting in order to take the floor of the division.
340351
var argumentIndex = indexOfNodeContainingPosition < 0 ? argumentCount - 1 : indexOfNodeContainingPosition >> 1;
341-
return new SignatureHelpState(argumentIndex, argumentCount);
342-
}
343-
344-
function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node {
352+
return { argumentIndex: argumentIndex, argumentCount: argumentCount };
353+
}
354+
355+
function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node {
345356
var children = parent.getChildren(sourceFile);
346357
var indexOfOpenerToken = children.indexOf(openerToken);
347-
return children[indexOfOpenerToken + 1];
358+
return children[indexOfOpenerToken + 1];
348359
}
349360
}

0 commit comments

Comments
 (0)