Proposal: simplify auto import descriptions#47631
Proposal: simplify auto import descriptions#47631andrewbranch merged 5 commits intomicrosoft:mainfrom
Conversation
mjbvz
left a comment
There was a problem hiding this comment.
The new wording makes sense to me. Thanks for taking a look!
| "code": 90012 | ||
| }, | ||
| "Import '{0}' from module \"{1}\"": { | ||
| "Import '{0}' from \"{1}\"": { |
There was a problem hiding this comment.
This is used for both add and update? Also, nitpicky, but why one set of single quotes and one set of double quotes?
There was a problem hiding this comment.
I don't think I even see this message used the diff. Am I missing it?
There was a problem hiding this comment.
I missed it too - it's referred to by its property name in the tests.
There was a problem hiding this comment.
@amcasey yes, both add and update. We always use double quotes for module specifiers for some reason, and single quotes for other code quoting 🤷♂️
| importKind === ImportKind.Default ? Diagnostics.Add_default_import_0_to_existing_import_declaration_from_1 : Diagnostics.Add_0_to_existing_import_declaration_from_1, | ||
| symbolName, | ||
| moduleSpecifierWithoutQuotes | ||
| ]; // you too! |
There was a problem hiding this comment.
I left it in for so long, never knowing what it was referencing.
Compliments #47552 and makes progress on #47521.
Now, when a codefix will result in a new import declaration, the message is
Add import from "foo". When adding an import to an existing import declaration, the message isUpdate import from "foo".The exception is when the thing being imported doesn’t share a name with the identifier that triggered the error—the only way this happens today is when you are prompted to importReact(or whatever your JSX element factory is) on an arbitrary JSX element name. In that case, the message isImport 'React' from "react".This change is based on two assumptions: