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 " Author: Trevor Whitney <trevorjwhitney@gmail.com>
2 " Description: jsonnet-lint for jsonnet files
4 call ale#Set('jsonnet_jsonnet_lint_executable', 'jsonnet-lint')
5 call ale#Set('jsonnet_jsonnet_lint_options', '')
7 function! ale_linters#jsonnet#jsonnet_lint#GetCommand(buffer) abort
8 let l:options = ale#Var(a:buffer, 'jsonnet_jsonnet_lint_options')
11 \ . ale#Pad(l:options)
16 function! ale_linters#jsonnet#jsonnet_lint#Handle(buffer, lines) abort
17 " Matches patterns line the following:
19 " ERROR: foo.jsonnet:22:3-12 expected token OPERATOR but got (IDENTIFIER, "bar")
20 " ERROR: hoge.jsonnet:20:3 unexpected: "}" while parsing terminal
21 " ERROR: main.jsonnet:212:1-14 Expected , or ; but got (IDENTIFIER, "older_cluster")
22 let l:pattern = '^ERROR: [^:]*:\(\d\+\):\(\d\+\)\(-\d\+\)* \(.*\)'
26 let l:match = matchlist(l:line, l:pattern)
32 let line_number = l:match[1] + 0
33 let column = l:match[2] + 0
34 " l:match[3] has optional -14, when linter is showing a range
38 " vcol is Needed to indicate that the column is a character.
41 \ 'lnum': line_number,
53 call ale#linter#Define('jsonnet', {
54 \ 'name': 'jsonnet_lint',
55 \ 'output_stream': 'stderr',
56 \ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnet_lint_executable')},
57 \ 'command': function('ale_linters#jsonnet#jsonnet_lint#GetCommand'),
58 \ 'callback': 'ale_linters#jsonnet#jsonnet_lint#Handle',