Fix imported files path lookup on less#lessc linter

Ale saves a temporary file (%t) which does not share the same path as
the original file, breaking import statements with relative URLs.
This fix sends content to `lessc` over stdin and adds
the current file (%s) as one of the included paths, so statements like
`@import '../utils' will correctly resolve based on the current file path.
This commit is contained in:
Marcus Zanona 2017-11-09 13:45:14 -02:00
parent 7ed82ab712
commit 4bc31fcd18
1 changed files with 3 additions and 3 deletions

View File

@ -4,10 +4,10 @@
call ale#Set('less_lessc_options', '') call ale#Set('less_lessc_options', '')
function! ale_linters#less#lessc#GetCommand(buffer) abort function! ale_linters#less#lessc#GetCommand(buffer) abort
return 'lessc' return 'cat %t | lessc'
\ . ' --no-color --lint' \ . ' --no-color --lint --include-path=' . expand('%:p:h')
\ . ' ' . ale#Var(a:buffer, 'less_lessc_options') \ . ' ' . ale#Var(a:buffer, 'less_lessc_options')
\ . ' %t' \ . ' -'
endfunction endfunction
function! ale_linters#less#lessc#Handle(buffer, lines) abort function! ale_linters#less#lessc#Handle(buffer, lines) abort