mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Removed syntastic and replaced it with ale
Read more here: https://github.com/w0rp/ale
This commit is contained in:
28
sources_non_forked/ale/ale_linters/sql/sqlint.vim
Normal file
28
sources_non_forked/ale/ale_linters/sql/sqlint.vim
Normal file
@ -0,0 +1,28 @@
|
||||
" Author: Adriaan Zonnenberg <amz@adriaan.xyz>
|
||||
" Description: sqlint for SQL files
|
||||
|
||||
function! ale_linters#sql#sqlint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" stdin:3:1:ERROR syntax error at or near "WIBBLE"
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+):(\u+) (.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:match[3][0],
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sql', {
|
||||
\ 'name': 'sqlint',
|
||||
\ 'executable': 'sqlint',
|
||||
\ 'command': 'sqlint',
|
||||
\ 'callback': 'ale_linters#sql#sqlint#Handle',
|
||||
\})
|
Reference in New Issue
Block a user