Request textDocument/documentSymbol failed
Godot version
4.4.stable
VS Code version
1.98.1
Godot Tools VS Code extension version
2.5.0
System information
MacOS Sequoia 15.2
Issue description
Since upgrading to Godot 4.4 and plugin version 2.5.0, opening a gdscript file displays the following error
[Error - 09:35:45] Request textDocument/documentSymbol failed. Error: selectionRange must be contained in fullRange at tf.validate (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:22635) at new tf (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:22843) at Bt (/Users/zoru/.vscode/extensions/geequlim.godot-tools-2.5.0/out/extension.js:35:72393) at a (/Users/zoru/.vscode/extensions/geequlim.godot-tools-2.5.0/out/extension.js:35:46743) at Object.GS [as map] (/Users/zoru/.vscode/extensions/geequlim.godot-tools-2.5.0/out/extension.js:35:46829) at Object.un [as asDocumentSymbols] (/Users/zoru/.vscode/extensions/geequlim.godot-tools-2.5.0/out/extension.js:35:72360) at c (/Users/zoru/.vscode/extensions/geequlim.godot-tools-2.5.0/out/extension.js:39:56034) at async QI.provideDocumentSymbols (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:135:125749)
The error appeared right after updating plugin to 2.5.0.
Steps to reproduce
- Open a Godot 4.4 project.
- Install Godot vscode plugin
- Open a gdscript file
Also having the same issue on 2.5.0 with the following VScode setup:
- Version: 1.97.2
- Commit: e54c774e0add60467559eb0d1e229c6452cf8447
- Date: 2025-02-12T23:20:35.343Z
- Electron: 32.2.7
- ElectronBuildId: 10982180
- Chromium: 128.0.6613.186
- Node.js: 20.18.1
- V8: 12.8.374.38-electron.0
- OS: Linux x64 6.11.0-19-generic
cc @DaelonSuzuka
In the meantime, grab the 2.4.0 VSIX from https://github.com/godotengine/godot-vscode-plugin/releases/tag/2.4.0 and install it.
It may be worth noting (at least, in my case) - there doesn't seem to be any actual impact, other than the warning dialog popping up in the corner any time text is edited. Everything seems to be working so far for me.
I can't replicate this on either win10 or debian using Godot 4.4 stable.
Can somebody share a minimum reproduction or something?
I have this error, but it isn't consistent across all my projects. One smaller project runs fine, while another larger project has the issue. Using same user configs and settings in both, and both are on same machine, windows 11.
Also worth noting: This appears in my converted projects, not ones created in 4.4 as far as I can see.
Error: selectionRange must be contained in fullRange
at Function.validate (file:///c:/Users/actte/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:22635)
at new tf (file:///c:/Users/actte/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:22843)
at Bt (c:\Users\actte\.vscode\extensions\geequlim.godot-tools-2.5.0\out\extension.js:35:72393)
at a (c:\Users\actte\.vscode\extensions\geequlim.godot-tools-2.5.0\out\extension.js:35:46743)
at Object.GS [as map] (c:\Users\actte\.vscode\extensions\geequlim.godot-tools-2.5.0\out\extension.js:35:46829)
at Object.un [as asDocumentSymbols] (c:\Users\actte\.vscode\extensions\geequlim.godot-tools-2.5.0\out\extension.js:35:72360)
at c (c:\Users\actte\.vscode\extensions\geequlim.godot-tools-2.5.0\out\extension.js:39:56034)
at QI.provideDocumentSymbols (file:///c:/Users/actte/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:135:125749)
I can't replicate this on either win10 or debian using Godot 4.4 stable.
Can somebody share a minimum reproduction or something?
I tried creating a new Godot 4.4 project, nothing inside it except a test.tscn file with a simple Node and a test.gd script.
First, the error didn't appear when opening and editing the test.gd file.
But I added a class_name Test at the top of the file and the error appeared immediately.
If I remove the class_name, the error disappears.
Here is the full code for this project
class_name Test
extends Node
Inside test.gd
Do you need a repo with that test project? It really is empty appart from this test scene.
@devzenfr That replicates it immediately, thanks. Give me a little time to look into this.
I tested and if you moved the class_name so it's not on the first line it works. Adding an empty line, a comment, @tool, @icon or switching extends Node with the class_name fixes it. Though, Godot's standard in GDScript is having the class_name before extends Node.
Sounds like it's related to this issue: https://github.com/godotengine/godot-vscode-plugin/issues/760
Which was addressed in: https://github.com/godotengine/godot/pull/99295
I'll look closer at the LSP logs tomorrow but I think this extension is just the messenger in this case, and the issue is in either VSCode forming it's requests wrong or the language server not responding correctly.
@Calinou @HolonProduction Thoughts?
It's a server side issue. The response is invalid. Will look into it.
See godotengine/godot#104114
The issue is not specific to any plugin version, but the error message is only shown since 2.5.0 (maybe some update to the LSP Client dependency?). With plugin version 2.4.0 the outline still doesn't work, so internally there is an issue with the symbols it just isn't forwarded to the user.
Also not specific to Godot 4.4. So everything in that direction is probably a different issue with the project conversion.
Thanks @HolonProduction!
(maybe some update to the LSP Client dependency?)
Yes exactly, I was finally able to update vscode-languageclient from v7.x to v9.x, which I've wanted to do for several years.
It may be worth noting (at least, in my case) - there doesn't seem to be any actual impact, other than the warning dialog popping up in the corner any time text is edited. Everything seems to be working so far for me.
For me auto completion works but I can't view the docs when I ctrl click on a function or class name. I am using Godot 4.3
Extension v2.5.1 was just published with a client-side hotfix that suppresses the error messages. Any additional effects of this issue will still be present, the best I can do right now is make it fail silently.
The actual fix was merged in the engine yesterday via https://github.com/godotengine/godot/pull/104114, so watch the Godot releases for that.
Anybody who wants the outline or related functionality back today can reorder their scripts so that class_name isn't on the first line. Otherwise, upgrade to the next version of 4.4 whenever it releases.
I'm going to leave this issue open and pinned until the new engine version is out.
Godot 4.4.1 rc1 released yesterday. I did not see the fix in rc1 but might be added before the official release of 4.4.1
Godot 4.4.1 rc1 released yesterday. I did not see the fix in rc1 but might be added before the official release of 4.4.1
It launched on rc2 guys 🥳, amazing job of everyone involved!
Is there a reason the issue is still open @DaelonSuzuka? As far as I am aware the issue is completely fixed.
@HolonProduction I've just been busy.