Skip to content

Commit

Permalink
fix incomplete parsing for C/C++ include directories
Browse files Browse the repository at this point in the history
fix flags
  • Loading branch information
0mco committed Dec 21, 2018
1 parent 73ca1e7 commit 00087af
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions autoload/ale/c.vim
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,20 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
endif

" Parse the cflag
if stridx(l:option, '-I') >= 0 ||
\ stridx(l:option, '-D') >= 0
if stridx(l:option, '-D') >= 0 ||
\ stridx(l:option, '-I') >= 0 ||
\ stridx(l:option, '-nostdinc') >= 0 ||
\ stridx(l:option, '-nostdinc++') >= 0 ||
\ stridx(l:option, '-include') >= 0 ||
\ stridx(l:option, '-imacros') >= 0 ||
\ stridx(l:option, '-idirafter') >= 0 ||
\ stridx(l:option, '-iprefix') >= 0 ||
\ stridx(l:option, '-iwithprefix') >= 0 ||
\ stridx(l:option, '-iwithprefixbefore') >= 0 ||
\ stridx(l:option, '-isysroot') >= 0 ||
\ stridx(l:option, '-imultilib') >= 0 ||
\ stridx(l:option, '-isystem') >= 0 ||
\ stridx(l:option, '-iquote') >= 0
if index(l:cflags_list, l:option) < 0
call add(l:cflags_list, l:option)
endif
Expand Down Expand Up @@ -178,7 +190,8 @@ function! ale#c#ParseCompileCommandsFlags(buffer, dir, json_list) abort
" Search for an exact file match first.
for l:item in a:json_list
if bufnr(l:item.file) is a:buffer
return ale#c#ParseCFlags(a:dir, l:item.command)
" return ale#c#ParseCFlags(a:dir, l:item.command)
return l:item.command
endif
endfor

Expand All @@ -187,7 +200,8 @@ function! ale#c#ParseCompileCommandsFlags(buffer, dir, json_list) abort

for l:item in a:json_list
if ale#path#Simplify(fnamemodify(l:item.file, ':h')) is? l:dir
return ale#c#ParseCFlags(a:dir, l:item.command)
" return ale#c#ParseCFlags(a:dir, l:item.command)
return l:item.command
endif
endfor

Expand Down

0 comments on commit 00087af

Please sign in to comment.