Skip to content

Commit 9bf2a62

Browse files
committed
Expand error message upon -style arg parse error
When the user adds invalid arguments to the -style switch of clang-format, the error message may yield different responses depending on the type of failure. Expand error message given to the user to not only be verbose on 'key' errors. An example: let g:clang_format#style_options = { "Standard" : "go" } Will result in: Error detected while processing function clang_format#replace[6]..<SNR>77_error_message: line 1: clang-format has failed to format. YAML:1:63: error: unknown enumerated scalar {BasedOnStyle: LLVM, IndentWidth: 4, UseTab: false, Standard: 'go'} ^~~~ Error parsing -style: Invalid argument
1 parent c1d68a8 commit 9bf2a62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

autoload/clang_format.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ endfunction
8989

9090
function! s:error_message(result) abort
9191
echoerr 'clang-format has failed to format.'
92-
if a:result =~# '^YAML:\d\+:\d\+: error: unknown key '
92+
if a:result =~# '^YAML:\d\+:\d\+: error: '
9393
echohl ErrorMsg
94-
for l in split(a:result, "\n")[0:1]
94+
for l in split(a:result, "\n")
9595
echomsg l
9696
endfor
9797
echohl None

0 commit comments

Comments
 (0)