From baaca9a5d7016c52466c3b4cd2d161b317d801ed Mon Sep 17 00:00:00 2001 From: Mikhail Velikikh Date: Wed, 16 Apr 2025 03:29:57 +0100 Subject: [PATCH] Use ale#Escape in c_clangformat_style_option (#4949) * Use ale#Escape in c_clangformat_style_option * Update Vader test --- autoload/ale/fixers/clangformat.vim | 2 +- test/fixers/test_clangformat_fixer_callback.vader | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/ale/fixers/clangformat.vim b/autoload/ale/fixers/clangformat.vim index 81498ebd..444f9015 100644 --- a/autoload/ale/fixers/clangformat.vim +++ b/autoload/ale/fixers/clangformat.vim @@ -22,7 +22,7 @@ function! ale#fixers#clangformat#Fix(buffer) abort let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file') if l:style_option isnot# '' - let l:style_option = '-style=' . "'" . l:style_option . "'" + let l:style_option = '-style=' . ale#Escape(l:style_option) endif if l:use_local_file diff --git a/test/fixers/test_clangformat_fixer_callback.vader b/test/fixers/test_clangformat_fixer_callback.vader index 130ca7f7..4421123d 100644 --- a/test/fixers/test_clangformat_fixer_callback.vader +++ b/test/fixers/test_clangformat_fixer_callback.vader @@ -45,7 +45,8 @@ Execute(The clangformat callback should include style options as well): \ { \ 'command': ale#Escape(g:ale_c_clangformat_executable) \ . ' --assume-filename=' . ale#Escape(bufname(bufnr(''))) - \ . ' --some-option' . " -style='{BasedOnStyle: Microsoft, ColumnLimit:80,}'", + \ . ' --some-option' + \ . ' -style=' . ale#Escape(g:ale_c_clangformat_style_option) \ }, \ ale#fixers#clangformat#Fix(bufnr(''))