mirror of
https://github.com/dense-analysis/ale.git
synced 2026-05-26 02:08:44 +08:00
fix(terraform-ls): return current buffer dir when missing .terraform (#5103)
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
while working in some larger repos, the .terraform dir might be missing for one reason or another, terraform-ls will fail to start and return: ``` Failed to find project root, language server won't start ``` check if tf_dir is empty, if so, just return the dir of the file in buffer.
This commit is contained in:
@@ -25,6 +25,10 @@ endfunction
|
|||||||
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
|
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
|
||||||
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
|
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
|
||||||
|
|
||||||
|
if empty(l:tf_dir)
|
||||||
|
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.')
|
||||||
|
endif
|
||||||
|
|
||||||
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
|
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user