Skip to content
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

Code action does not apply due to wrong document version #2025

Closed
rchl opened this issue Oct 15, 2022 · 0 comments
Closed

Code action does not apply due to wrong document version #2025

rchl opened this issue Oct 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@rchl
Copy link
Collaborator

rchl commented Oct 15, 2022

In a plain typescript file, If I misspell string then volar provides code action "Change spelling to 'string'" but editor does nothing when selecting it because textDocument.version does not match current document version.

To repro type:

export function foo(): stringX {
    return 4
}

and trigger code actions on stringX.

Relevant part of the code action response:

	...
    "edit": {
      "documentChanges": [
        {
          "edits": [
            {
              "newText": "string",
              "range": {
                "end": {
                  "character": 30,
                  "line": 29
                },
                "start": {
                  "character": 23,
                  "line": 29
                }
              }
            }
          ],
          "textDocument": {
            "uri": "file:///usr/local/workspace/github/typescript-language-server/src/test.ts",
            "version": 17
          }
        }
      ]
    },
    "kind": "",
    "title": "Change spelling to 'string'"

I saw a case like this was fixed already in #1490 but this might be another case of the same issue.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants