vim: fix cdg usage from build_commands generation
This commit is contained in:
parent
617574713a
commit
e8bbce1878
@ -4,7 +4,7 @@
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
|
||||
import os
|
||||
|
||||
'''A simple compilation database generator, or cdg in short.
|
||||
|
||||
@ -63,7 +63,7 @@ Per https://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
|
||||
# To workaround that there is no "entering directory..."
|
||||
if not pwd:
|
||||
pwd = "/path/to/your/project/"
|
||||
pwd = os.getcwd()
|
||||
path_stack.append(pwd)
|
||||
|
||||
# Special handling for projects like Redis,
|
||||
|
@ -89,7 +89,11 @@ endif
|
||||
" signatures (S) information.
|
||||
" --extra=+q : Adds context to the tag name. Note: Without this
|
||||
" option, the script cannot get class members.
|
||||
let g:build_cmd="make"
|
||||
if !exists("g:build_cmd")
|
||||
let g:build_cmd="make"
|
||||
endif
|
||||
|
||||
" More tools can be found here: https://github.com/Sarcasm/notes/blob/master/dev/compilation-database.rst
|
||||
func! MenuCB(id, result)
|
||||
if a:result == 1
|
||||
silent exec "!echo '==Building ctags database==' && ctags --fields=+iaS --extra=+q --totals -R --c++-kinds=+p --exclude=.ccls-cache"
|
||||
@ -117,7 +121,7 @@ func! MenuCB(id, result)
|
||||
elseif a:result == 8 "https://github.com/rizsotto/scan-build
|
||||
execute "!analyze-build"
|
||||
elseif a:result == 9
|
||||
execute "!make clean > /dev/null && make -nw | python ~/.vim/plugin/cdg.py "
|
||||
execute "!make clean > /dev/null && LANG=C make -nw | python ~/.vim/plugin/cdg.py "
|
||||
elseif a:result == 10
|
||||
echo "Add -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to cmake. On modify build option with ccmake"
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user