Skip to content

tsserver: deprecate getSupportedCodeFixes, add fixable property to Diagnostic #29051

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

Open
ajafff opened this issue Dec 15, 2018 · 6 comments
Open
Labels
API Relates to the public API for TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@ajafff
Copy link
Contributor

ajafff commented Dec 15, 2018

This proposes an alternative to #29010. Making getSupportedCodeFixes proxy-able by plugins means the client has to request the list of fixable error codes for each file - and theoretically everytime the program is updated (because the configuration of a plugin could have changed).

Could we instead just add a new property fixable to Diagnostic?
That makes getSupportedCodeFixes obsolete. Fixable error codes no longer need to be known in advance, which would also resolve #28990.

@sheetalkamat
Copy link
Member

Adding @mjbvz @amcasey @DanielRosenwasser for their thoughts on this.

@DanielRosenwasser DanielRosenwasser added Suggestion An idea for TypeScript In Discussion Not yet reached consensus API Relates to the public API for TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. labels Dec 17, 2018
@mjbvz
Copy link
Contributor

mjbvz commented Dec 17, 2018

I don't see any problem supporting this in VS Code. We'll still have to support getSupportedCodeFixes for older TS versions though

@amcasey
Copy link
Member

amcasey commented Jan 2, 2019

I assume that request exists because VS requires it to implement a Roslyn API. (Of course, there may be cheaper ways to implement the same API.)

@DanielRosenwasser
Copy link
Member

I guess the problem with this approach is that it couples the compiler pretty closely with the capabilities of the language service. Why is the compiler's responsibility to know ahead of time that something will be fixable? It feels a little funky from that perspective.

@ajafff
Copy link
Contributor Author

ajafff commented Jan 2, 2019

@DanielRosenwasser this proposal doesn't change the compiler at all. LanguageService.get*Diagnostics would request the diagnostics from the compiler and augment them with the fixable property which is looked up in errorCodeToFixes in codeFixProvider.ts (this is also what powers getSupportedCodeFixes).

@ajafff
Copy link
Contributor Author

ajafff commented Feb 16, 2021

It there a chance this proposal or #28966 will be accepted? I'm currently working on my language service plugin again and it bugs me out, that I have to trade clear error names for numeric codes just to be able to provide code fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants