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: zanona <https://github.com/zanona>, w0rp <devw0rp@gmail.com>
2 " Description: This file adds support for checking Less code with lessc.
4 call ale#Set('less_lessc_executable', 'lessc')
5 call ale#Set('less_lessc_options', '')
6 call ale#Set('less_lessc_use_global', get(g:, 'ale_use_global_executables', 0))
8 function! ale_linters#less#lessc#GetCommand(buffer) abort
9 return '%e --no-color --lint'
10 \ . ' --include-path=' . ale#Escape(expand('#' . a:buffer . ':p:h'))
11 \ . ale#Pad(ale#Var(a:buffer, 'less_lessc_options'))
15 function! ale_linters#less#lessc#Handle(buffer, lines) abort
16 let l:dir = expand('#' . a:buffer . ':p:h')
17 " Matches patterns like the following:
18 let l:pattern = '^\(\w\+\): \(.\{-}\) in \(.\{-}\) on line \(\d\+\), column \(\d\+\):$'
21 for l:match in ale#util#GetMatches(a:lines, l:pattern)
23 \ 'lnum': l:match[4] + 0,
24 \ 'col': l:match[5] + 0,
29 if l:match[3] isnot# '-'
30 let l:item.filename = ale#path#GetAbsPath(l:dir, l:match[3])
33 call add(l:output, l:item)
39 call ale#linter#Define('less', {
41 \ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [
42 \ 'node_modules/.bin/lessc',
44 \ 'command': function('ale_linters#less#lessc#GetCommand'),
45 \ 'callback': 'ale_linters#less#lessc#Handle',
46 \ 'output_stream': 'stderr',