mirror of
https://github.com/dense-analysis/ale
synced 2025-01-02 20:12:04 +00:00
Add support for linting less files with lessc
This commit is contained in:
parent
8ef8a35462
commit
732d8e3ed6
@ -109,6 +109,7 @@ formatting.
|
||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) |
|
||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
|
||||
| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
| Less | [lessc](https://www.npmjs.com/package/less) |
|
||||
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
||||
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
||||
| Mail | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
|
36
ale_linters/less/lessc.vim
Executable file
36
ale_linters/less/lessc.vim
Executable file
@ -0,0 +1,36 @@
|
||||
" Author: zanona <https://github.com/zanona>, w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking Less code with lessc.
|
||||
|
||||
call ale#Set('less_lessc_options', '')
|
||||
|
||||
function! ale_linters#less#lessc#GetCommand(buffer) abort
|
||||
return 'lessc'
|
||||
\ . ' --no-color --lint '
|
||||
\ . ale#Var(a:buffer, 'less_lessc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#lessc#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
let l:pattern = '^\(\w\+\): \(.\{-}\) in \(.\{-}\) on line \(\d\+\), column \(\d\+\):$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'col': l:match[5] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'lessc',
|
||||
\ 'executable': 'lessc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command_callback': 'ale_linters#less#lessc#GetCommand',
|
||||
\ 'callback': 'ale_linters#less#lessc#Handle',
|
||||
\})
|
@ -2,6 +2,17 @@
|
||||
ALE Less Integration *ale-less-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
lessc *ale-less-lessc*
|
||||
|
||||
g:ale_less_lessc_options *g:ale_less_lessc_options*
|
||||
*b:ale_less_lessc_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to lessc.
|
||||
|
||||
|
||||
===============================================================================
|
||||
prettier *ale-less-prettier*
|
||||
|
||||
|
@ -105,6 +105,7 @@ CONTENTS *ale-contents*
|
||||
latex.................................|ale-latex-options|
|
||||
write-good..........................|ale-latex-write-good|
|
||||
less..................................|ale-less-options|
|
||||
lessc...............................|ale-less-lessc-options|
|
||||
prettier............................|ale-less-prettier|
|
||||
llvm..................................|ale-llvm-options|
|
||||
llc.................................|ale-llvm-llc|
|
||||
@ -293,6 +294,7 @@ Notes:
|
||||
* JSON: `jsonlint`, `prettier`
|
||||
* Kotlin: `kotlinc`, `ktlint`
|
||||
* LaTeX (tex): `chktex`, `lacheck`, `proselint`, `write-good`
|
||||
* Less: `lessc`
|
||||
* LLVM: `llc`
|
||||
* Lua: `luacheck`
|
||||
* Mail: `proselint`, `vale`
|
||||
|
Loading…
Reference in New Issue
Block a user