We’re revisiting where clangd should store/read its data as part of adding configuration to clangd.
(The trigger is that the best name for in-project config file seems to be
.clangd, but that conflicts with the current use of the
We’re looking at locations for the configuration file and cached index data, where both can be inside the project or in user storage. I have some questions about what people prefer.
A: For the user configuration file, should it have a containing clangd directory?
- flat: ~/.config/clangd.yaml
- clangd-specific parent: ~/.config/clangd/config.yaml
We don’t anticipate this directory containing other files.
B: For the user configuration file, should it have an extension?
- extension: ~/.config/clangd.yaml
- no extension: ~/.config/clangd
.clangd config file in the source tree will not have an extension.
C: For cached index data stored in the source tree, what should the hierarchy look like?
- flat: $DIR/.clangd-index/
- clangd-specific parent: $DIR/.clangd-cache/index/
- generic parent: $DIR/.cache/clangd-index/
We do expect other cached data in the future, such as modules.
D: For cached index data stored outside the source tree, what should the hierarchy look like?
- flat: ~/.cache/clangd-index/
- clangd-specific parent: ~/.cache/clangd/index/
Again, we do expect other cached data in the future, such as modules.
As an example, my favorites are A1, B2, C3, D1. This yields:
- User config: ~/.config/clangd
- Project config: $DIR/.clangd
- User index cache: ~/.cache/clangd-index
- Project cache: $DIR/.cache/clangd-index
(~/.config/ and ~/.cache/ are really $XDG_CONFIG_HOME and XDG_CACHE_HOME on linux. On mac these are ~/Library/Preferences/ and (getconf DARWIN_USER_CACHE_DIR). On windows these are both %USERPROFILE%\AppData\Local.)