-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
…terHint. add unittests for HintUtils.formatParameterHint
Clean up unittests.js and change string from "<no arguments>" to "<no parameters>"
…terHint. add unittests for HintUtils.formatParameterHint
Clean up unittests.js and change string from "<no arguments>" to "<no parameters>"
…into fn-param-hints Conflicts: src/extensions/default/JavaScriptCodeHints/ParameterHintManager.js
@RaymondLim Here's the pull request. Please review. |
$.when(fnTypePromise).done( | ||
function (fnType) { | ||
session.setFnType(fnType); | ||
session.setFunctionCallPos(functionOffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to use "offset" here instead of "functionOffset" as it can be null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to use "functionOffset" because "offset" can be relative to a portion of the, not the top of the file. It's a bug for "functionOffset" to be null.
top: 40px; | ||
pointer-events: none; | ||
|
||
padding: 1px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need more padding, at least 3px to the left and right of the hint so that text does not touch or too close to the border. Currently, it is harder to see the square brackets that denotes the optional parameter.
* Given a Tern formatted function type string, convert it to an array of Objects, where each object describes | ||
* a parameter. | ||
* | ||
* @param {String} newFnType - Tern formatted function type string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: primitive type String should be in lowercase.
if (type === "variable-2" || type === "variable" || type === "property") { | ||
nextToken = self.getNextToken(localCursor, true); | ||
if (nextToken && nextToken.string === "(") { | ||
//nextToken = self.getNextToken(localCursor, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this commented code?
… Infer.expressionType() as suggested by marijn. The problem with this fix is it requires a "full" text update with the parameter hint request. Suggested a possible solution in the issue. The quality of the hints has been much improved and record type annotations can be hinted correctly.
Merging now. I'll be submitting a new pull request to fix one unit test failure in JS Quick Edit caused by this pull request. |
Implements a new command, "Show Parameter Hint".
Shows the parameters of a function and bolds the hint where the cursor is located. Automatically shows a parameter hint when a function is selection from the code hints dialog.
Current limitations:
1. no automatic parameter hint for selected hints that are "guesses".
2. no hint of record type annotations (Tern issue #207)
3. problem with optionals hints (fixed in latest Tern, issue #208)
4. Array. annotation shown as Array. (needs investigation).