vim compilation_database_folder 的 YouCompleteMe 路径
vim YouCompleteMe path to compilation_database_folder
所以我在加载 .ycm_extra_conf.py
中从 cmake 生成的 compilation_database 时遇到了一个小问题
# Path to the compile_commands.json that is generated by cmake
# (some how this doesn't work, if path is not explicit?)
compilation_database_folder = '/home/user/programming/someproject/build'
在这里传递一个显式路径完全没有问题,尽管我有点想指定一个到我的项目根目录的相对路径。经过 2 小时的搜索和反复试验后,我现在想要一些答案。有什么建议吗?
我想您知道 .ycm_extra_conf.py 文件的位置。因此,您可以像这样获取此文件的路径 "relative":
os.path.dirname(os.path.abspath(__file__)) + "/build"
这将获取您的 ycm 配置文件的目录并将构建目录添加到其中。如果您的目录位于此目录之上,只需再次使用 os.path.dirname。
所以我在加载 .ycm_extra_conf.py
中从 cmake 生成的 compilation_database 时遇到了一个小问题# Path to the compile_commands.json that is generated by cmake
# (some how this doesn't work, if path is not explicit?)
compilation_database_folder = '/home/user/programming/someproject/build'
在这里传递一个显式路径完全没有问题,尽管我有点想指定一个到我的项目根目录的相对路径。经过 2 小时的搜索和反复试验后,我现在想要一些答案。有什么建议吗?
我想您知道 .ycm_extra_conf.py 文件的位置。因此,您可以像这样获取此文件的路径 "relative":
os.path.dirname(os.path.abspath(__file__)) + "/build"
这将获取您的 ycm 配置文件的目录并将构建目录添加到其中。如果您的目录位于此目录之上,只需再次使用 os.path.dirname。