summaryrefslogtreecommitdiff
path: root/ale_linters/nim
diff options
context:
space:
mode:
authortamago324 <tamago_pad@yahoo.co.jp>2019-11-07 02:44:56 +0900
committertamago324 <tamago_pad@yahoo.co.jp>2019-11-07 02:44:56 +0900
commitdfbb387cc7c754d75ecd0dede0635e39ce9ff028 (patch)
tree790c5a97ff75472288668170e035f8cc2a9b228b /ale_linters/nim
parent2d9380d75c5c27a3241925d24ab3be8977a43207 (diff)
downloadale-dfbb387cc7c754d75ecd0dede0635e39ce9ff028.zip
Add nimcheck end_col options
nimcheck
Diffstat (limited to 'ale_linters/nim')
-rw-r--r--ale_linters/nim/nimcheck.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/ale_linters/nim/nimcheck.vim b/ale_linters/nim/nimcheck.vim
index b5796dcd..b739ca04 100644
--- a/ale_linters/nim/nimcheck.vim
+++ b/ale_linters/nim/nimcheck.vim
@@ -1,6 +1,15 @@
" Author: Baabelfish
" Description: Typechecking for nim files
+let s:end_col_patterns = [
+\ '\v''([^'']+)'' is declared but not used.*',
+\ '\videntifier expected, but found ''([^'']+)''',
+\ '\vimported and not used: ''([^'']+)''.*',
+\ '\vundeclared identifier: ''([^'']+)''',
+\ '\v''([^'']+)'' cannot be assigned to',
+\ '\vredefinition of ''([^'']+)'';',
+\]
+
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\+\)) \(.\+\)'
@@ -43,6 +52,11 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
let l:item.code = l:code_match[2]
endif
+ " Find position end_col.
+ for l:col_match in ale#util#GetMatches(l:item.text, s:end_col_patterns)
+ let l:item.end_col = l:item.col + len(l:col_match[1]) - 1
+ endfor
+
call add(l:output, l:item)
endfor