summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorbaabelfish <baabelfish@users.noreply.github.com>2017-03-22 11:11:32 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-03-22 09:11:32 +0000
commit9f3cdf827025cd02084209c527757516f8812ae9 (patch)
treecfb78f1f8268f5564cfe98ba5d0cdcb7bb2b80c4 /ale_linters
parent59b5644fb3d893c8146edd5e370f02ab114c09c2 (diff)
downloadale-9f3cdf827025cd02084209c527757516f8812ae9.zip
Fix problems with nim check (#404)
* Fix problems with nim check - Multi file errors are not shown in the same buffer - Fixes parsing of error type that contain ':' * Remove redundant fnameescape
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/nim/nimcheck.vim14
1 files changed, 12 insertions, 2 deletions
diff --git a/ale_linters/nim/nimcheck.vim b/ale_linters/nim/nimcheck.vim
index d3e6853d..0c1373e9 100644
--- a/ale_linters/nim/nimcheck.vim
+++ b/ale_linters/nim/nimcheck.vim
@@ -3,6 +3,7 @@
function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
+ let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t')
let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)'
let l:output = []
@@ -13,13 +14,22 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
continue
endif
- let l:buffer = l:match[1] + 0
+ " Only show errors of the current buffer
+ " NOTE: Checking filename only is OK because nim enforces unique
+ " module names.
+
+ let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t')
+ if l:buffer_filename !=# '' && l:temp_buffer_filename !=# l:buffer_filename
+ continue
+ endif
+
let l:line = l:match[2] + 0
let l:column = l:match[3] + 0
let l:text = l:match[4]
let l:type = 'W'
- let l:textmatch = matchlist(l:match[4], '\(.*\):')
+ " Extract error type from message of type 'Error: Some error message'
+ let l:textmatch = matchlist(l:match[4], '^\(.\{-}\): .\+$')
if len(l:textmatch) > 0
let l:errortype = l:textmatch[1]