Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Salsa] Type completions not available for @param annotations #14285

Closed
Jessidhia opened this issue Feb 24, 2017 · 2 comments
Closed

[Salsa] Type completions not available for @param annotations #14285

Jessidhia opened this issue Feb 24, 2017 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@Jessidhia
Copy link

TypeScript Version: 2.2.0

Code

/**
 * @param {|} bar
 * @returns {}
 */
function foo(bar) {}

Expected behavior:
Requesting a completion inside the {} after @param should return type name completion

Actual behavior:
No suggestions besides text suggestions are available.

Note that suggestions do work inside the {} after @returns.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@mhegazy mhegazy assigned ghost May 26, 2017
@mhegazy mhegazy added Bug A bug in TypeScript and removed Needs Investigation This issue needs a team member to investigate its status. labels May 26, 2017
@mhegazy mhegazy added this to the TypeScript 2.4 milestone May 26, 2017
@ghost
Copy link

ghost commented May 26, 2017

I don't seem to be able to get good completions inside of a @returns.

screenshot3

We don't do this for regular types either.

screenshot

Based on what I've seen of completions.ts, it handles a few special cases (right of dot, JSX tag) and then calls tryGetGlobalSymbols(). There's a comment in that function saying /// TODO filter meaning based on the current context. This should be doable based on the parent node. In your example the parent node is a JSDocTypeExpression, so it has to be a type. In an expression it has to be a value, except in a type assertion expression.
We should also prefer local symbols first. E.g.:

screenshot2

I'm obviously trying to print x, not __dirname!

So there are 2 issues blocking getting useful completions in a non-foo. context:

  • Use local completions first.
  • Filter completions by meaning.

@mhegazy mhegazy assigned sheetalkamat and unassigned ghost May 26, 2017
@mhegazy
Copy link
Contributor

mhegazy commented May 26, 2017

@sheetalkamat this looks related to your change to filter completions based on location. we probably should filter completions in a jsdoc comment between {} to types and namespaces only.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jun 13, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants