Repository navigation
Provide high-confidence spelling suggestions as suggestion diagnostics #41582
Description
Activity
- addedSuggestionAn idea for TypeScriptAn idea for TypeScriptExperimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happens
on Nov 18, 2020 - addedDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specifically
on Nov 19, 2020 This is a new feature so I'm going to move it to 4.3.
Aside: I don't know that the suggestion would have to be any more accurate than a TS suggestion -- JS is a best-effort environment, where completions over-generate rather than under-generate. I think it would be fine for spelling suggestions to do the same, especially since the suggestion UI is unobtrusive in VS Code at least.
Filtering out identifiers used elsewhere and commonly used identifiers is a good idea, though.
However, since there are likely to be a lot of unresolved identifiers in JS files, it does make sense to limit the number of suggestions. Instead of starting from improving accuracy, I think it would work better to generate all the suggestions but only show the most valuable ones. (This would probably be harder and more expensive to implement, though.)
sandersn commented
on Feb 11, 2021 MemberMore actionsFew more thoughts:
- To reduce the number of suggestions, suggest only on property accesses. Object types have implicit index signatures outside
strict, so that'll have to change. - To reduce the number of non-property-access suggestions, suggest only from local scope. (I'm not sure how easy this is to do.)
- Note that the suggestion wording might need to change if we're not sure that the identifier in question really isn't found.
- To reduce the number of suggestions, suggest only on property accesses. Object types have implicit index signatures outside
- addedRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
on Apr 14, 2021 - addedFix AvailableA PR has been opened for this issueA PR has been opened for this issue
on May 26, 2021
When JavaScript users don't have type-checking turned on, there are often some good suggestions left on the table that go to waste.
Obviously we can't just provide all the errors that
checkJswould issue, but there are a few good ones. Specifically, spelling suggestions could be provided if we were more confident in how useful they are, where confidence is determined by some rules.Some of the following rules might be worth investigating: