mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 01:07:06 +08:00
Add support for dart format fixer (#3764)
This commit is contained in:
@@ -381,6 +381,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dartfmt.',
|
||||
\ },
|
||||
\ 'dart-format': {
|
||||
\ 'function': 'ale#fixers#dart_format#Fix',
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dart format.',
|
||||
\ },
|
||||
\ 'xmllint': {
|
||||
\ 'function': 'ale#fixers#xmllint#Fix',
|
||||
\ 'suggested_filetypes': ['xml'],
|
||||
|
||||
18
autoload/ale/fixers/dart_format.vim
Normal file
18
autoload/ale/fixers/dart_format.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: ghsang <gwonhyuksang@gmail.com>
|
||||
" Description: Integration of dart format with ALE.
|
||||
|
||||
call ale#Set('dart_format_executable', 'dart')
|
||||
call ale#Set('dart_format_options', '')
|
||||
|
||||
function! ale#fixers#dart_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'dart_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'dart_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user