vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.83k stars 396 forks source link

Request textDocument/formatting failed with message: Overlapping edit #1162

Closed ubershmekel closed 2 years ago

ubershmekel commented 2 years ago

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
YXYH-12138 commented 2 years ago

got the same issue

johnsoncodehk commented 2 years ago

Can you reproduce this problem in https://github.com/johnsoncodehk/volar-starter? If not please provide minimal reproduction code.

ubershmekel commented 2 years ago

I'm unable to reproduce this at all right now. I've been disabling and enabling builtin javascript and typescript extensions, and now I can't tell how I got out of this situation. Sorry.

iuuuuuuu4me commented 1 year ago

same

yhhwpp commented 1 year ago

+1

DanielChrome commented 1 year ago

Same here. Using DevContainer

Outside container works normaly.

Volar Version: 1.0.9

DevContainer Settings

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/python-3-postgres
// Update the VARIANT arg in docker-compose.yml to pick a Python version
{
    "name": "Python 3 & PostgreSQL",
    "dockerComposeFile": "docker-compose.yml",
    "service": "app",
    "workspaceFolder": "/workspace",

    // Configure tool-specific properties.
    "customizations": {
        // Configure properties specific to VS Code.
        "vscode": {
            // Set *default* container specific settings.json values on container create.
            "settings": {
                "python.defaultInterpreterPath": "/usr/local/bin/python",
                "python.linting.enabled": true,
                "python.linting.pylintEnabled": true,
                "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
                "python.formatting.blackPath": "/usr/local/py-utils/bin/black",
                "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
                "python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
                "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
                "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
                "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
                "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
                "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
                "python.testing.pytestPath": "/usr/local/py-utils/bin/pytest"
            },

            // Add the IDs of extensions you want installed when the container is created.
            "extensions": [
                "ms-python.python",
                "ms-python.vscode-pylance",
                "mhutchie.git-graph",
                "eamodio.gitlens",
                "Vue.volar"
            ]
        }
    },
    "containerEnv": {
        "POSTGRES_USER": "******",
        "POSTGRES_DB": "*****",
        "POSTGRES_PASSWORD": "****"
    },
    "remoteEnv": {
        "DATABASE_URL": "postgresql://${containerEnv:POSTGRES_USER}:${containerEnv:POSTGRES_PASSWORD}@localhost:5432/${containerEnv:POSTGRES_DB}"
    },

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // This can be used to network with other containers or the host.
    "forwardPorts": [5432],

    "onCreateCommand": "./.devcontainer/scripts/on_create.sh",
    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "pip install --user -r requirements.txt",

    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    "remoteUser": "vscode",
    "features": {
        "docker-in-docker": "20.10",
        "kubectl-helm-minikube": "1.23",
        "aws-cli": "latest",
        "rust": "latest"    
    }
}
nxzz commented 1 year ago

Same here. Using Remote-SSH.

jannikkeye commented 1 year ago

I'm experiencing this issue without using SSH or a devcontainer. With or without built in javascript/typescript language features enabled.

Can't seem to find a fix anywhere.

RustyJoeM commented 1 year ago

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

Qualzz commented 1 year ago

Vue3 + Quasar2 project via WSL2, same issue. I noticed the issue appeared when I had an array inside another array. After saving the file, closing it, and reopen, I can format it again.

const bar = ref([ [...], [...] ]);

wycats commented 1 year ago

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"
  },
}
nuqz commented 1 year ago

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:

thedamon commented 1 year ago

Getting this as well but only in some files.. Seems the files that cause it tend to be longer but haven't figured out any pattern (this is in a vue 2.7 project)

zhuxiaoweb commented 1 year ago

+1

stariveer commented 1 year ago

+1

johnsoncodehk commented 1 year ago

Please track #2077