summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/engine.vim6
-rw-r--r--autoload/ale/sign.vim4
-rw-r--r--plugin/ale.vim4
-rw-r--r--test/test_cursor_warnings.vader49
4 files changed, 55 insertions, 8 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index fdf19db2..0707aa40 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -268,6 +268,12 @@ function! ale#engine#SetResults(buffer, loclist) abort
if g:ale_set_highlights
call ale#highlight#SetHighlights(a:buffer, a:loclist)
endif
+
+ if g:ale_echo_cursor
+ " Try and echo the warning now.
+ " This will only do something meaningful if we're in normal mode.
+ call ale#cursor#EchoCursorWarning()
+ endif
endfunction
function! s:SetExitCode(job, exit_code) abort
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim
index 9d613480..e95de58f 100644
--- a/autoload/ale/sign.vim
+++ b/autoload/ale/sign.vim
@@ -35,7 +35,9 @@ function! ale#sign#ParseSigns(line_list) abort
" строка=1 id=1000001 имя=ALEErrorSign
" 行=1 識別子=1000001 名前=ALEWarningSign
" línea=12 id=1000001 nombre=ALEWarningSign
- let l:pattern = '^.*=\d*\s\+.*=\(\d\+\)\s\+.*=ALE\(Warning\|Error\|Dummy\)Sign'
+ " riga=1 id=1000001, nome=ALEWarningSign
+ let l:pattern = '^.*=\d*\s\+.*=\(\d\+\)\,\?\s\+.*=ALE\(Warning\|Error\|Dummy\)Sign'
+
let l:id_list = []
diff --git a/plugin/ale.vim b/plugin/ale.vim
index a3a407c4..e69aba18 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -166,6 +166,10 @@ function! s:ALEInitAuGroups() abort
autocmd!
if g:ale_enabled && g:ale_echo_cursor
autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay()
+ " Look for a warning to echo as soon as we leave Insert mode.
+ " The script's position variable used when moving the cursor will
+ " not be changed here.
+ autocmd InsertLeave * call ale#cursor#EchoCursorWarning()
endif
augroup END
diff --git a/test/test_cursor_warnings.vader b/test/test_cursor_warnings.vader
index 136e6abc..75d6c975 100644
--- a/test/test_cursor_warnings.vader
+++ b/test/test_cursor_warnings.vader
@@ -37,7 +37,16 @@ Before:
\ },
\}
+ " Turn off other features, we only care about this one feature in this test.
+ let g:ale_set_loclist = 0
+ let g:ale_set_signs = 0
+ let g:ale_set_highlights = 0
+
After:
+ let g:ale_set_loclist = 1
+ let g:ale_set_signs = 1
+ let g:ale_set_highlights = 1
+
unlet! g:output
unlet! g:lines
let g:ale_buffer_info = {}
@@ -52,7 +61,7 @@ Execute(Evaluate the cursor function at line 1):
Then(Check the cursor output):
redir => g:output
- :mess
+ silent mess
redir END
let g:lines = split(g:output, "\n")
@@ -65,7 +74,7 @@ Execute(Evaluate the cursor function at line 2):
Then(Check the cursor output):
redir => g:output
- :mess
+ silent mess
redir END
let g:lines = split(g:output, "\n")
@@ -79,13 +88,43 @@ Execute(Evaluate the cursor function later in line 2):
Then(Check the cursor output):
redir => g:output
- :mess
+ silent mess
redir END
let g:lines = split(g:output, "\n")
AssertEqual 'Missing radix parameter (radix)', g:lines[-1]
+Execute(Set results for a lint cycle, with the cursor on line 1):
+ :1
+ call ale#engine#SetResults(
+ \ bufnr('%'),
+ \ g:ale_buffer_info[bufnr('%')].loclist,
+ \)
+
+Then(Check the cursor output):
+ redir => g:output
+ silent mess
+ redir END
+
+ let g:lines = split(g:output, "\n")
+
+ AssertEqual 'Missing semicolon. (semi)', g:lines[-1]
+
+Execute(Simulate leaving insert mode on line 2):
+ :2
+ normal 16h
+ doautocmd InsertLeave
+
+Then(Check the cursor output):
+ redir => g:output
+ silent mess
+ redir END
+
+ let g:lines = split(g:output, "\n")
+
+ AssertEqual 'Infix operators must be spaced. (space-infix-ops)', g:lines[-1]
+
Execute(Evaluate the cursor detail function at line 1):
:1
call ale#cursor#ShowCursorDetail()
@@ -95,8 +134,6 @@ Then(Check the cursor output):
:mess
redir END
- let g:lines = split(g:output, "\n")
-
AssertEqual "Every statement should end with a semicolon", g:lines[-1]
Execute(Evaluate the cursor detail function at line 2):
@@ -108,6 +145,4 @@ Then(Check the cursor output):
:mess
redir END
- let g:lines = split(g:output, "\n")
-
AssertEqual "Infix operators must be spaced. (space-infix-ops)", g:lines[-1]