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

Fix 4155 - Show error when project root not found #4207

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion autoload/ale/lsp_linter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ function! s:HandleLSPErrorMessage(linter_name, response) abort
return
endif

call ale#lsp_linter#AddErrorMessage(a:linter_name, l:message)
endfunction

function! ale#lsp_linter#AddErrorMessage(linter_name, message) abort
" This global variable is set here so we don't load the debugging.vim file
" until someone uses :ALEInfo.
let g:ale_lsp_error_messages = get(g:, 'ale_lsp_error_messages', {})
Expand All @@ -149,7 +153,7 @@ function! s:HandleLSPErrorMessage(linter_name, response) abort
let g:ale_lsp_error_messages[a:linter_name] = []
endif

call add(g:ale_lsp_error_messages[a:linter_name], l:message)
call add(g:ale_lsp_error_messages[a:linter_name], a:message)
endfunction

function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
Expand Down Expand Up @@ -430,6 +434,8 @@ function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
if empty(l:root) && a:linter.lsp isnot# 'tsserver'
" If there's no project root, then we can't check files with LSP,
" unless we are using tsserver, which doesn't use project roots.
call ale#lsp_linter#AddErrorMessage(a:linter.name, "Failed to find project root, language server wont't start.")

return 0
endif

Expand Down