All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp>
2 " Description: jsonnetfmt for jsonnet files
4 call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt')
5 call ale#Set('jsonnet_jsonnetfmt_options', '')
7 function! ale_linters#jsonnet#jsonnetfmt#GetCommand(buffer) abort
8 let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options')
11 \ . ale#Pad(l:options)
16 function! ale_linters#jsonnet#jsonnetfmt#Handle(buffer, lines) abort
17 " Matches patterns line the following:
19 " STATIC ERROR: foo.jsonnet:22:3-12: expected token OPERATOR but got (IDENTIFIER, "bar")
20 " STATIC ERROR: hoge.jsonnet:20:3: unexpected: "}" while parsing terminal
21 let l:pattern = '^STATIC ERROR:[^:]*:\(\d\+\):\(\d\+\):*\(-\d\+\)* \(.*\)'
25 let l:match = matchlist(l:line, l:pattern)
31 " vcol is Needed to indicate that the column is a character.
34 \ 'lnum': l:match[1] + 0,
36 \ 'col': l:match[2] + 0,
46 call ale#linter#Define('jsonnet', {
47 \ 'name': 'jsonnetfmt',
48 \ 'output_stream': 'stderr',
49 \ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnetfmt_executable')},
50 \ 'command': function('ale_linters#jsonnet#jsonnetfmt#GetCommand'),
51 \ 'callback': 'ale_linters#jsonnet#jsonnetfmt#Handle',