Skip to content

LanguageService Plugin cannot intercept 'getSupportedCodeFixes' #28966

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

Closed
ajafff opened this issue Dec 11, 2018 · 5 comments · Fixed by #51769
Closed

LanguageService Plugin cannot intercept 'getSupportedCodeFixes' #28966

ajafff opened this issue Dec 11, 2018 · 5 comments · Fixed by #51769
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Domain: TSServer Issues related to the TSServer Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this
Milestone

Comments

@ajafff
Copy link
Contributor

ajafff commented Dec 11, 2018

TypeScript Version: 3.3.0-dev.20181208

Search Terms:

getSupportedCodeFixes

Expected behavior:

GetSupportedCodeFixes calls LanguageService#getSupportedCodeFixes. LS plugins can intercept this call and add their own error codes for code fixes.

Actual behavior:

GetSupportedCodeFixes (indirectly) calls codefix.getSupportedErrorCodes() completely bypassing the LanguageService

@weswigham weswigham added Bug A bug in TypeScript API Relates to the public API for TypeScript Domain: TSServer Issues related to the TSServer labels Dec 11, 2018
@ajafff
Copy link
Contributor Author

ajafff commented Dec 12, 2018

I wanted to fix this, but it turns out getSupportedCodeFixes doesn't get a fileName and therefore doesn't know which LanguageService to use. I'll open an issue with VSCode for that.

@mjbvz
Copy link
Contributor

mjbvz commented Dec 12, 2018

Plugins can already intercept this: https://github.com/Microsoft/typescript-tslint-plugin/blob/f4e06b17d0bb4db8a834af63dc1c8faa1c20bbea/src/plugin.ts#L72

Not correct but it does work

@ajafff
Copy link
Contributor Author

ajafff commented Dec 12, 2018

@mjbvz I already saw that one and decided against monkey-patching. I'll just wait until this is fixed

@mjbvz
Copy link
Contributor

mjbvz commented Dec 13, 2018

You may want to consider using the workaround. This change will require both a tsserver api change and editor adoption, which could take a while

@DanielRosenwasser
Copy link
Member

Sounds like there's two changes

  1. make this API take an optional fileName and projectName
  2. make this API proxy-able

@DanielRosenwasser DanielRosenwasser added Help Wanted You can do this Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". labels Dec 13, 2018
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.4.0 milestone Dec 13, 2018
ajafff added a commit to ajafff/TypeScript that referenced this issue Dec 13, 2018
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 Bug A bug in TypeScript Domain: TSServer Issues related to the TSServer Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this
Projects
None yet
6 participants