summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorJasper Woudenberg <mail@jasperwoudenberg.com>2017-03-01 23:14:30 -0800
committerJasper Woudenberg <mail@jasperwoudenberg.com>2017-03-01 23:27:48 -0800
commit70711022db8c8a5602550601ef275c20b2105bcc (patch)
treecf4241f15b0d696c98f2ccb625b8548901e32e44 /autoload
parent18508f74532f41aa4c66a5e217550f00d150a30d (diff)
downloadale-70711022db8c8a5602550601ef275c20b2105bcc.zip
Add support for error details
Some review needed.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/cursor.vim25
-rw-r--r--autoload/ale/engine.vim4
2 files changed, 29 insertions, 0 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 9aaa8e91..d6594db5 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -93,3 +93,28 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
let s:cursor_timer = timer_start(10, function('ale#cursor#EchoCursorWarning'))
endif
endfunction
+
+
+function! ale#cursor#ShowCursorDetail(...) abort
+ " Only show the details in normal mode, otherwise we will get problems.
+ if mode() !=# 'n'
+ return
+ endif
+
+ let l:buffer = bufnr('%')
+
+ if !has_key(g:ale_buffer_info, l:buffer)
+ return
+ endif
+
+ let l:pos = getcurpos()
+ let l:loclist = g:ale_buffer_info[l:buffer].loclist
+ let l:index = ale#util#BinarySearch(l:loclist, l:pos[1], l:pos[2])
+
+ if l:index >= 0
+ let l:loc = l:loclist[l:index]
+ if has_key(l:loc, 'detail')
+ echo l:loc.detail
+ endif
+ endif
+endfunction
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index bc834083..fdf19db2 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -332,6 +332,10 @@ function! ale#engine#FixLocList(buffer, linter, loclist) abort
\ 'linter_name': a:linter.name,
\}
+ if has_key(l:old_item, 'detail')
+ let l:item.detail = l:old_item.detail
+ endif
+
if l:item.lnum == 0
" When errors appear at line 0, put them at line 1 instead.
let l:item.lnum = 1