prabirshrestha / vim-lsp

async language server protocol plugin for vim and neovim
MIT License
3.07k stars 303 forks source link

Get LSP to work with complicated Scala project with git submodules. #1533

Closed gonsolo closed 5 months ago

gonsolo commented 5 months ago

I tried to get "Jump to definition" working with vim, vim-lsp for chipyard. Chipyard is a complicated multi-gitsubmodule project.

I filed an issue for Scala Metals here. With this issue I'm trying to get all related parties onboard.

In a simple scala project it works.

Relevant snippests from my .vimrc:

if executable('metals')
  au User lsp_setup call lsp#register_server({
       \  'name': 'Scala Language Server',
       \  'cmd': {server_info->['metals']},
       \  'initialization_options': { 'isHttpEnabled': 'true' },
       \  'whitelist': ['scala'],
       \ })
endif
if executable('sourcekit-lsp')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'sourcekit-lsp',
        \ 'cmd': {server_info->['sourcekit-lsp']},
        \ 'whitelist': ['c', 'cpp', 'objc', 'opencl', 'swift', 'rust', 'scala'],
        \ })
endif
autocmd FileType scala nnoremap <C-]> :LspDefinition<CR>
autocmd FileType scala setlocal omnifunc=lsp#complete

I'm willing to take the time to debug and would be happy for advice.

gonsolo commented 5 months ago

I got it working by fiddling around bloop, running the bloop server and starting vim from the root directory and opening scala files from there. So it's not a vim-lsp issue. Closing.