zed-gdscript icon indicating copy to clipboard operation
zed-gdscript copied to clipboard

GDScript errors are reported in other filetypes (e.g. .rs files)

Open ray-pH opened this issue 1 year ago • 20 comments

Maintainer edit: The Godot engine catches and answers language server requests on files other than gdscript. This causes it to report errors on non-GDScript files. We don't have a way to control this behavior on this plugin's end. There is a pending fix to the Godot game engine: https://github.com/godotengine/godot/pull/103186


When GDscript is running, the LSP is also active on other filetypes

Is there a config I should add to limit it to only run on GDScript files?

image image

Steps to reproduce:

  1. Open a project that contains GDScript file and other files
  2. Open the GDScript file so that the lsp is running in the background
  3. Open a non-GDscript file, edit a little, and save the file
  4. The gdscript LSP will be active on that file

ray-pH avatar Jun 17 '24 07:06 ray-pH

That is weird, GDScript shouldn't even be triggered in those files.

grndctrl avatar Jun 17 '24 08:06 grndctrl

It only happens after the gdscipt lsp is running. Without opening a gdscript file first, the lsp won't be active. (I edited the initial comment adding the step to reproduce the issue)

ray-pH avatar Jun 17 '24 08:06 ray-pH

I think this is more of a Zed bug. It shouldn't check .rs files against the GDScript LSP. The extension is configured to only work on GDScript files (and resource files, since last update)

grndctrl avatar Jun 17 '24 09:06 grndctrl

could you run copy system specs into clipboard in the command palette inside Zed, and paste it here? I will open an issue on Zed repo.

grndctrl avatar Jun 17 '24 09:06 grndctrl

Zed: v0.141.0 (Zed Dev 4855da53dfa62791d9dd102b9db9cf7ddb08d153) OS: Linux Wayland debian unknown Memory: 13.5 GiB Architecture: x86_64

Might be an issue with the linux port?

ray-pH avatar Jun 18 '24 01:06 ray-pH

I have a similar issue, where the Project Diagnostics is flagging gdscript issues on the .tres files: image I'm on MacOs Sonoma 14.5, M1 Pro, latest Zed version (Zed 0.141.2 3e609e479354cfb623e001ea24a559351607076f)

coppolaemilio avatar Jun 26 '24 23:06 coppolaemilio

Experiencing the same issue. Zed: v0.146.3 (Zed) OS: Linux Wayland arch unknown Memory: 31.3 GiB Architecture: x86_64 GPU: NVIDIA GeForce GTX 1650 SUPER || NVIDIA || 555.58.02

EnderMaster77 avatar Jul 31 '24 23:07 EnderMaster77

@coppolaemilio Do you still have this issue on tres files with the latest release of Zed? On this end, I cannot reproduce it.

I can reproduce the issue of the language server running on other programming language files, though. It happens with any programming language it seems. I'm not sure why yet, but I'll try to see if I can find out. If anyone has an idea of what could be the cause, I'm all ears. I'll look into language injections and language server settings, see if something stops the behavior.

NathanLovato avatar Aug 14 '24 11:08 NathanLovato

Nope, can't reproduce it anymore. It seems fixed on my end 👍 btw, did you take over the project? @NathanLovato 👀

coppolaemilio avatar Aug 14 '24 12:08 coppolaemilio

@coppolaemilio Yes! And the idea is to develop it a bit and then if more people start to use Zed offer to transfer it to the foundation like the emacs plugin before.

NathanLovato avatar Aug 14 '24 12:08 NathanLovato

Nope, can't reproduce it anymore. It seems fixed on my end 👍 btw, did you take over the project? @NathanLovato 👀

Yeah, I threw together the extension just so I could keep working in Zed. But then people started using it and I was unable to keep up. Glad @NathanLovato reached out!

grndctrl avatar Aug 14 '24 12:08 grndctrl

I am still having this issue (including .tres files). Linux, Zed 0.148.0

fstxz avatar Aug 15 '24 09:08 fstxz

Hello, I have this issue as well, here's the language server reporting a bunch of issues on my tasks.json file:

An image showing several gdscript related errors on a json file

This happens when:

  1. The language server is active (Godot is running)
  2. You save any text file in the workspace (notably when it is not a .gd file)

Zed: v0.164.2 (Zed) OS: Linux Wayland opensuse-tumbleweed 20250112 Memory: 15.5 GiB Architecture: x86_64 GPU: AMD Radeon RX 6600 (RADV NAVI23) || radv || Mesa 24.3.3

KettLovahr avatar Jan 17 '25 04:01 KettLovahr

I took a look at the logs, and it seems that when saving a file, Zed sends textDocument/didSave RPC requests to every language server regardless of the file type of the file being saved, and unlike other language servers, Godot's language server will happily respond to a file it has no business analyzing as if it were a GDScript file, while other servers I looked into completely ignore such requests.

I was using Godot 4.2.2, but just checked 4.4 as well in case anything had changed, but that doesn't seem to be the case.

So, the problem doesn't seem to be the extension... Zed is sending requests it shouldn't, and Godot is returning responses it shouldn't. Should probably open an issue upstream, but I'm not even sure whether it is Zed or Godot that's most at fault, here.

KettLovahr avatar Jan 17 '25 06:01 KettLovahr

I submitted a pull request fixing this into Godot Engine. Thanks @KettLovahr for the detailed response!

It seems like Zed used to not send the notification for all file types, but it was reverted in zed-industries/zed/pull/19183, so I submitted the fix into the engine.

Na-r avatar Feb 22 '25 19:02 Na-r

Image

Still a problem it seems.

tkgalk avatar Aug 03 '25 16:08 tkgalk

I just updated the top post to briefly summarize the situation and link to the pending fix on Godot's side.

NathanLovato avatar Aug 25 '25 18:08 NathanLovato

This happens to me with all no GDScript files when I do commit, I have to reload the editor for the errors to go.

Zed: v0.207.3 (Zed Preview) OS: Linux Wayland fedora 42 Memory: 15 GiB Architecture: x86_64 GPU: AMD Radeon Graphics (RADV RENOIR) || radv || Mesa 25.1.9

SomegitMissing avatar Oct 08 '25 00:10 SomegitMissing

Yes, this is a limitation that's outside the control of this extension. See the top post and linked pull request on the engine repository for more information.

NathanLovato avatar Oct 09 '25 12:10 NathanLovato

FYI https://github.com/godotengine/godot/pull/105236 also contains logic to prevent parsing everything as GDScript. If anyone here is running custom Godot builds, I'd appreciate some user testing, maybe that would help with getting a review.

HolonProduction avatar Oct 27 '25 12:10 HolonProduction