mirror of
https://github.com/dense-analysis/ale.git
synced 2026-05-17 05:49:47 +08:00
Close #5002 - Support getting g:ale_root as a String
CI / Build (push) Has been cancelled
CI / Neovim 0.10 Windows (push) Has been cancelled
CI / Neovim 0.12 Windows (push) Has been cancelled
CI / Vim 8.2 Windows (push) Has been cancelled
CI / Vim 9.2 Windows (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Lua (push) Has been cancelled
CI / Neovim 0.10 Linux (push) Has been cancelled
CI / Neovim 0.12 Linux (push) Has been cancelled
CI / Vim 8.2 Linux (push) Has been cancelled
CI / Vim 9.2 Linux (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Neovim 0.10 Windows (push) Has been cancelled
CI / Neovim 0.12 Windows (push) Has been cancelled
CI / Vim 8.2 Windows (push) Has been cancelled
CI / Vim 9.2 Windows (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Lua (push) Has been cancelled
CI / Neovim 0.10 Linux (push) Has been cancelled
CI / Neovim 0.12 Linux (push) Has been cancelled
CI / Vim 8.2 Linux (push) Has been cancelled
CI / Vim 9.2 Linux (push) Has been cancelled
This commit is contained in:
@@ -320,6 +320,11 @@ function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If the global setting is a string, return that right away.
|
||||||
|
if type(g:ale_root) is v:t_string
|
||||||
|
return g:ale_root
|
||||||
|
endif
|
||||||
|
|
||||||
" Try to get a global setting for the root
|
" Try to get a global setting for the root
|
||||||
if has_key(g:ale_root, a:linter.name)
|
if has_key(g:ale_root, a:linter.name)
|
||||||
let l:Root = g:ale_root[a:linter.name]
|
let l:Root = g:ale_root[a:linter.name]
|
||||||
|
|||||||
+2
-4
@@ -2334,10 +2334,8 @@ g:ale_root
|
|||||||
This option is used to determine the project root for a linter. If the value
|
This option is used to determine the project root for a linter. If the value
|
||||||
is a |Dictionary|, it maps a linter to either a |String| containing the
|
is a |Dictionary|, it maps a linter to either a |String| containing the
|
||||||
project root or a |Funcref| to call to look up the root. The |Funcref| is
|
project root or a |Funcref| to call to look up the root. The |Funcref| is
|
||||||
provided the buffer number as its argument.
|
provided the buffer number as its argument. If the the value is a string, it
|
||||||
|
will be interpreted as the project root itself.
|
||||||
The buffer-specific variable may additionally be a string containing the
|
|
||||||
project root itself.
|
|
||||||
|
|
||||||
If neither variable yields a result, a linter-specific function is invoked to
|
If neither variable yields a result, a linter-specific function is invoked to
|
||||||
detect a project root. If this, too, yields no result, and the linter is an
|
detect a project root. If this, too, yields no result, and the linter is an
|
||||||
|
|||||||
@@ -33,11 +33,12 @@ Execute(The project root should be globally configurable):
|
|||||||
|
|
||||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||||
unlet g:ale_root.languageserver
|
unlet g:ale_root.languageserver
|
||||||
" As tracked by <https://github.com/dense-analysis/ale/issues/5002>, there
|
|
||||||
" is a bug with g:ale_root.
|
" Configuring g:ale_root using a String works.
|
||||||
" While attempting to configure g:ale_root using a String might be a quite
|
let g:ale_root = ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||||
" limiting setup, it would be handy for debugging. However the test case is
|
|
||||||
" missing here. It would unfortunately just fail.
|
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||||
|
let g:ale_root = {}
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
Execute(The project root should be per buffer configurable):
|
Execute(The project root should be per buffer configurable):
|
||||||
|
|||||||
@@ -32,8 +32,12 @@ Execute(The project root should be globally configurable):
|
|||||||
|
|
||||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||||
unlet g:ale_root.perlnavigator
|
unlet g:ale_root.perlnavigator
|
||||||
" As tracked by <https://github.com/dense-analysis/ale/issues/5002>, there
|
|
||||||
" is a bug with g:ale_root which is thus missing here.
|
" Configuring g:ale_root using a String works.
|
||||||
|
let g:ale_root = ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||||
|
|
||||||
|
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||||
|
let g:ale_root = {}
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
Execute(The project root should be per buffer configurable):
|
Execute(The project root should be per buffer configurable):
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ Execute(The global variable can be a dictionary):
|
|||||||
|
|
||||||
AssertLSPProject '/some/path'
|
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):
|
Execute(The global variable can have funcrefs):
|
||||||
let g:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'}
|
let g:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'}
|
||||||
call ale#test#SetFilename('other-file.c')
|
call ale#test#SetFilename('other-file.c')
|
||||||
|
|||||||
Reference in New Issue
Block a user