From 8500ae8bb9f4da69273eace4d9cef54ae7f18627 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 6 Jul 2020 19:13:39 +0200 Subject: Update --- autoload/dart.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'autoload/dart.vim') 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' -- cgit v1.2.3