Files
ale/test/lsp/test_lsp_root_detection.vader
T
w0rp 7b5b854fc4
CI / Build (push) Waiting to run
CI / Lint (push) Blocked by required conditions
CI / Lua (push) Blocked by required conditions
CI / Neovim 0.10 Linux (push) Blocked by required conditions
CI / Neovim 0.12 Linux (push) Blocked by required conditions
CI / Vim 8.2 Linux (push) Blocked by required conditions
CI / Vim 9.2 Linux (push) Blocked by required conditions
CI / Neovim 0.10 Windows (push) Waiting to run
CI / Neovim 0.12 Windows (push) Waiting to run
CI / Vim 8.2 Windows (push) Waiting to run
CI / Vim 9.2 Windows (push) Waiting to run
Close #5002 - Support getting g:ale_root as a String
2026-05-15 21:06:54 +01:00

74 lines
2.1 KiB
Plaintext

Before:
Save g:ale_root
Save b:ale_root
let g:ale_root = {}
call ale#assert#SetUpLinterTest('c', 'clangd')
function! Hook1(buffer)
return 'abc123'
endfunction
After:
Restore
delfunction Hook1
call ale#assert#TearDownLinterTest()
Execute(The buffer-specific variable can be a string):
let b:ale_root = '/some/path'
call ale#test#SetFilename('other-file.c')
AssertLSPProject '/some/path'
Execute(The buffer-specific variable can be a dictionary):
let b:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'}
call ale#test#SetFilename('other-file.c')
AssertLSPProject '/some/path'
Execute(The buffer-specific variable can have funcrefs):
let b:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'}
call ale#test#SetFilename('other-file.c')
AssertLSPProject 'abc123'
Execute(The global variable can be a dictionary):
let g:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'}
call ale#test#SetFilename('other-file.c')
AssertLSPProject '/some/path'
Execute(The global variable can be a string):
let g:ale_root = '/some/path'
call ale#test#SetFilename('other-file.c')
AssertLSPProject '/some/path'
Execute(The global variable can have funcrefs):
let g:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'}
call ale#test#SetFilename('other-file.c')
AssertLSPProject 'abc123'
Execute(The buffer-specific variable overrides the global variable):
let b:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'}
let g:ale_root = {'clangd': '/not/this/path', 'golangserver': '/elsewhere'}
call ale#test#SetFilename('other-file.c')
AssertLSPProject '/some/path'
Execute(The global variable is queried if the buffer-specific has no value):
let b:ale_root = {'golangserver': '/other/path'}
let g:ale_root = {'clangd': '/some/path', 'golangserver': '/elsewhere'}
call ale#test#SetFilename('other-file.c')
AssertLSPProject '/some/path'
Execute(No path should be returned by default):
call ale#test#SetFilename(tempname() . '/other-file.c')
AssertLSPProject ''