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

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

Closed
ubershmekel opened this issue Apr 11, 2022 · 16 comments
Closed

Comments

@ubershmekel
Copy link

ubershmekel commented Apr 11, 2022

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
Copy link

got the same issue

@johnsoncodehk
Copy link
Member

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

@ubershmekel
Copy link
Author

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
Copy link

same

@yhhwpp
Copy link

yhhwpp commented Nov 3, 2022

+1

@DanielChrome
Copy link

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
Copy link

nxzz commented Nov 14, 2022

Same here.
Using Remote-SSH.

@jannikkeye
Copy link

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
Copy link

RustyJoeM commented Nov 16, 2022

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
Copy link

Qualzz commented Nov 16, 2022

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
Copy link

wycats commented Nov 16, 2022

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
Copy link

nuqz commented Nov 21, 2022

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
Copy link

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
Copy link

+1

1 similar comment
@stariveer
Copy link

+1

@johnsoncodehk
Copy link
Member

Please track #2077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests