Skip to content

Odd quick fix ordering for misspelled identifiers #27614

Description

I believe that "misspelled identifier" quick fixes should precede the "remove unused declarations".

image

If anyone wants to take this on, this should just be a matter of

  1. Making a test case for this, and
  2. Shifting the order of which quick fix is registered first.

Activity

  1. changed the title [-]Odd quick fixes for misspelled identifiers[/-] [+]Odd quick fix ordering for misspelled identifiers[/+] on Oct 8, 2018
  2. jrkong commented on Oct 10, 2018

    @jrkong

    I'd like to give this one a shot if no one's working on it. This is my first issue so I would really appreciate it if someone could direct me to the files I should look at to fix this.

  3. RyanCavanaugh commented on Oct 10, 2018

    @RyanCavanaugh
    Member

    jrkong you just have to change the ordering of the codefix files in the various tsconfig.json files under src

  4. jrkong commented on Oct 11, 2018

    @jrkong

    Ryan Cavanaugh (@RyanCavanaugh) thanks a lot! That really helps, I'll do some digging.

  5. jrkong commented on Oct 11, 2018

    @jrkong

    So after spending a bit of time with the code I've discovered some odd inconsistencies with the behavior for this particular bug:

    When I attempt to reproduce the bug with the given line in the issue this is what I see:
    image

    However if I added the lines:

    export {};
    function f() {}
    

    the bug is reproduced.
    image

    Daniel Rosenwasser (@DanielRosenwasser) could you verify if I've reproduced the bug properly?

    Here's where things got really odd for me:

    Looking at the src/services/tsconfig.json the spelling code fixes are imported on line 54 and the code fixes for removing imports and unused dependencies are imported on line 62.

    So in theory Change spelling to 'assertNever' should be loaded before Remove import from './Utilities' and Delete all unused declarations. What's more, the tests seem to corroborate that the source code is loading the spelling codefixes first:
    Here's a screenshot of the test I've been working on and how it currently fails.
    image

    I deliberately tried testing against the incorrect output to verify the behavior of the bug before I made any further changes but the tests seem to imply that Change spelling to 'assertNever' should already. So does anyone have any idea what's going on?

  6. shonnungar commented on Oct 5, 2021

    @shonnungar

    Is this issue still up for grabs? Daniel Rosenwasser (@DanielRosenwasser)

  7. DanielRosenwasser commented on Oct 5, 2021

    @DanielRosenwasser
    MemberAuthor

    I think from the conversation above, this issue is too involved and needs some actual discussion at an editor sync first.

  8. added
    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.
    and removed
    Good First IssueWell scoped, documented and has the green light
    Domain: LS: Quick FixesEditor-provided fixes, often called code actions.
    on Oct 5, 2021
  9. DanielRosenwasser commented on Oct 6, 2021

    @DanielRosenwasser
    MemberAuthor

    One idea we had in the editor sync: an editor could ask about diagnostics with narrower spans than wider spans.

    Another: an editor could provide multiple diagnostics and ranges it's interested in fixing in one call; that way the server could fix this.

    Another-nother idea: editor provides a range, TypeScript just tries to fix all error codes.

    Another-nother-nother idea: because error spans can drift, it might be better to just ask for the error code.

    But overall, we need to get a better idea from how editors have implemented this.

    There might be some inspiration from how refactorings work.

  10. RyanCavanaugh commented on Dec 3, 2025

    @RyanCavanaugh
    Member

    Closing language service bugs related to the 6.0 implementation. For more information, see #62827

  11. locked as resolved and limited conversation to collaborators on Dec 3, 2025
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

    7.0 LS MigrationBugA bug in TypeScriptDomain: LS: Quick FixesEditor-provided fixes, often called code actions.In DiscussionNot yet reached consensusNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions