summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-09-05 21:46:39 +0100
committerw0rp <devw0rp@gmail.com>2020-09-05 21:46:39 +0100
commit5bc49d204782617e01da65d83c0d9700a1b0a72f (patch)
tree4b9ba33d3a9788b92e1491a8c559dc6b5a4927b9 /autoload
parent152b2cb6910d9173d75a195c5a185b7f3f8aa696 (diff)
downloadale-5bc49d204782617e01da65d83c0d9700a1b0a72f.zip
Fix #3183 - Escape filename characters from LSP/tsserver
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/lsp_linter.vim12
1 files changed, 10 insertions, 2 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim
index db640654..dcd76e8f 100644
--- a/autoload/ale/lsp_linter.vim
+++ b/autoload/ale/lsp_linter.vim
@@ -34,7 +34,11 @@ 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:escaped_name = escape(
+ \ fnameescape(l:filename),
+ \ has('win32') ? '^' : '^,}]'
+ \)
+ let l:buffer = bufnr('^' . l:escaped_name . '$')
let l:info = get(g:ale_buffer_info, l:buffer, {})
if empty(l:info)
@@ -52,7 +56,11 @@ endfunction
function! s:HandleTSServerDiagnostics(response, error_type) abort
let l:linter_name = 'tsserver'
- let l:buffer = bufnr('^' . a:response.body.file . '$')
+ let l:escaped_name = escape(
+ \ fnameescape(a:response.body.file),
+ \ has('win32') ? '^' : '^,}]'
+ \)
+ let l:buffer = bufnr('^' . l:escaped_name . '$')
let l:info = get(g:ale_buffer_info, l:buffer, {})
if empty(l:info)