Fix error when parsing compile_commands for c langs

This little error caused that when parsing compile_commands json, the
filename was used to fetch entries in directory dictionary, hence, when
adding new json commands, it never found anything in dir_lookup and
instead rewrote the previous entry. Hence, the dir_lookup always
contained list of only one compile_command per directory instead of all
compile_commands for given directory.
This commit is contained in:
Tadeas Uhlir 2019-02-04 16:50:46 -05:00
parent 4d426bf287
commit 37daedafed

View File

@ -202,7 +202,7 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort
let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry] let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry]
let l:dirbasename = tolower(fnamemodify(l:entry.directory, ':p:h:t')) let l:dirbasename = tolower(fnamemodify(l:entry.directory, ':p:h:t'))
let l:dir_lookup[l:dirbasename] = get(l:dir_lookup, l:basename, []) + [l:entry] let l:dir_lookup[l:dirbasename] = get(l:dir_lookup, l:dirbasename, []) + [l:entry]
endfor endfor
if !empty(l:file_lookup) && !empty(l:dir_lookup) if !empty(l:file_lookup) && !empty(l:dir_lookup)