From d18511f322a5b92c9ad8d075eeb7345b5b0cbd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Linse?= Date: Sun, 25 Nov 2018 10:52:05 +0100 Subject: [PATCH 1/2] Don't hardcode the namespace id for virtual text This makes collisions with other plugins less likely. --- autoload/ale/virtualtext.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/ale/virtualtext.vim b/autoload/ale/virtualtext.vim index a2f88a3a..2788f374 100644 --- a/autoload/ale/virtualtext.vim +++ b/autoload/ale/virtualtext.vim @@ -7,6 +7,9 @@ scriptencoding utf-8 let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10) let s:cursor_timer = -1 let s:last_pos = [0, 0, 0] +if has('nvim-0.3.2') + let s:ns_id = nvim_create_namespace('ale') +endif if !hlexists('ALEVirtualTextError') highlight link ALEVirtualTextError ALEError @@ -35,7 +38,7 @@ function! ale#virtualtext#Clear() abort let l:buffer = bufnr('') - call nvim_buf_clear_highlight(l:buffer, 1000, 0, -1) + call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1) endfunction function! ale#virtualtext#ShowMessage(message, hl_group) abort @@ -48,7 +51,7 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort let l:buffer = bufnr('') let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ') - call nvim_buf_set_virtual_text(l:buffer, 1000, l:line-1, [[l:prefix.a:message, a:hl_group]], {}) + call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {}) endfunction function! s:StopCursorTimer() abort From 6746cb333332d309232a884261fe3229fdc24e44 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 25 Nov 2018 13:57:13 +0000 Subject: [PATCH 2/2] Fixing linter problems --- autoload/ale/virtualtext.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/ale/virtualtext.vim b/autoload/ale/virtualtext.vim index 2788f374..c4ce37dd 100644 --- a/autoload/ale/virtualtext.vim +++ b/autoload/ale/virtualtext.vim @@ -7,8 +7,9 @@ scriptencoding utf-8 let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10) let s:cursor_timer = -1 let s:last_pos = [0, 0, 0] + if has('nvim-0.3.2') - let s:ns_id = nvim_create_namespace('ale') + let s:ns_id = nvim_create_namespace('ale') endif if !hlexists('ALEVirtualTextError')