mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 21:12:31 +08:00
Added dartfmt fixer (#1683)
* Added dartfmt to Fixers * Added dartfmt specific documentation
This commit is contained in:
@@ -210,6 +210,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['qml'],
|
||||
\ 'description': 'Fix QML files with qmlfmt.',
|
||||
\ },
|
||||
\ 'dartfmt': {
|
||||
\ 'function': 'ale#fixers#dartfmt#Fix',
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dartfmt.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
18
autoload/ale/fixers/dartfmt.vim
Normal file
18
autoload/ale/fixers/dartfmt.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: reisub0 <reisub0@gmail.com>
|
||||
" Description: Integration of dartfmt with ALE.
|
||||
|
||||
call ale#Set('dart_dartfmt_executable', 'dartfmt')
|
||||
call ale#Set('dart_dartfmt_options', '')
|
||||
|
||||
function! ale#fixers#dartfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'dart_dartfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'dart_dartfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -w'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user