lsp-bridge
lsp-bridge copied to clipboard
Does not function correctly with unity
I've been trying to use lsp-bridge for unity projects (it uses the omnisharp language server). However with the default setup after installing omnisharp via the lsp-bridge-install-omnisharp (this command only downloads a zip file, which I had to extract manually to the .cache folder in emacs to get it working, I don't know if that is intended), does not work correctly with a C# unity projects. Essentially it is unaware of other files in the project and only sees the current file. This means the autocomplete is unable to function properly for any element that is part of another file, the diagnosis also fail in the same way, find definition/ref/impl just don't work, and none of the unity classes and functions can be used. This is similar to how lsp (not lsp-bridge) functions when you first try to make it work with unity project. In there you need to specify lsp to use the 4.5 mono assemblies, via the (setenv "FrameworkPathOverride" "/lib/mono/4.5") expression in emacs. However this does not work with lsp-bridge.
Which OS did you use ?
OS: Archlinux Emacs: 29.0.05 with doom emacs Latest master lsp-bridge version as of the writing of the issue
Fixed by https://github.com/manateelazycat/lsp-bridge/commit/45714bb5f2c61991713ae8458ba10ce7fec9e02b
The unity projects still do not work with the new version. Unity does not work with omnisharp-dotnet 6.0. It needs to use omnisharp mono with additional libraries. Those are the settings that enable omnisharp to work in VSCode
"omnisharp.monoPath": "/usr/bin/mono",
"omnisharp.useModernNet": false,
"omnisharp.enableRoslynAnalyzers": true
""omnisharp.useModernNet": false" disables the 6.0 support to enable the use of the mono downloaded on the system at the specified path ""omnisharp.monoPath": "/usr/bin/mono"".
As I mentioned in the original comment for the lsp (not lsp-bridge) package in Unity you need (setenv "FrameworkPathOverride" "/lib/mono/4.5") to let mono use the correct version.
I tried adding a command parameter of mono to the omnisharp-mono langserver
{
"name": "omnisharp-mono",
"languageId": "c#",
"command": ["mono",
"--runtime=4.5",
"$HOME/.emacs.d/.cache/omnisharp/OmniSharp.exe",
"-z",
"-lsp"],
"settings": {}
}
but the issues from the issues I've described in the original comment persist.
I've also tried using both the omnisharp version from the install-omnisharp command and the one used by vscode - both produce the same result.
I'm not C# guy, no idea how to fix this.
The unity projects still do not work with the new version. Unity does not work with omnisharp-dotnet 6.0. It needs to use omnisharp mono with additional libraries. Those are the settings that enable omnisharp to work in VSCode
"omnisharp.monoPath": "/usr/bin/mono", "omnisharp.useModernNet": false, "omnisharp.enableRoslynAnalyzers": true
""omnisharp.useModernNet": false" disables the 6.0 support to enable the use of the mono downloaded on the system at the specified path ""omnisharp.monoPath": "/usr/bin/mono"".
As I mentioned in the original comment for the lsp (not lsp-bridge) package in Unity you need (setenv "FrameworkPathOverride" "/lib/mono/4.5") to let mono use the correct version.
I tried adding a command parameter of mono to the omnisharp-mono langserver
{ "name": "omnisharp-mono", "languageId": "c#", "command": ["mono", "--runtime=4.5", "$HOME/.emacs.d/.cache/omnisharp/OmniSharp.exe", "-z", "-lsp"], "settings": {} }
but the issues from the issues I've described in the original comment persist.
I've also tried using both the omnisharp version from the install-omnisharp command and the one used by vscode - both produce the same result.
No, you need add omnisharp options in initializationOptions
, like rust does: https://github.com/manateelazycat/lsp-bridge/blob/72bb4a34b90e0483ff4806c2b50bc19aef97dc12/langserver/rust-analyzer.json#L6
@BigCrow https://grtcdr.tn/posts/2023-01-24.html will help?
lsp-bridge has support csharp-ls, csharp-ls is better way, welcome to try it.