summaryrefslogtreecommitdiff
path: root/ale_linters/vala/vala_lint.vim
diff options
context:
space:
mode:
authorAtsuya Takagi <asoftonight@gmail.com>2021-01-02 16:48:54 +0900
committerAtsuya Takagi <asoftonight@gmail.com>2021-01-23 00:08:01 +0900
commit9eb6dace889174c61fbaa13ed3c59d91172b5c60 (patch)
treec6fd24b4ca56609d496aa6873c590f9753138781 /ale_linters/vala/vala_lint.vim
parente94d23b1d906df77453f111f7e7984385c20eaa2 (diff)
downloadale-9eb6dace889174c61fbaa13ed3c59d91172b5c60.zip
escape color sequences
Diffstat (limited to 'ale_linters/vala/vala_lint.vim')
-rw-r--r--ale_linters/vala/vala_lint.vim55
1 files changed, 26 insertions, 29 deletions
diff --git a/ale_linters/vala/vala_lint.vim b/ale_linters/vala/vala_lint.vim
index 5b512ad0..f102d567 100644
--- a/ale_linters/vala/vala_lint.vim
+++ b/ale_linters/vala/vala_lint.vim
@@ -9,35 +9,32 @@ function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort
let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(\w\+\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)'
let l:output = []
- call add(l:output, {
- \ 'lnum': 12,
- \ 'col': 30,
- \ 'text': 'bad',
- \ 'type': 'E',
- \ 'code': 'testcode',
- \})
-
- "for l:line in a:lines
- " let l:match = matchlist(l:line, l:pattern)
-
- " if len(l:match) == 0
- " continue
- " endif
-
- " let l:line = l:match[1] + 0
- " let l:column = l:match[2] + 0
- " let l:type = 'E'
- " let l:text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '')
- " let l:code = l:match[5]
-
- " call add(l:output, {
- " \ 'lnum': l:line,
- " \ 'col': l:column,
- " \ 'text': l:text,
- " \ 'type': l:type,
- " \ 'code': l:code,
- " \})
- "endfor
+ for l:line in a:lines
+ " remove color escape sequences since vala-lint doesn't support
+ " output without colors
+ let l:cleaned_line = substitute(l:line, '\x1b\[[0-9;]*m', '', 'g')
+ execute 'echo l:line'
+ execute 'echo l:cleaned_line'
+ let l:match = matchlist(l:cleaned, l:pattern)
+
+ if len(l:match) == 0
+ continue
+ endif
+
+ let l:lnum = l:match[1] + 0
+ let l:column = l:match[2] + 0
+ let l:type = 'E'
+ let l:text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '')
+ let l:code = l:match[5]
+
+ call add(l:output, {
+ \ 'lnum': l:lnum,
+ \ 'col': l:column,
+ \ 'text': l:text,
+ \ 'type': l:type,
+ \ 'code': l:code,
+ \})
+ endfor
return l:output
endfunction