cquery
cquery copied to clipboard
[feature-request] A global ~/.config/cquery/settings file
I have to copy same .cquery every where, it contains only few lines:
%clang
%c -std=gnu11
%cpp -std=gnu++14
-pthread
# Includes
-ID:/dev/mingw/include
Can I have a global .cquery file like C:\Users\MyName\.config\cquery\settings to setup include paths ?? YouCompleteMe can allow me have a global config.
Sure, this sounds reasonable.
I'm interested in implementing this feature. I've been looking over the code base and am struggling to find where the .cquery file is loaded. Could someone point me in the right direction?
This function handles loading from .cquery:
https://github.com/cquery-project/cquery/blob/1fa36852b5dbe0d8e8207b1362a150c722a077c7/src/project.cc#L456-L514
Great! Thank you :smile:
A couple things:
- On *nix it is probably best to get the
.cqueryfile from$HOME/.config/cqueryas opposed to just putting it at$HOME - On Windows what is the convention for config files? Looking here it seems that
C:\Users\<user>\AppData\Roaming\cquerywould be the best spot.
What I plan to do:
- Only read the global config file in absence of a project specific one
- Read the global config file from one location only
$XDG_CONFIG_HOME/cqueryon *nix- For windows, the value of
config_path + "/cquery"in:
SHGetKnownFolderPath ( FOLDERID_RoamingAppData, KF_FLAG_CREATE, NULL, &config_path )))
For linux, what about reading $XDG_CONFIG_HOME and defaulting to $HOME/.cquery if not present?
A single global config SGTM.
Adding a function GetGlobalConfigDir to platform.h is one potential approach.
FYI, per XDG basedir convention, config dir should be at $HOME/.config/cquery/ when XDG_CONFIG_HOME is not defined and $XDG_CONFIG_HOME/cquery/ when it is. So if it is desired to be consistent with this generally spottily-followed specification, this isn't really doing it right. However, this is an improvement over only $HOME/.cquery, IMO.
I've done a few XDG basedir retrofits, and I've usually checked for the original config file in $HOME, and if it doesn't exist there follow the basedir spec. This way no one's existing config breaks and the basedir spec is followed for new installs.
Is it possible to have environment variables in the .cqeury file?
I use conda and installed my gcc compilers inside conda environment. The include path should look like -I$CONDA_PREFIX/include/c++/6.1.0
I don't know. I think most of the config file stuff is just passed on to clang and a quick google doesn't suggest anything. I did a quick test on my machine and it didn't seem to effect code completion. Does it work for you?