0
\$\begingroup\$

I installed the following extension: https://marketplace.visualstudio.com/items?itemName=woberg.godot-dotnet-tools

but I'm not sure if it's actually related to autocompletion. I've tried turning the plugin on and off multiple times, but sometimes autocompletion works, and sometimes it doesn't, making it difficult to investigate.

Additionally, an alert appears at the bottom right every time, which is quite annoying.

Questions:

  • Why does autocompletion work even though it's "Disconnected"?
  • How can I properly indicate that it is connected?

use: Godot Engine v4.0.stable.mono.official

VSCode: enter image description here

Godot: enter image description here

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Why is C# autocomplete working?

The autocompletion you see is working via the default C# tooling for Visual Studio Code, on which Godot .NET Tools relies.


Why does it say disconnected?

The disconnected message is from the extension godot-tool. Read the popup, it says source: godot-tool.

Godot-tools popup, with "source: godot-tool" highlighted

Do not confuse godot-tool with Godot .NET Tools.

The godot-tool extension provides support for GDscript using the Godot language server. And it is not connecting, see below for what you need to make it connect.


How to make it connect?

To connect godot-tool you need to make sure:

  • The language server port match. You find the language server port configuration under Editor Settings -> General -> Network -> Language Server.

    Language Server Configuartion

    Looking at your picture, it seems you have configured the debugger port instead of the language server port.

    Incorrect configuration

    You will have to configure a different port for the debugger, so they don't conflict.

  • The connection is not being taken by something else. When the connection is taken Godot will output a message ([LSP] Connection Taken). If you see it and godot-tool is disconnected, it means something else connected instead.

    Connection Taken message

  • If the port matches and nothing else took the connection, click "Retry" on the godot-tool popup.

    Retry button location

Also note that Godot - by default - will advance the port number if you are running multiple instances of the editor (the first gets the confugured port, and the next instance one gets the next port number and so on).

If the port does not match because there were multiple instances running, or it didn't not match and you fixed it, or if the connection was taken by something else… You might have to restart Godot for it to be able to connect again.


By the way, C# Tools for Godot and godot-tool are the extensions made by the core Godot developers.

Godot .NET Tools is a third party alternative for C# with Godot. I have not compared it to C# Tools for Godot, but if Godot .NET Tools is causing problems, consider switching to C# Tools for Godot.

By the way, 4.0 is no under support. So if you run into issues with it, do not expect any fixes. Thus, consider updating your Godot version. 4.1 is the lower supported 4.x version at the time of writing.


Ignoring the connection issue

If ultimately the connection does not work, go ahead and click Ignore on the pupup. This means you will not have autocomplete and debugging for GDScript on Visual Studio Code. But since you are using C# instead, that might be acceptable.

Ignore button location

Futhermore, you should be able to use C# without godot-tool at all. So you might even disable or uninstall godot-tool entirely.

\$\endgroup\$
3
  • \$\begingroup\$ I uninstalled godot-tool and Godot .NET Tools. My goal was simply to be able to autocomplete, jumping, and view explanations of C# classes used in Godot. As stated in the response, even after removing both plugins, autocomplete, jumping, and other features were still functioning. \$\endgroup\$ Commented Jan 26 at 8:06
  • \$\begingroup\$ For some reason, autocomplete stopped working when I tried to continue working today (probably because I restarted my Mac). I reinstalled C# Tools for Godot and godot-tool, set up settings.json, and opened the top-level folder of the project in VSCode, which restored autocomplete functionality. Once the top-level folder is opened in VSCode, there are no issues, but if VSCode is launched from Godot without the top-level folder being open, autocomplete does not work. I also updated the version to 4.3. \$\endgroup\$ Commented Jan 27 at 14:52
  • \$\begingroup\$ @shingo.nakanishi For just autocomplete you could be able to just install marketplace.visualstudio.com/… I think you need to open the folder for Visual Studio Code to find the solution/project - Anyway, you should also have debug support if you set it all properly this time. \$\endgroup\$ Commented Jan 28 at 4:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.