language-tools: Request textDocument/formatting failed with message: Overlapping edit

All I did was run npm create vite@latest on Windows, I chose vue-ts and there was no problem initially. But now every time I hit the save button I get this error:

[Error - 6:36:26 PM] Request textDocument/formatting failed.
  Message: Request textDocument/formatting failed with message: Overlapping edit
  Code: -32603 

And my file isn’t getting formatted.

The same error occurs when I activate the Format document command.

I’ve disable all other VS Code extensions, and the error still occurs. Here is my volar info:

Name: Vue Language Features (Volar)
Id: johnsoncodehk.volar
Description: Language support for Vue 3
Version: 0.34.3
Publisher: Johnson Chu
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar

Take over mode didn’t fix this. Restarting my machine didn’t either.

Not sure if it helps, but this is the trace in the VS code dev tools when I hit the Format document command:

Request textDocument/formatting failed.
onDidChangeNotification @ workbench.desktop.main.js:796
(anonymous) @ workbench.desktop.main.js:796
invoke @ workbench.desktop.main.js:67
fire @ workbench.desktop.main.js:67
addNotification @ workbench.desktop.main.js:798
notify @ workbench.desktop.main.js:1961
(anonymous) @ workbench.desktop.main.js:1698
_showMessage @ workbench.desktop.main.js:1698
$showMessage @ workbench.desktop.main.js:1698
_doInvokeHandler @ workbench.desktop.main.js:1705
_invokeHandler @ workbench.desktop.main.js:1705
_receiveRequest @ workbench.desktop.main.js:1705
_receiveOneMessage @ workbench.desktop.main.js:1705
(anonymous) @ workbench.desktop.main.js:1705
invoke @ workbench.desktop.main.js:67
fire @ workbench.desktop.main.js:67
fire @ workbench.desktop.main.js:83
_receiveMessage @ workbench.desktop.main.js:83
(anonymous) @ workbench.desktop.main.js:83
invoke @ workbench.desktop.main.js:67
fire @ workbench.desktop.main.js:67
acceptChunk @ workbench.desktop.main.js:83
(anonymous) @ workbench.desktop.main.js:83
O @ workbench.desktop.main.js:3102
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

got the same issue

same issue observed, running Vue3 + Quasar2 project via WSL2 - all vscode plugins installed “remote” on WSL:UBUNTU. (beginner in frontend, wild guess is something might be related to JS/TS project’s linter/formatter config vs vsode config?)

The same issue here, was fine few minutes ago. Looks like some sort of code produces this issue. In my case it was:

<div ... :class="{ on: v, off: !v                          }" ...> ... </div>

When I removed these odd whitespaces, everything is fine again. But, now I can’t reproduce this. What a weird thing :goberserk:

I hit this same issue, and realized that everything works fine except for formatting. I switched the default formatter for [markdown] to a normal formatter, and this error went away, but all other language features still work.

{
  "volar.vueserver.vitePress.processMdFile": true,
  "[markdown]": {
    // You could use `esbenp.prettier-vscode` or any other formatter instead
    "editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
  },
}