File layouts for config and index data

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 .clangd/index/ directory).

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?

  1. flat: ~/.config/clangd.yaml
  2. clangd-specific parent: ~/.config/clangd/config.yaml

0 voters

We don’t anticipate this directory containing other files.

B: For the user configuration file, should it have an extension?

  1. extension: ~/.config/clangd.yaml
  2. no extension: ~/.config/clangd

0 voters

Note, the .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?

  1. flat: $DIR/.clangd-index/
  2. clangd-specific parent: $DIR/.clangd-cache/index/
  3. generic parent: $DIR/.cache/clangd-index/

0 voters

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?

  1. flat: ~/.cache/clangd-index/
  2. clangd-specific parent: ~/.cache/clangd/index/

0 voters

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.)

1 Like

I voted. But where I can find some info about User index cache?

Thanks!

User index cache?

The background index storage is sharded by filename of the file declaring symbols. This can be a header outside the project, in which case “next to compile_commands.json” doesn’t work for storage and these are often system headers where the parents aren’t writable anyway. So there’s a central storage in the home dir for these.