mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
24
sources_non_forked/ale/ale_linters/json/jq.vim
Normal file
24
sources_non_forked/ale/ale_linters/json/jq.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Author: jD91mZM2 <me@krake.one>
|
||||
call ale#Set('json_jq_executable', 'jq')
|
||||
call ale#Set('json_jq_options', '')
|
||||
call ale#Set('json_jq_filters', '.')
|
||||
|
||||
" Matches patterns like the following:
|
||||
" parse error: Expected another key-value pair at line 4, column 3
|
||||
let s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
|
||||
|
||||
function! ale_linters#json#jq#Handle(buffer, lines) abort
|
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> {
|
||||
\ 'text': match[1],
|
||||
\ 'lnum': match[2] + 0,
|
||||
\ 'col': match[3] + 0,
|
||||
\}})
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'jq',
|
||||
\ 'executable': {b -> ale#Var(b, 'json_jq_executable')},
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': '%e',
|
||||
\ 'callback': 'ale_linters#json#jq#Handle',
|
||||
\})
|
14
sources_non_forked/ale/ale_linters/json/spectral.vim
Normal file
14
sources_non_forked/ale/ale_linters/json/spectral.vim
Normal file
@ -0,0 +1,14 @@
|
||||
" Author: t2h5 <https://github.com/t2h5>
|
||||
" Description: Integration of Stoplight Spectral CLI with ALE.
|
||||
|
||||
call ale#Set('json_spectral_executable', 'spectral')
|
||||
call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'spectral',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [
|
||||
\ 'node_modules/.bin/spectral',
|
||||
\ ])},
|
||||
\ 'command': '%e lint --ignore-unknown-format -q -f text %t',
|
||||
\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput'
|
||||
\})
|
Reference in New Issue
Block a user