summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorHoracio Sanson <horacio@allm.net>2019-05-22 10:30:24 +0900
committerHoracio Sanson <horacio@allm.net>2019-05-22 10:30:24 +0900
commitb41836130c9977317ba3f3ebc61daf05fc34f0da (patch)
tree72c1de271d31a3780e7c6b1b7c422bf8c4537f44 /autoload
parent67d49c75a819aa4e7ded97785a1014ba18f06e5d (diff)
downloadale-b41836130c9977317ba3f3ebc61daf05fc34f0da.zip
Fix HandleLSPDiagnostics buffer match logic.
To find the buffer corresponding to URIs reported by LSP the HandleLSPDiagnostics() method uses the built-in bufnr() function. From the documentation we learn that the first parameter of bufnr() is an expression, not a path. EclipseLSP will report project wide errors (e.g. gradle errors) that are not related to any actual source file with an URI that corresponds to the project root folder, e.g: file:///home/username/Projects/gradle-simple This URI will match any open buffer of files within the project root hiearchy, thus project-wide errors appear as part of every file within the project, e.g: file:///home/username/Projects/gradle-simple/src/main/java/Hello.java To fix this, this MR adds '^' to the beginning and '$' at the end of the URI path to force an exact match. This is how is recommended in vim help (see :h bufname).
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/lsp_linter.vim2
1 files changed, 1 insertions, 1 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim
index f70042dd..13471ab7 100644
--- a/autoload/ale/lsp_linter.vim
+++ b/autoload/ale/lsp_linter.vim
@@ -31,7 +31,7 @@ endfunction
function! s:HandleLSPDiagnostics(conn_id, response) abort
let l:linter_name = s:lsp_linter_map[a:conn_id]
let l:filename = ale#path#FromURI(a:response.params.uri)
- let l:buffer = bufnr(l:filename)
+ let l:buffer = bufnr('^' . l:filename . '$')
let l:info = get(g:ale_buffer_info, l:buffer, {})
if empty(l:info)