GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — Support completions for enums in switch cases · Pull Request #16864 · microsoft/TypeScript Conversation
|
|
Is there prior art where we return an entire qualified name as a completion? I was expecting we'd return the valid enum type names as completions, you pick one, you type ".", then member completion takes over. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
99% of the time there will only be one valid enum. I think this is the first time we would have a place where we return a qualified name though; it's also the first place where we return something semantically meaningful that isn't a property name or the name of a local/global variable. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We don't populate the completion list with all the members on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This seems too restrictive, and I concur with Wesley Wigham (@weswigham) that we currently don't use qualified names anywhere else. C# does not do this in VS, are there any other languages/editors where this is a common practice?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (isRightOfDot) { | ||
| getTypeScriptMemberSymbols(); | ||
| } | ||
| else if (isRightOfCase) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this restrict completions to only enum completions and prevent completions for locals? That is too restrictive.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return links.switchTypes; | ||
| } | ||
|
|
||
| function getRemainingSwitchCaseTypes(node: SwitchStatement): Type[] | undefined { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
i would move this to services, and use getTypeAtLocation for switch labels.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is the right approach here..
A better approach is to mark completion list item as "suggested ", I think Roslyn refers to this as suggestedCompletion https://github.com/dotnet/roslyn/blob/878ffad23b8b06cb229c9ab31eada7634a473508/src/Features/Core/Portable/Completion/CompletionList.cs#L48
For instance in switch (node.kind) { case | you would get SyntaxKind highlighted as a suggested completion automatically..
We should also do the same for operators of ===/==/!=/!== and whenever there is a contextual type.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I do not think this is needed anylonger. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ref: #20020 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.