astrocommunity icon indicating copy to clipboard operation
astrocommunity copied to clipboard

astrocommunity.pack.cs-omnisharp lsp not working

Open james5635 opened this issue 4 months ago • 7 comments

Image

The omnisharp lsp is not working on neovim 0.11.4

neovim

NVIM v0.11.4
Build type: RelWithDebInfo
LuaJIT 2.1.1753364724
Run "nvim -V1 -v" for more info

dotnet

.NET SDK:
 Version:           9.0.110
 Commit:            999243871a
 Workload version:  9.0.100-manifests.3277c30b
 MSBuild version:   17.12.44+999243871

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.110/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.8
  Architecture: x64
  Commit:       a1e39f97e5

.NET SDKs installed:
  9.0.110 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

james5635 avatar Oct 17 '25 08:10 james5635

Can u dump the error here @james5635

Uzaaft avatar Oct 18 '25 12:10 Uzaaft

There have been some upstream updates with some fixes like https://github.com/neovim/nvim-lspconfig/commit/dc64b7d9bb0d5a3c365bbca09b991591ff5a5156 that could cause an issue

azdanov avatar Oct 18 '25 13:10 azdanov

@Uzaaft The error doesn't appear, but the omnisharp lsp is not running.

Before LazyVim 15.x, there is the same problem. Afterwards, I've upgraded my LazyVim to 15.x, and the Omnisharp lsp runs well. Please check this.

LspInfo


==============================================================================
vim.lsp:                                                                    ✅

- LSP log level : WARN
- Log path: /home/jame/.local/state/astronvim/lsp.log
- Log size: 0 KB

vim.lsp: Active Clients ~
- null-ls (id: 2)
  - Version: ? (no serverInfo.version response)
  - Root directory: ~/Desktop/coding/year4
  - Command: <function @/home/jame/.local/share/astronvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:61>
  - Settings: {}
  - Attached buffers: 1

vim.lsp: Enabled Configurations ~

vim.lsp: File Watcher ~
- file watching "(workspace/didChangeWatchedFiles)" disabled on all clients

vim.lsp: Position Encodings ~
- No buffers contain mixed position encodings

LspLog

There is empty in LspLog.

james5635 avatar Oct 18 '25 13:10 james5635

are you using astronvim or lazyvim?

Uzaaft avatar Oct 18 '25 13:10 Uzaaft

@james5635

Uzaaft avatar Oct 18 '25 13:10 Uzaaft

@Uzaaft AstroNvim

james5635 avatar Oct 18 '25 13:10 james5635

Not enough info to see what's wrong. Are there no other logs or more error messages?

azdanov avatar Oct 19 '25 05:10 azdanov

Maybe I can give some more information on this as I am facing the same issue. First of all the full warning message when opening a .cs file:

...m/4611/usr/share/nvim/runtime/lua/vim/lsp/_transport.lua:68: Spawning language server with cmd: `{ "-z", "--hostPID", "13814", "DotNet:enablePackageRestore=false", "--encoding", "utf-8", "--languageserver", "Sdk:IncludePrereleases=true", "FormattingOptions:EnableEditorConfigSupport=true" }` failed. The language server is either not installed, missing from PATH, or not executable.

It seems to me the first entry to the command table is missing, which is the actual name "Omnisharp" (or the path, i don't know). This is only a guess of course, based on things I saw in other places, but I don't really understand the inner workings here.

Other information which might help:

  • the actual omnisharp binary is in PascalCase as opposed to most other LSPs
~/.local/share/nvim/mason/bin$ ll
total 15
drwxr-xr-x 2 user user 4096 Dez 15 02:41 ./
drwxr-xr-x 8 user user 4096 Mai 10  2025 ../
lrwxrwxrwx 1 user user   49 Jun 13  2025 bash-debug-adapter -> ../packages/bash-debug-adapter/bash-debug-adapter*
lrwxrwxrwx 1 user user   71 Jun 13  2025 bash-language-server -> ../packages/bash-language-server/node_modules/.bin/bash-language-server*
lrwxrwxrwx 1 user user   29 Dez 13 17:48 codelldb -> ../packages/codelldb/codelldb*
lrwxrwxrwx 1 user user   31 Dez 14 17:51 csharpier -> ../packages/csharpier/csharpier*
lrwxrwxrwx 1 user user   23 Dez 13 17:48 jdtls -> ../packages/jdtls/jdtls*
lrwxrwxrwx 1 user user   69 Mai 22  2025 lemminx -> /home/user/.local/share/nvim/mason/packages/lemminx/lemminx-linux*
lrwxrwxrwx 1 user user   51 Dez 13 17:48 lua-language-server -> ../packages/lua-language-server/lua-language-server*
lrwxrwxrwx 1 user user   39 Dez 14 17:36 marksman -> ../packages/marksman/marksman-linux-x64*
lrwxrwxrwx 1 user user   33 Dez 13 20:47 netcoredbg -> ../packages/netcoredbg/netcoredbg*
lrwxrwxrwx 1 user user   31 Dez 14 17:59 OmniSharp -> ../packages/omnisharp/OmniSharp*
lrwxrwxrwx 1 user user   49 Nov  1 19:27 prettierd -> ../packages/prettierd/node_modules/.bin/prettierd*
lrwxrwxrwx 1 user user   25 Nov  1 19:26 selene -> ../packages/selene/selene*
lrwxrwxrwx 1 user user   33 Nov  1 19:26 shellcheck -> ../packages/shellcheck/shellcheck*
lrwxrwxrwx 1 user user   43 Nov  1 19:26 shfmt -> ../packages/shfmt/shfmt_v3.12.0_linux_amd64*
lrwxrwxrwx 1 user user   25 Nov  1 19:26 stylua -> ../packages/stylua/stylua*
lrwxrwxrwx 1 user user   36 Jun 10  2025 taplo -> ../packages/taplo/taplo-linux-x86_64*
lrwxrwxrwx 1 user user   49 Dez 14 17:36 tree-sitter -> ../packages/tree-sitter-cli/tree-sitter-linux-x64*
  • I tried creating a symlink, assuming it searches by the wrong name because of this (https://github.com/neovim/nvim-lspconfig/commit/dc64b7d9bb0d5a3c365bbca09b991591ff5a5156), but the following also didn't change anything: lrwxrwxrwx 1 user user 9 Dez 15 02:41 omnisharp -> OmniSharp*

  • The installation process worked flawlessly and I can also execute the LSP binary manually, so the issue should just be in the way the LSP is started. I tried to read further into the code to debug this myself, but I didn't find where the Lsp command table (the one from the warning) is created and based on what.

  • :MasonLog and :LspLog don't show anything regarding an attempt to start omnisharp or something related

  • My installation:

    • NVIM v0.11.5 Build type: RelWithDebInfo LuaJIT 2.1.1741730670
    • dotnet --version 8.0.122
    • this is my full config (a slight mess) on top of which I just added this line to the community.lua file: { import = "astrocommunity.pack.cs-omnisharp" }, -- requires dotnet (must be the APT version)

Hopefully that can be of help here. Please let me know if I can help out in any other way.

Matzeall avatar Dec 15 '25 20:12 Matzeall