Added dartfmt fixer (#1683)

* Added dartfmt to Fixers
* Added dartfmt specific documentation
This commit is contained in:
Govind KP authored and w0rp committed 2018-07-01 13:55:41 +01:00
1 parent 06f61eeeb8
commit 9d98e6db0c
7 files changed
+99 -2

No files matched your search

+5
View File
@@ -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
View 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