escape color sequences

This commit is contained in:
Atsuya Takagi
2021-01-02 16:48:54 +09:00
parent e94d23b1d9
commit 9eb6dace88

View File

@@ -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:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(\w\+\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)'
let l:output = [] let l:output = []
call add(l:output, { for l:line in a:lines
\ 'lnum': 12, " remove color escape sequences since vala-lint doesn't support
\ 'col': 30, " output without colors
\ 'text': 'bad', let l:cleaned_line = substitute(l:line, '\x1b\[[0-9;]*m', '', 'g')
\ 'type': 'E', execute 'echo l:line'
\ 'code': 'testcode', execute 'echo l:cleaned_line'
\}) let l:match = matchlist(l:cleaned, l:pattern)
"for l:line in a:lines if len(l:match) == 0
" let l:match = matchlist(l:line, l:pattern) continue
endif
" if len(l:match) == 0 let l:lnum = l:match[1] + 0
" continue let l:column = l:match[2] + 0
" endif let l:type = 'E'
let l:text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '')
let l:code = l:match[5]
" let l:line = l:match[1] + 0 call add(l:output, {
" let l:column = l:match[2] + 0 \ 'lnum': l:lnum,
" let l:type = 'E' \ 'col': l:column,
" let l:text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '') \ 'text': l:text,
" let l:code = l:match[5] \ 'type': l:type,
\ 'code': l:code,
" call add(l:output, { \})
" \ 'lnum': l:line, endfor
" \ 'col': l:column,
" \ 'text': l:text,
" \ 'type': l:type,
" \ 'code': l:code,
" \})
"endfor
return l:output return l:output
endfunction endfunction