imjp94 / gd-plug

Minimal plugin manager for Godot
MIT License
201 stars 14 forks source link

Godot LSP reports errors on all .plugged repo files #32

Open russmatney opened 4 months ago

russmatney commented 4 months ago

Hey there! Thanks for this plugin, it saves a bunch of time while adding and updating external plugins!

Since adding gd-plug, i've noticed that godot lsp happily traverses into the .plugged directory and reports errors from all the cloned addon repos - is there any way to prevent this or some workaround that you're using to avoid seeing all the extra errors for files that aren't used by your game?

Or maybe this is just a problem on my end? I'm using emacs as an external editor and connecting to lsp in the running godot editor instance - maybe it's a problem in my setup.

It feels like godot lsp should ignore files in a folder with .gdignore , but for now this seems like a rare issue - not sure if anyone else is experiencing it.

Thanks for any help or insight!

imjp94 commented 4 months ago

It is the same in vscode =( Screenshot 2024-04-06 173011 I guess it is because .gdignore only stop importer from importing files, but not native resources like gdscript, see https://github.com/godotengine/godot/issues/20743#issuecomment-410759257

Solution

I have an idea of support installing plugins with bare repo(see git clones --bare) which would not only resolve the errors but also greatly reduce the footprints of .plugged, since it only pull the git repository itself without a working directory. But I haven't have the time to test the idea yet...

HolonProduction commented 1 month ago

As a workaround you could also change the path from res://.plugged to res://addons/.plugged or res://addons/gd-plug/.cache or something like that, as long as it is in the addons directory.

russmatney commented 1 month ago

Cool, nice that this feature is coming to godot! In the meantime i've just been deleting res://.plugged completely after every update :shrug:

HolonProduction commented 1 month ago

This PR would not solve this issue. The sentiment from the GDScript team seems to be, that all code outside addons is considered as user code and will produce warnings, so to prevent warnings, the code needs to be in the addons folder (or not checked out in any working directory at all, like suggested before).

The PR only adds a way to enable warnings again for certain addons (which is needed for addon developers).

If you need a quick workaround that isn't deleting the folder: change the path as I suggested before (it's just a const in plug.gd).

imjp94 commented 1 month ago

I just think of an easy way to support this PR in the future. Change const DEFAULT_PLUG_DIR = "res://.plugged" into environment variable, so that user can change the default path to any path(even outside project directory) without breaking anything.

Jack-023 commented 1 month ago

I just opened #33 which changes the default location for .plugged to /addons/gd-plug which avoids triggering warnings.