Skip to content

QuickFix: Fix all detected spelling errors not working #50243

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
justschen opened this issue Aug 9, 2022 · 5 comments · Fixed by #50309
Closed

QuickFix: Fix all detected spelling errors not working #50243

justschen opened this issue Aug 9, 2022 · 5 comments · Fixed by #50309
Labels
Bug A bug in TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. Fix Available A PR has been opened for this issue Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@justschen
Copy link
Contributor

justschen commented Aug 9, 2022

TS Template added by @mjbvz

TypeScript Version: 4.8.0-dev.20220809

Search Terms

  • getCombinedCodeFix
  • code action
  • quick fix

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
  • OS Version:

Steps to Reproduce:

  1. Some kind of spelling error that hasn't been corrected before (for example, on startup of VS Code with the error)
  2. Hover over and click Quick Fix -> Fix all detected spelling errors
  3. May have to do with Quick Fix Problem hover has repeated items vscode#157119

Recording 2022-08-09 at 11 57 06

From the debug console:
image 24

@weinand weinand assigned mjbvz and unassigned weinand Aug 9, 2022
@mjbvz mjbvz transferred this issue from microsoft/vscode Aug 9, 2022
@mjbvz mjbvz removed their assignment Aug 9, 2022
@mjbvz
Copy link
Contributor

mjbvz commented Aug 9, 2022

Simple repo:

export function newFunction() {}

newFunctions(); // trigger here

Here's the relevant request:

[Trace  - 23:24:46.136] <semantic> Sending request: getCombinedCodeFix (97). Response expected: yes. Current queue length: 0
Arguments: {
    "scope": {
        "type": "file",
        "args": {
            "file": "/Users/matb/projects/san/y.ts"
        }
    },
    "fixId": "fixSpelling"
}
[Trace  - 23:24:46.138] <semantic> Response received: getCombinedCodeFix (97). Request took 2 ms. Success: false . Message: Error processing request. Debug Failure. False expression: Changes overlap
Verbose Debug Information: {"pos":35,"end":47} and {"pos":35,"end":47}
Error: Debug Failure. False expression: Changes overlap
Verbose Debug Information: {"pos":35,"end":47} and {"pos":35,"end":47}
    at _loop_10 (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:151056:34)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:151062:25
    at Object.mapDefined (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:622:30)
    at Object.getTextChangesFromChanges (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:151050:27)
    at ChangeTracker.getChanges (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:150989:45)
    at ChangeTracker.with (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:150409:32)
    at Object.codeFixAll (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:151674:60)
    at Object.getAllCodeActions (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:155886:68)
    at Object.getAllFixes (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:151661:81)
    at Object.getCombinedCodeFix (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:167298:31)
    at Session.getCombinedCodeFix (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179538:56)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:177904:61)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179831:96
    at Session.executeWithRequestId (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179822:28)
    at Session.executeCommand (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179831:41)
    at Session.onMessage (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179859:35)
    at process.<anonymous> (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:184025:31)
    at process.emit (node:events:526:28)
    at emit (node:internal/child_process:938:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: Quick Fixes Editor-provided fixes, often called code actions. labels Aug 10, 2022
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 10, 2022
@DanielRosenwasser
Copy link
Member

To me the problem (you can see it in the GIF) is that there are duplicate errors. Because there are multiple error spans, we will try to do the same change twice (which is nonsensical).

image

@andrewbranch, were you investigating something related to duplicate errors caused by related spans?

@andrewbranch
Copy link
Member

Yes, that must be the same problem 👀

I have no idea how we didn’t notice this sooner. I guess we need to change how we do related spans and/or deduplication. It kind of feels like the related span shouldn’t contribute to the equality of diagnostics in deduplication anyway—I can’t think of any time we would intentionally issue multiple errors at the same location with different related spans. Those would still feel like duplicates to me.

@andrewbranch
Copy link
Member

Here’s an example that’s sort of valid. It doesn’t convince me that the duplication is desirable:

image

@DanielRosenwasser
Copy link
Member

Deeper root-cause analysis of the original bug here #49437 (comment)

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Aug 16, 2022
@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. Fix Available A PR has been opened for this issue Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants