Fix #469 - Remove Unicode quotes from GCC errors, which cause issues
This commit is contained in:
parent
3345bf20ca
commit
a25b55b954
@ -18,6 +18,14 @@ function! s:IsHeaderFile(filename) abort
|
|||||||
return a:filename =~? '\v\.(h|hpp)$'
|
return a:filename =~? '\v\.(h|hpp)$'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:RemoveUnicodeQuotes(text) abort
|
||||||
|
let l:text = a:text
|
||||||
|
let l:text = substitute(l:text, '[`´‘’]', '''', 'g')
|
||||||
|
let l:text = substitute(l:text, '[“”]', '"', 'g')
|
||||||
|
|
||||||
|
return l:text
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
||||||
let l:include_pattern = '\v^(In file included | *)from ([^:]*):(\d+)'
|
let l:include_pattern = '\v^(In file included | *)from ([^:]*):(\d+)'
|
||||||
let l:include_lnum = 0
|
let l:include_lnum = 0
|
||||||
@ -76,7 +84,7 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[5],
|
\ 'text': s:RemoveUnicodeQuotes(l:match[5]),
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -53,7 +53,7 @@ Execute (HandleGCCFormat should handle the correct lines of output):
|
|||||||
\ 'lnum': 10,
|
\ 'lnum': 10,
|
||||||
\ 'col': 27,
|
\ 'col': 27,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'invalid operands to binary - (have ‘int’ and ‘char *’)',
|
\ 'text': 'invalid operands to binary - (have ''int'' and ''char *'')',
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#handlers#gcc#HandleGCCFormat(42, [
|
\ ale#handlers#gcc#HandleGCCFormat(42, [
|
||||||
@ -61,6 +61,18 @@ Execute (HandleGCCFormat should handle the correct lines of output):
|
|||||||
\ '<stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)',
|
\ '<stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
Execute (HandleGCCFormat should replace Unicode quotes):
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 8,
|
||||||
|
\ 'col': 5,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': "'''' \"\"",
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale#handlers#gcc#HandleGCCFormat(42, ['<stdin>:8:5: warning: `´‘’ “”'])
|
||||||
|
|
||||||
Execute (HandleUnixFormatAsError should handle some example lines of output):
|
Execute (HandleUnixFormatAsError should handle some example lines of output):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
|
@ -12,13 +12,13 @@ Execute(The vint handler should parse error messages correctly):
|
|||||||
\ {
|
\ {
|
||||||
\ 'lnum': 3,
|
\ 'lnum': 3,
|
||||||
\ 'col': 17,
|
\ 'col': 17,
|
||||||
\ 'text': 'Use robust operators `==#` or `==?` instead of `==` (see Google VimScript Style Guide (Matching))',
|
\ 'text': 'Use robust operators ''==#'' or ''==?'' instead of ''=='' (see Google VimScript Style Guide (Matching))',
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 3,
|
\ 'lnum': 3,
|
||||||
\ 'col': 8,
|
\ 'col': 8,
|
||||||
\ 'text': 'Make the scope explicit like `l:filename` (see Anti-pattern of vimrc (Scope of identifier))',
|
\ 'text': 'Make the scope explicit like ''l:filename'' (see Anti-pattern of vimrc (Scope of identifier))',
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
|
Loading…
Reference in New Issue
Block a user