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

Expand TypeScript Interface in IntelliSense #6638

Closed
arb opened this issue May 22, 2016 · 6 comments
Closed

Expand TypeScript Interface in IntelliSense #6638

arb opened this issue May 22, 2016 · 6 comments
Labels
typescript Typescript support issues

Comments

@arb
Copy link

arb commented May 22, 2016

  • VSCode Version: 1.1.1
  • OS Version: OSX 10.10.5

When using the typescript definitions installed from definitely typed, the IntelliSense doesn't seem to want to expand things that are declared as "interfaces". I've attached a snippet below as an example.

image

From this screen shot, I have no way of knowing what is expected from the IRouteConfiguration interface.

Am I missing a setting somewhere or is this working as intended and I have to click around before being able to learn what the shape of that interface is?

Update
It appears that once you start filling out the object, it does give you hints about the value you are using, but it seems like you already need to have an idea of the shape of the object before you start typing.

@dbaeumer dbaeumer added the typescript Typescript support issues label May 23, 2016
@dbaeumer
Copy link
Member

@arb this is actually as designed. You can start with and empty literal and then fill it out using IntelliSense. IMO showing more information in the signature hover would only makes things more complicated. Think about a literal with many properties.

I will close this since showing a literal type here will not improve things.

@arb
Copy link
Author

arb commented May 23, 2016

I see this issue has been closed... is there going to be any follow-up or explanation? Is this just how it works or am I doing something wrong?

@dbaeumer
Copy link
Member

dbaeumer commented May 23, 2016

@arb sorry for not being clear. This is actually as designed. We have even considered doing more folding for inline type definition since showing the inline typing is not very helpful. The following screenshot shows this and is to my understanding more or less what you have asked for.

capture

We think that starting with an empty literal and then getting code complete is a better solution to the problem

capture

However I noticed that code assist in this example shows snippets before properties. I opened #6667 since this shouldn't be the case

@grovesNL
Copy link

grovesNL commented Feb 2, 2017

@dbaeumer: Is there a way to enable this behavior (either VS Code options or through language services or some low level API)? It would be very useful to see the interface definition in quick info, otherwise I can't determine which properties are required without navigating to the definition. Code complete is nice, but if it's an unfamiliar interface (i.e. a library), the user has no idea which letters to type to start the discovery.

Specifically in my case I'm testing Monaco with external type declaration files, so peek/go to definition won't actually allow them to view the interface.

I would prefer to see expanded definition like you displayed above, which is what type aliases do by default. If classes could implement type aliases I would use them instead of interfaces in most cases, solely for this reason.

@dbaeumer
Copy link
Member

dbaeumer commented Feb 2, 2017

@grovesNL No there is currently no option to control this.

@sgronblo
Copy link

I understand that in some cases it can be unhelpful to be shown a fully expanded typescript interface. However, if you are doing some type level trickery with Omit, Pick, extending, intersecting. It would actually be quite great to be able to see that your combined interface type actually has the expected shape.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

4 participants