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 — Don't have type annotations on suggested object literal methods by gabritto · Pull Request #48607 · microsoft/TypeScript Conversation
Member
Fixes #48606. This is what it will look like without the type annotations:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Andrew Branch (andrewbranch)
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, didn’t even think about the fact that this makes us not have to do auto-imports on them either. We could keep the type annotations in the label (but no the insertText) if we think that makes it more clear or useful, but I think this is probably best.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Andrew Casey (amcasey)
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code looks correct. My personal opinion is that it makes the code more readable and the completion item less readable.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Gabriela Araujo Britto (gabritto)
deleted the
gabritto/removeTypesObjMethod
branch
|
There was an error while loading. Please reload this page.
Could we do something crazy where the type annotations are grayed out and the rest of the text is the usual color? I guess we'd need to return display parts (CC Matt Bierner (@mjbvz)) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That sounds cool, but N.B. I don’t think the LSP spec supports display parts: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemLabelDetails |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
(I was invoked to give my 2 cents here) I completely agree with Andrew's comment. Without any context or previous knowledge of this discussion, I would find it quite confusing as a TS user to see these different entries in my completion list, and I would have no idea of which one is which. Although it would be more verbose and make the list uglier, I would prefer options like: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Maria Solano (@MariaSolOs) Thanks! One of the things that can be inserted is the bar name (i.e. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Ohhhh now I understand. I thought that the different completion options were both for methods (having types in the method signatures versus not). Now I understand. In that case I again agree with Andrew Casey (@amcasey) about the different color around the parameter list making it seem like an informative label and not part of the snippet. Personally I would also add the curly braces to better represent the snippet's behavior. |
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.
Object method snippet completions should not include parameter type annotations
There was an error while loading. Please reload this page.