-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Autocomplete for string-indexed members even from dot-notation #36429
Comments
@mjbvz - thanks for the look and the suggestion, but it doesn’t satisfy my interest. Part of autocomplete’s value is in exploring unfamiliar apis and even needing to know that there are indexed members is a burden - it’s a little more awkward and we have to check both lists. In my case, I’m generating Rest client code off swagger definitions, organized by route template and http method. Rather than munging those strings into identifiers and worrying about collisions among them and having the consumer deal with the munged repesentations of the routes, I’m leaving the templates intact:
I really like this except I give up a bit in discoverability. |
I don't think I understand the issue. In your |
A user is not used to typing They might explore the api by typing |
Ok, so my understanding is: Repo
const foo = {
'string': 'abc',
'spacey string': 'abc'
};
foo.
Expected foo['spacey string'] Current Is that correct? |
Yes. Thanks. |
Fixed on the VSCode side but requires a build of typescript with microsoft/TypeScript#20547 . Should be in 2.7 final. Once the TS PR is merged you can also pick it up by installing |
Sometimes the keys of a map-object are not valid typescript identifiers, yet they are strongly typed members still. Invoking autocomplete within
['']
does suggest them and, as you know, the string indexer is fully type-checked in such a situation.Supposing I have members
hello
,return
anddelete
on an object, can they be suggested in the dot-notation autocomplete as well and then just automatically converted to indexer form since?The text was updated successfully, but these errors were encountered: