I have recently started using eglot for code completion. I was able to install Omnisharp on my system and get eglot to run for my .cs
files. However eglot does not seem to be aware of any of the Godot
namespace functions, classes, or types. It display an error about unknown symbols and cannot find definitions.
As a test I used Visual Studio Code and it was able to code complete Godot c# types without any Godot extensions installed.
Looking inside my project directory I see a .sln
file as well as .mono
directory with its assemblies
directory containing several GodotSharp
c# files like .dll
and .xml
. I am assuming that the .sln
file combined with the GodotSharp.{dll,pdb,xml}
files are what Visual Studio Code uses to learn about Godot c# types.
My question is: How do I configure eglot and Omnisharp to know about the Godot c# types? I see in the Omnisharp documentation it mentions pointing the Omnisharp binary to a .sln
file to use c# solutions. So I tried modifying my eglot-server-programs
variable to launch Omnisharp this way:
(setq eglot-server-programs (remove '(csharp-mode "omnisharp" "-lsp") eglot-server-programs))
(add-to-list 'eglot-server-programs '(csharp-mode "omnisharp" "*.sln" "-lsp"))
I also tried variations with omnisharp -s *.sln -lsp
and omnisharp myproject.sln -lsp
. However with all these attempts eglot fails to connect to Omnisharp.
How might I configure eglot and Omnisharp to know about Godot c# types?