Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go to definition (gd) on a C# project throws an error. #4554

Open
rafacolucci opened this issue May 4, 2024 · 3 comments
Open

Go to definition (gd) on a C# project throws an error. #4554

rafacolucci opened this issue May 4, 2024 · 3 comments
Labels
bug Something isn't working LSP LSP Related issues

Comments

@rafacolucci
Copy link

Problem description

When a press "gd" to go a method definition in a C# project I get the follow error:

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1828: index out of range
stack traceback:
[C]: in function '_str_byteindex_enc'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1828: in function 'locations_to_items'
/usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:398: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp.lua:1393: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue

LunarVim version

release-1.3/neovim-0.9-d1c1bace

Neovim version (>= 0.9.1)

NVIM v0.9.5

Operating system/version

Fedora 40

Affected language servers

c#

Steps to reproduce

1 - Open a folder containing a c# project
2 - Open a .cs file
3 - On any call to object method, press "gd" to go do definition.

Actual behavior

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1828: index out of range
stack traceback:
[C]: in function '_str_byteindex_enc'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1828: in function 'locations_to_items'
/usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:398: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp.lua:1393: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue

Expected behavior

To go to the definition

support info

Language client log: /home/colutti/.local/state/lvim/lsp.log
 Detected filetype:   cs
 
 2 client(s) attached to this buffer: 
 
 Client: GitHub Copilot (id: 1, bufnr: [8])
 	filetypes:       
 	autostart:       false
 	root directory:  Running in single file mode.
 	cmd:             node /home/colutti/.local/share/lunarvim/site/pack/lazy/opt/copilot.vim/dist/agent.js --stdio
 
 Client: csharp_ls (id: 2, bufnr: [8])
 	filetypes:       cs
 	autostart:       true
 	root directory:  /home/colutti/projects/document_intelligence/Aranzadi.Document.Intelligence.Unit.Tests
 	cmd:             csharp-ls
 
 Configured servers list: csharp_ls, vimls



    __                          _    ___         
   / /   __  ______  ____ _____| |  / (_)___ ___ 
  / /   / / / / __ \/ __ `/ ___/ | / / / __ `__ \
 / /___/ /_/ / / / / /_/ / /   | |/ / / / / / / /
/_____/\__,_/_/ /_/\__,_/_/    |___/_/_/ /_/ /_/ 


Buffer info
* filetype:                cs
* bufnr:                   8
* treesitter status:       active

Active client(s)
* name:                      GitHub Copilot
* id:                        1
* supported filetype(s):     []
* attached buffers:          8
* root_dir pattern:          8
* name:                      csharp_ls
* id:                        2
* supported filetype(s):     cs
* attached buffers:          8
* root_dir pattern:          8
* capabilities:              documentHighlightProvider | typeHierarchyProvider  | workspaceSymbolProvider
                             typeDefinitionProvider    | implementationProvider | hoverProvider
                             documentSymbolProvider    | definitionProvider     | documentRangeFormattingProvider
                             callHierarchyProvider     | referencesProvider     | documentFormattingProvider

Automatic LSP info
* Skipped servers: [angularls, ansiblels, antlersls, azure_pipelines_ls, omnisharp, cssmodules_ls, denols, docker_compose_language_service, ember, emmet_ls, eslint, glint, golangci_lint_ls, gradle_ls, graphql, jedi_language_server, ltex, neocmake, phpactor, psalm, pylsp, pylyzer, pyre, quick_lint_js, reason_ls, rnix, rome, ruby_ls, ruff_lsp, solang, solc, sorbet, sourcery, spectral, sqlls, sqls, standardrb, stylelint_lsp, svlangserver, tflint, unocss, verible, vtsls, vuels]

Formatters info
* Active: 
* Supported: [astyle, clang_format, csharpier, uncrustify]

Linters info
* Active: 
* Supported: []

Code actions info
* Active: 

logs

No response

Screenshots

No response

@rafacolucci rafacolucci added bug Something isn't working LSP LSP Related issues labels May 4, 2024
@rachit-ranjan16
Copy link

Can repro the same.

@bpauw
Copy link

bpauw commented May 16, 2024

Same here.

It looks to me like it's happening when the type definition is in a different project (though the same solution) as the project of the file from which gd is being called.

lvim: release-1.3/neovim-0.9-d1c1bace
neovim: 0.9.5

    __                          _    ___         
   / /   __  ______  ____ _____| |  / (_)___ ___ 
  / /   / / / / __ \/ __ `/ ___/ | / / / __ `__ \
 / /___/ /_/ / / / / /_/ / /   | |/ / / / / / / /
/_____/\__,_/_/ /_/\__,_/_/    |___/_/_/ /_/ /_/ 


Buffer info
* filetype:                cs
* bufnr:                   49
* treesitter status:       active

Active client(s)
* name:                      csharp_ls
* id:                        1
* supported filetype(s):     cs
* attached buffers:          [14, 49, 12]
* root_dir pattern:          [14, 49, 12]
* capabilities:              referencesProvider      | callHierarchyProvider      | documentRangeFormattingProvider
                             documentSymbolProvider  | typeDefinitionProvider     | hoverProvider
                             workspaceSymbolProvider | documentHighlightProvider  | typeHierarchyProvider
                             implementationProvider  | documentFormattingProvider | definitionProvider
* name:                      csharp_ls
* id:                        2
* supported filetype(s):     cs
* attached buffers:          38
* root_dir pattern:          38
* capabilities:              referencesProvider      | callHierarchyProvider      | documentRangeFormattingProvider
                             documentSymbolProvider  | typeDefinitionProvider     | hoverProvider
                             workspaceSymbolProvider | documentHighlightProvider  | typeHierarchyProvider
                             implementationProvider  | documentFormattingProvider | definitionProvider

Automatic LSP info
* Skipped servers: [angularls, ansiblels, antlersls, azure_pipelines_ls, omnisharp, cssmodules_ls, denols, docker_compose_language_service, ember, emmet_ls, eslint, glint, golangci_lint_ls, gradle_ls, graphql, jedi_language_server, ltex, neocmake, phpactor, psalm, pylsp, pylyzer, pyre, quick_lint_js, reason_ls, rnix, rome, ruby_ls, ruff_lsp, solang, solc, sorbet, sourcery, spectral, sqlls, sqls, standardrb, stylelint_lsp, svlangserver, tflint, unocss, verible, vtsls, vuels]

Formatters info
* Active: 
* Supported: [astyle, clang_format, csharpier, uncrustify]

Linters info
* Active: 
* Supported: []

Code actions info
* Active: 

@bpauw
Copy link

bpauw commented May 16, 2024

I temporarily resolved this by switching to omnisharp.

It seems to be having issues finding some of my symbols, but it doesn't fail on every gd with an exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LSP LSP Related issues
Projects
None yet
Development

No branches or pull requests

3 participants