From 3cfe7aa460fba552cd1b5ca4e1c772bb20889ba3 Mon Sep 17 00:00:00 2001 From: Victor S Date: Wed, 4 Oct 2023 21:38:32 -0300 Subject: refactor: use function to get --stdin-filepath Added a new function to get the command part of the --stdin-filepath flag. This is part of a plan to compose the CLI command from an object with flag details. --- autoload/prettier/resolver/config.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'autoload/prettier/resolver/config.vim') diff --git a/autoload/prettier/resolver/config.vim b/autoload/prettier/resolver/config.vim index be36a7c..d790286 100644 --- a/autoload/prettier/resolver/config.vim +++ b/autoload/prettier/resolver/config.vim @@ -28,7 +28,7 @@ function! prettier#resolver#config#resolve(config, hasSelection, start, end) abo \ get(a:config, 'proseWrap', g:prettier#config#prose_wrap) . \ ' --html-whitespace-sensitivity ' . \ get(a:config, 'htmlWhitespaceSensitivity', g:prettier#config#html_whitespace_sensitivity) . - \ ' --stdin-filepath="'.simplify(expand('%:p')).'"' . + \ ' ' . s:Flag_stdin_filepath() . \ ' --require-pragma=' . \ get(a:config, 'requirePragma', g:prettier#config#require_pragma) . \ ' --end-of-line=' . @@ -111,3 +111,10 @@ function! s:Flag_parser(config) abort return '' endif endfunction + +" Returns '--stdin-filepath=' concatenated with the full path of the opened +" file. +function! s:Flag_stdin_filepath() abort + let l:current_file = simplify(expand('%:p')) + return '--stdin-filepath="' . l:current_file . '"' +endfunction -- cgit v1.3