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

The steep language server started when Steepfile not exists #756

Open
elct9620 opened this issue Jun 12, 2024 · 4 comments
Open

The steep language server started when Steepfile not exists #756

elct9620 opened this issue Jun 12, 2024 · 4 comments

Comments

@elct9620
Copy link

elct9620 commented Jun 12, 2024

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:

\ 'allowlist': lsp_settings#get('steep', 'allowlist', {x->empty(lsp_settings#root_path(['Steepfile'])) ? [] : ['ruby']}),

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

@mattn
Copy link
Owner

mattn commented Jun 12, 2024

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

@elct9620
Copy link
Author

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
Copy link
Author

elct9620 commented Aug 23, 2024

@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)

function! lsp_settings#root_path(patterns) abort
let l:patterns = extend(copy(a:patterns), g:lsp_settings_root_markers)
return lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), l:patterns)
endfunction

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

\ 'allowlist': lsp_settings#get('angular-language-server', 'allowlist', {x-> empty(lsp_settings#root_path(['angular.json'])) ? [] : ['html']}),

@elct9620
Copy link
Author

elct9620 commented Jan 6, 2025

@mattn Any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants