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

Intellisense when specifying object properties #40181

Closed
Bibliofile opened this issue Dec 13, 2017 · 5 comments
Closed

Intellisense when specifying object properties #40181

Bibliofile opened this issue Dec 13, 2017 · 5 comments
Assignees
Labels
javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@Bibliofile
Copy link

  • VSCode Version: Code 1.18.1 (929bacb, 2017-11-16T18:32:36.023Z)
  • OS Version: Windows_NT x64 10.0.16299
  • Extensions: Extensions are disabled

Steps to Reproduce:

  1. Create a new .ts file with the following code (Copied from Typescript/17352)
/**
 * @param {object} o - has a string and a number
 * @param {string} o.s - the string
 * @param {number} o.n - the number
 */
function f(o) { return o.s.length + o.n; }
  1. Start typing to call the function

image

I would expect the comment the string to show up when modifying the s property, however - the number is always shown.

Using Typescript types does not fix this issue (and is my primary concern):

/**
 * @param o - has a string and a number
 * @param o.s - the string
 * @param o.n - the number
 */
function f(o: {s: string; n: number }) { return o.s.length + o.n; }

Related: Typescript/11597

@vscodebot vscodebot bot added the javascript JavaScript support issues label Dec 13, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Dec 13, 2017

In your example under 2, I believe the key should be s, not o

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Dec 13, 2017
@Bibliofile
Copy link
Author

You are correct, however fixing that does not resolve my problem unfortunately. (Though at least I'm getting the comment for o now)

image

@mjbvz
Copy link
Collaborator

mjbvz commented Mar 6, 2018

Do you still see this in the latest vscode insiders build?

@Bibliofile
Copy link
Author

Whatever has changed has improved this quite a lot! I now see @param with the comments when typing out the function call, which is very useful.

However, it still isn't perfect.

Using

/**
 * @param a first
 * @param b second
 */
function g(a: number, b: number) { return a * b; }

When typing, depending on what argument I am typing VSCode will show "first" or "second" as expected. However with the original code, I will always see the comment for o - never for o.s or o.n.

Since they are available under the @param list below the first comment, this isn't a big deal, but it would be nice if the first comment changed as well.

@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed info-needed Issue requires more information from poster labels Mar 7, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Mar 7, 2018

Yes that sounds like microsoft/TypeScript#22350

We'll keep investigating this on the TS side. Closing as upstream

@mjbvz mjbvz closed this as completed Mar 7, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants