vim-lsp-settings icon indicating copy to clipboard operation
vim-lsp-settings copied to clipboard

The steep language server started when Steepfile not exists

Open elct9620 opened this issue 1 year ago • 3 comments

My Vim has these settings to enable the ruby-lsp, steep, and rubocop language server

let g:lsp_settings_filetype_ruby = ['ruby-lsp', 'rubocop', 'steep']

However, when I installed steep with gem install steep another project didn't have Steepfile still load the steep language server.

I think this line will check for it but seems not to work: https://github.com/mattn/vim-lsp-settings/blob/2cad696eb76755ff00415d97ce4bd5c82d6e2fb3/settings/steep.vim#L8

If I removed the g:lsp_settings_filetype_ruby then the steep not work on the project has Steepfile

P.S. The rubocop or rubocop-lsp-mode both do not run the rubocop language server for now

elct9620 avatar Jun 12 '24 12:06 elct9620

make sense. I'll look this into it in later.

mattn avatar Jun 12 '24 23:06 mattn

Thanks.

I test another use case for it.

  1. gem uninstall steep to ensure no steep installed
  2. Run :LspInstallServer steep to install into ~/.local
  3. Run vim with the Steepfile project but the :LspStatus shows steep: exited

The similar issues occurred with Rubocop:

If :LspInstallServer rubocop-lsp-mode is not configured (not exists in ~/.local) the rubocop-lsp-mode never loaded even the Gemfile included the rubocop gem.

elct9620 avatar Jun 13 '24 06:06 elct9620

@mattn

I use "= with <CR> to call lsp_settings#root_path(['Steepfile']) to check the value, but it returns the project path instead of an empty value. I think it causes this unexpected behavior.

Test Environment

  1. Rails Project
  2. Gemfile in project root
  3. Steepfile not exists

Test Case

  • "=lsp_settings#root_path(['Steepfile'])<CR>p
    • /Users/elct9620/Workspace/vim-lsp-no-steep
  • "=lsp_settings#root_path(['Gemfile'])<CR>p
    • /Users/elct9620/Workspace/vim-lsp-no-steep
  • "=lsp#utils#find_nearest_parent_file(lsp#utils#get_buffer_path(), 'Steepfile')<CR>p
  • "=lsp#utils#find_nearest_parent_file(lsp#utils#get_buffer_path(), 'Gemfile')<CR>p
    • /Users/elct9620/Workspace/vim-lsp-no-steep/Gemfile

I find the root_path call the find_nearest_parent_file_directory with some extra pattern (e.g. .git) https://github.com/mattn/vim-lsp-settings/blob/ac7a1dc60b300f4bc49c95fec923741a4ef1b7c4/autoload/lsp_settings.vim#L257-L260

Should we use find_nearest_parent_file instead of root_path?

I think the angular has the same issue because this is another place that uses root_path https://github.com/mattn/vim-lsp-settings/blob/ac7a1dc60b300f4bc49c95fec923741a4ef1b7c4/settings/angular-language-server.vim#L8

elct9620 avatar Aug 23 '24 12:08 elct9620

@mattn Any update here?

elct9620 avatar Jan 06 '25 13:01 elct9620