diff options
author | Govind KP <reisub0@gmail.com> | 2018-07-01 18:25:41 +0530 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-07-01 13:55:41 +0100 |
commit | 9d98e6db0c5ebc5e7166f7ad9cffb115e9b9fcc5 (patch) | |
tree | 0440e86687d0a3fe88c9fcc4b2cdadee36d9ab96 /autoload | |
parent | 06f61eeeb82f30c0fceea3d1abb231378b445fc3 (diff) | |
download | ale-9d98e6db0c5ebc5e7166f7ad9cffb115e9b9fcc5.zip |
Added dartfmt fixer (#1683)
* Added dartfmt to Fixers
* Added dartfmt specific documentation
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/dartfmt.vim | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 60d7d7a8..539234c0 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -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. diff --git a/autoload/ale/fixers/dartfmt.vim b/autoload/ale/fixers/dartfmt.vim new file mode 100644 index 00000000..0687d6d1 --- /dev/null +++ b/autoload/ale/fixers/dartfmt.vim @@ -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 |