Fix luac highlighting.
This commit is contained in:
parent
544d616acf
commit
802ccf53ab
@ -32,7 +32,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist)
|
||||
let buf = bufnr('')
|
||||
let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf')
|
||||
for item in issues
|
||||
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||
let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||
|
||||
" The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is
|
||||
" used to override default highlighting.
|
||||
|
@ -16,24 +16,27 @@ endif
|
||||
let g:loaded_syntastic_lua_luac_checker=1
|
||||
|
||||
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||
let near = matchstr(a:pos['text'], "\\mnear '[^']\\+'")
|
||||
let result = ''
|
||||
let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''')
|
||||
if len(near) > 0
|
||||
let near = split(near, "'")[1]
|
||||
if near == '<eof>'
|
||||
let p = getpos('$')
|
||||
let a:pos['lnum'] = p[1]
|
||||
let a:pos['col'] = p[2]
|
||||
let result = '\%'.p[2].'c'
|
||||
let result = '\%' . p[2] . 'c'
|
||||
else
|
||||
let result = '\V'.near
|
||||
endif
|
||||
let open = matchstr(a:pos['text'], "\\m(to close '[^']\\+' at line [0-9]\\+)")
|
||||
if len(open) > 0
|
||||
let oline = split(open, "'")[1:2]
|
||||
let line = 0+strpart(oline[1], 9)
|
||||
call matchadd('SpellCap', '\%'.line.'l\V'.oline[0])
|
||||
let result = '\V' . near
|
||||
endif
|
||||
|
||||
" XXX the following piece of code is evil, and is likely to break
|
||||
" in future versions of syntastic; enable it at your own risk :)
|
||||
|
||||
"let open = matchstr(a:pos['text'], '\m(to close ''\zs[^'']\+\ze'' at line [0-9]\+)')
|
||||
"if len(open) > 0
|
||||
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
||||
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||
" call matchadd(group, '\%' . line . 'l\V' . open)
|
||||
"endif
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user