mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-30 08:04:31 +08:00
Prefer ale_root setting for project roots
This commit is contained in:
@@ -407,7 +407,7 @@ Execute(PreProcess should allow the `project_root` to be set as a String):
|
||||
\ 'project_root': '/foo/bar',
|
||||
\})
|
||||
|
||||
AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
|
||||
AssertEqual '/foo/bar', ale#linter#GetRoot(0, g:linter)
|
||||
|
||||
Execute(PreProcess should `project_root` be set as a Function):
|
||||
let g:linter = ale#linter#PreProcess('testft', {
|
||||
@@ -418,7 +418,7 @@ Execute(PreProcess should `project_root` be set as a Function):
|
||||
\ 'project_root': {-> '/foo/bar'},
|
||||
\})
|
||||
|
||||
AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
|
||||
AssertEqual '/foo/bar', ale#linter#GetRoot(0, g:linter)
|
||||
|
||||
Execute(PreProcess should complain when `project_root` is invalid):
|
||||
AssertThrows call ale#linter#PreProcess('testft', {
|
||||
|
||||
27
test/test_python_root_option.vader
Normal file
27
test/test_python_root_option.vader
Normal file
@@ -0,0 +1,27 @@
|
||||
Before:
|
||||
Save g:ale_root
|
||||
Save b:ale_root
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The global setting is used as the project root):
|
||||
let g:ale_root = '/foo/python'
|
||||
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual '/foo/python', ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The buffer setting overrides the global setting):
|
||||
let g:ale_root = '/foo/python'
|
||||
let b:ale_root = '/bar/python'
|
||||
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual '/bar/python', ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Fallback to searching when no setting is used):
|
||||
unlet! g:ale_root
|
||||
unlet! b:ale_root
|
||||
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual \
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
Reference in New Issue
Block a user