Repository navigation
Unexpected parameter hint showing up for log in js file #33565
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptDomain: LS: Quick Infoe.g. hover text, tool-tips, and tooltips.e.g. hover text, tool-tips, and tooltips.
on Sep 25, 2019 RyanCavanaugh commented
on Sep 25, 2019 MemberMore actionswat
a-tarasyuk commented
on Jan 28, 2020 ContributorMore actionsI investigated the issue, and this error happens because
TypeScript/src/services/signatureHelp.ts
Line 125 in 1bb6ea0
return name === undefined ? undefined : firstDefined(program.getSourceFiles(), sourceFile => returns
es5.d.tssource file andTypeScript/src/services/signatureHelp.ts
Line 126 in 1bb6ea0
firstDefined(sourceFile.getNamedDeclarations().get(name), declaration => { returns
sourceFile.getNamedDeclarations()all declarations and ignore namespaces. For instancelogit is a name fromMathobject :).Is there any reason why
sourceFile.getNamedDeclarations()is used here?cc Daniel Rosenwasser (@DanielRosenwasser) Ryan Cavanaugh (@RyanCavanaugh)
DanielRosenwasser commented
on Jan 28, 2020 MemberMore actionsI think the idea is to try a best-effort signature help given that we're in JavaScript and we won't always have accurate types around.
If you're in ts-check, this behavior is probably extremely surprising because you're also getting an error that the identifier can't be found. Maybe the solution is to turn it off just there.
a-tarasyuk commented
on Jan 29, 2020 ContributorMore actionsDaniel Rosenwasser (@DanielRosenwasser) Do you mean disable/remove
createJSSignatureHelpItems?DanielRosenwasser commented
on Jan 29, 2020 MemberMore actionsYeah, if
- the current file belongs to a
tsconfig.json - the current file is checked
- the current file belongs to a project with
checkJs
I think we should probably disable the heuristic. Does that sound reasonable?
- the current file belongs to a
a-tarasyuk commented
on Jan 31, 2020 ContributorMore actionsDaniel Rosenwasser (@DanielRosenwasser) It seems in this case, users who use JavaScript without TS checks will get weird suggestions. Or am I wrong?
TypeScript/src/services/signatureHelp.ts
Line 48 in ad8feb5
const candidateInfo = getCandidateOrTypeInfo(argumentInfo, typeChecker, sourceFile, startingToken, onlyUseSyntacticOwners); Returns correct info for global functions (parseInt, eval, etc), or Objects (Math.log, Date etc). I'm trying to understand where this heuristic can help 😃 👀
Would it be ok to only return signature help when we can properly resolve a symbol? This is what we do for quickInfo for example.
The majority of VS Code users are on untyped JS so I’m wary of a fix that is specific to checkJs
Reacted by Oleksandr Tarasiuk- addedDomain: LS: Signature HelpInformation in editor tooltips when invoking a function callInformation in editor tooltips when invoking a function call
on Feb 7, 2020 a-tarasyuk commented
on Apr 10, 2020 ContributorMore actionsDanielRosenwasser commented
on Apr 14, 2020 MemberMore actionsMy personal take is that in a checked JS file, or in a TypeScript project, we should not apply the heuristic. Otherwise, I think the heuristic is fine.
DanielRosenwasser commented
on Apr 14, 2020 MemberMore actionsAh, I just looked up and saw that reread the convo.
Uh, maybe this is something we should try to understand better - would it be easy to conduct a user study on this? Let's chat about this tomorrow Matt Bierner (@mjbvz)
Reacted by Oleksandr TarasiukSure. I'm still of the opinion that the behavior of parameter hints should match hover. It seems confusing to show parameter hints on symbols that we can't resolve
Reacted by Oleksandr TarasiukRyanCavanaugh commented
on Apr 15, 2020 MemberMore actionsNotes from meeting today:
- Disable this behavior entirely for bare identifiers
- Add some description of which declaration the description is coming from
a-tarasyuk commented
on Apr 16, 2020 ContributorMore actionsRyan Cavanaugh (@RyanCavanaugh) Thanks for the update.
What does mean
bare identifiers? 😕Add some description of which declaration the description is coming from
Do you mean to add an additional field to the server response?
DanielRosenwasser commented
on Apr 17, 2020 MemberMore actionsOleksandr Tarasiuk (@a-tarasyuk) Ryan can comment on the second part.
To answer your first question, the idea is
fooshould not try to search for members namedfooanywhere, butfoo.barshould still look for declarations namedbar. That seems fairly reasonable to me.- locked as resolved and limited conversation to collaborators
on Oct 21, 2025
From microsoft/vscode#80565
TypeScript Version: 3.7.20190922
Search Terms:
Code
In a js file:
Trigger parameter hints on
logExpected behavior:
Nothing shows up.
logis undefined here and you can't run go to definition on itActual behavior:

Playground Link:
Related Issues: