Created
September 9, 2022 22:19
-
-
Save oalders/179d60173ff178d199f06711729d73e7 to your computer and use it in GitHub Desktop.
perlimports ALE config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Author: Olaf Alders <https://github.com/oalders> | |
" Description: This file adds support for perlimports | |
call ale#Set('perl_perlimports_executable', 'perlimports') | |
function! ale_linters#perl#perlimports#Handle(buffer, lines) abort | |
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)' | |
let l:output = [] | |
for l:match in ale#util#GetMatches(a:lines, l:pattern) | |
call add(l:output, { | |
\ 'lnum': l:match[3], | |
\ 'text': l:match[1], | |
\}) | |
endfor | |
return l:output | |
endfunction | |
call ale#linter#Define('perl', { | |
\ 'name': 'perlimports', | |
\ 'output_stream': 'stderr', | |
\ 'executable': {b -> ale#Var(b, 'perl_perlimports_executable')}, | |
\ 'command': 'perlimports --lint --read-stdin --filename %s', | |
\ 'callback': 'ale_linters#perl#perlimports#Handle', | |
\}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment