Skip to content

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

Open

Description

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.

Activity

  1. sheetalkamat commented on Dec 17, 2018

    @sheetalkamat
    Member
  2. added
    Suggestion
    In Discussion
    Domain: API
    Domain: LS: Quick Fixes
    on Dec 17, 2018
  3. mjbvz commented on Dec 17, 2018

    @mjbvz
    Contributor

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

  4. amcasey commented on Jan 2, 2019

    @amcasey
    Member

    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.)

  5. DanielRosenwasser commented on Jan 2, 2019

    @DanielRosenwasser
    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.

  6. ajafff commented on Jan 2, 2019

    @ajafff
    ContributorAuthor

    Daniel Rosenwasser (@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).

  7. ajafff commented on Feb 16, 2021

    @ajafff
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: APIDomain: LS: Quick FixesIn DiscussionSuggestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions