Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion autoload/clang_format.vim
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ endfunction

function! clang_format#is_invalid()
if !exists('s:command_available')
if ! executable(g:clang_format#command)
" if running on windows and the path has spaces it needs to be quoted,
" but executable() get confused by the quotes, so we remove them
if has("win32") && !executable(split(g:clang_format#command, '"')[0])
return 1
elseif !has("win32") && !executable(g:clang_format#command)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Conditions of if are complicated. I think it's good to separate them to multiple if statements
  • Indentation looks collapsed
if has('win32') || has('win64')
    if !executable(split(...))
        return 1
    endif
elseif !executable(g:clang_format#command)
    return 1
endif

Copy link
Author

@nicber nicber Oct 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed these in the latest commit.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return 1
endif
let s:command_available = 1
Expand Down