mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -4,15 +4,16 @@
|
||||
call ale#Set('dart_analyze_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[5],
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[4]),
|
||||
\ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
|
||||
\ 'text': l:code . ': ' . l:message,
|
||||
\ 'lnum': str2nr(l:lnum),
|
||||
\ 'col': str2nr(l:col),
|
||||
\})
|
||||
endfor
|
||||
|
||||
@ -22,7 +23,7 @@ endfunction
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dart_analyze',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
|
||||
\ 'command': '%e analyze %s',
|
||||
\ 'command': '%e analyze --fatal-infos %s',
|
||||
\ 'callback': 'ale_linters#dart#dart_analyze#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
@ -1,36 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Check Dart files with dartanalyzer
|
||||
|
||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||
\ 'lnum': str2nr(l:match[4]),
|
||||
\ 'col': str2nr(l:match[5]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dartanalyzer',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_dartanalyzer_executable')},
|
||||
\ 'command': function('ale_linters#dart#dartanalyzer#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
Reference in New Issue
Block a user