diff options
-rw-r--r-- | autoload/ale/lsp_linter.vim | 16 | ||||
-rw-r--r-- | autoload/ale/uri/jdt.vim | 8 | ||||
-rw-r--r-- | test/lsp/test_lsp_client_messages.vader | 14 | ||||
-rw-r--r-- | test/lsp/test_lsp_root_detection.vader | 23 |
4 files changed, 14 insertions, 47 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim index a3c8b24a..2507e400 100644 --- a/autoload/ale/lsp_linter.vim +++ b/autoload/ale/lsp_linter.vim @@ -261,11 +261,7 @@ function! ale#lsp_linter#GetConfig(buffer, linter) abort endfunction function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort - let l:buffer_ale_root = getbufvar( - \ a:buffer, - \ 'ale_root', - \ getbufvar(a:buffer, 'ale_lsp_root', {}) - \) + let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {}) if type(l:buffer_ale_root) is v:t_string return l:buffer_ale_root @@ -282,15 +278,9 @@ function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort endif endif - let l:global_root = g:ale_root - - if empty(g:ale_root) && exists('g:ale_lsp_root') - let l:global_root = g:ale_lsp_root - endif - " Try to get a global setting for the root - if has_key(l:global_root, a:linter.name) - let l:Root = l:global_root[a:linter.name] + if has_key(g:ale_root, a:linter.name) + let l:Root = g:ale_root[a:linter.name] if type(l:Root) is v:t_func return l:Root(a:buffer) diff --git a/autoload/ale/uri/jdt.vim b/autoload/ale/uri/jdt.vim index 11a22d34..7df10b4e 100644 --- a/autoload/ale/uri/jdt.vim +++ b/autoload/ale/uri/jdt.vim @@ -21,11 +21,11 @@ function! s:OpenJDTLink(root, uri, line, column, options, result) abort call ale#util#Open(a:uri, a:line, a:column, a:options) autocmd AleURISchemes BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('<amatch>')) - if !empty(getbufvar(bufnr(''), 'ale_lsp_root', '')) + if !empty(getbufvar(bufnr(''), 'ale_root', '')) return endif - let b:ale_lsp_root = a:root + let b:ale_root = a:root set filetype=java call setline(1, split(l:contents, '\n')) @@ -83,7 +83,7 @@ endfunction " Read jdt:// contents, as part of current project, into current buffer. function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort - if !empty(getbufvar(bufnr(''), 'ale_lsp_root', '')) + if !empty(getbufvar(bufnr(''), 'ale_root', '')) return endif @@ -100,7 +100,7 @@ function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort endif let l:uri = a:encoded_uri - let b:ale_lsp_root = l:root + let b:ale_root = l:root set filetype=java call ale#lsp_linter#SendRequest( diff --git a/test/lsp/test_lsp_client_messages.vader b/test/lsp/test_lsp_client_messages.vader index 077a4c91..3af67393 100644 --- a/test/lsp/test_lsp_client_messages.vader +++ b/test/lsp/test_lsp_client_messages.vader @@ -32,12 +32,12 @@ Execute(ale#lsp#message#Exit() should return correct messages): AssertEqual [1, 'exit'], ale#lsp#message#Exit(), Given typescript(A TypeScript file with 3 lines): - foo() - bar() - baz() + Foo() + Bar() + Baz() Execute(ale#util#GetBufferContents() should return correctly formatted newlines): - AssertEqual "foo()\nbar()\nbaz()\n", ale#util#GetBufferContents(bufnr('')) + AssertEqual "Foo()\nBar()\nBaz()\n", ale#util#GetBufferContents(bufnr('')) Execute(ale#lsp#message#DidOpen() should return correct messages): let g:ale_lsp_next_version_id = 12 @@ -50,7 +50,7 @@ Execute(ale#lsp#message#DidOpen() should return correct messages): \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), \ 'languageId': 'typescript', \ 'version': 12, - \ 'text': "foo()\nbar()\nbaz()\n", + \ 'text': "Foo()\nBar()\nBaz()\n", \ }, \ } \ ], @@ -68,7 +68,7 @@ Execute(ale#lsp#message#DidChange() should return correct messages): \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), \ 'version': 34, \ }, - \ 'contentChanges': [{'text': "foo()\nbar()\nbaz()\n"}], + \ 'contentChanges': [{'text': "Foo()\nBar()\nBaz()\n"}], \ } \ ], \ ale#lsp#message#DidChange(bufnr('')) @@ -281,7 +281,7 @@ Execute(ale#lsp#tsserver_message#Change() should return correct messages): \ 'offset': 1, \ 'endLine': 1073741824, \ 'endOffset': 1, - \ 'insertString': "foo()\nbar()\nbaz()\n", + \ 'insertString': "Foo()\nBar()\nBaz()\n", \ } \ ], \ ale#lsp#tsserver_message#Change(bufnr('')) diff --git a/test/lsp/test_lsp_root_detection.vader b/test/lsp/test_lsp_root_detection.vader index 291300f0..2aead6ba 100644 --- a/test/lsp/test_lsp_root_detection.vader +++ b/test/lsp/test_lsp_root_detection.vader @@ -1,10 +1,7 @@ Before: - Save g:ale_lsp_root Save g:ale_root - Save b:ale_lsp_root Save b:ale_root - unlet! g:ale_lsp_root let g:ale_root = {} call ale#assert#SetUpLinterTest('c', 'clangd') @@ -38,12 +35,6 @@ Execute(The buffer-specific variable can have funcrefs): AssertLSPProject 'abc123' -Execute(The buffer-specific variable can be the old ale_lsp_root setting): - let b:ale_lsp_root = '/some/path' - call ale#test#SetFilename('other-file.c') - - AssertLSPProject '/some/path' - 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') @@ -70,20 +61,6 @@ Execute(The global variable is queried if the buffer-specific has no value): AssertLSPProject '/some/path' -Execute(The global variable can be the old ale_lsp_root setting): - let g:ale_root = {} - let g:ale_lsp_root = {'clangd': '/some/path', 'golangserver': '/other/path'} - call ale#test#SetFilename('other-file.c') - - AssertLSPProject '/some/path' - -Execute(A non-empty ale_root setting should replace the old ale_lsp_root): - let g:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'} - let g:ale_lsp_root = {'clangd': '/xxx', 'golangserver': '/xxx'} - 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') |