summaryrefslogtreecommitdiffstats
path: root/autoload/dart.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-07-06 19:13:39 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-07-06 19:13:39 +0200
commit8500ae8bb9f4da69273eace4d9cef54ae7f18627 (patch)
tree85acb09cdf450251a775e23a76a42db7003303d0 /autoload/dart.vim
parentd09a56a494863afd789cba1850e123dfc1dd26cf (diff)
downloadvim-polyglot-8500ae8bb9f4da69273eace4d9cef54ae7f18627.tar.gz
vim-polyglot-8500ae8bb9f4da69273eace4d9cef54ae7f18627.zip
Update
Diffstat (limited to 'autoload/dart.vim')
-rw-r--r--autoload/dart.vim14
1 files changed, 9 insertions, 5 deletions
diff --git a/autoload/dart.vim b/autoload/dart.vim
index 367e54e4..52d76c02 100644
--- a/autoload/dart.vim
+++ b/autoload/dart.vim
@@ -27,12 +27,16 @@ function! s:clearQfList(reason) abort
endif
endfunction
-function! dart#fmt(q_args) abort
- let cmd = s:FindDartFmt()
- if type(cmd) != type('') | return | endif
+function! dart#fmt(...) abort
+ let l:dartfmt = s:FindDartFmt()
+ if type(l:dartfmt) != type('') | return | endif
let buffer_content = getline(1, '$')
- let args = '--stdin-name '.expand('%').' '.a:q_args
- let lines = systemlist(printf('%s %s', cmd, args), join(buffer_content, "\n"))
+ let l:cmd = [l:dartfmt, '--stdin-name', shellescape(expand('%'))]
+ if exists('g:dartfmt_options')
+ call extend(l:cmd, g:dartfmt_options)
+ endif
+ call extend(l:cmd, a:000)
+ let lines = systemlist(join(l:cmd), join(buffer_content, "\n"))
" TODO(https://github.com/dart-lang/sdk/issues/38507) - Remove once the
" tool no longer emits this line on SDK upgrades.
if lines[-1] ==# 'Isolate creation failed'