mirror of
https://github.com/dense-analysis/ale.git
synced 2026-04-12 19:04:34 +08:00
fix(terraform-ls): return current buffer dir when missing .terraform (#5103)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--lua-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--lua-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
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
|
||||
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') : ''
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user