This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add a switch to specify a default clangd configuration file
Needs ReviewPublic

Authored by voertler on May 24 2023, 4:11 AM.

Details

Summary

This patch allows it to set a default configuration as discussed in issue https://github.com/clangd/clangd/issues/845 by adding a startup option --default-config.

Diff Detail

Event Timeline

voertler created this revision.May 24 2023, 4:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 4:11 AM
Herald added a subscriber: arphaman. · View Herald Transcript
voertler requested review of this revision.May 24 2023, 4:11 AM
nridge added a subscriber: nridge.May 26 2023, 12:12 AM

Sorry about the delay, I think this is OK to add.

clang-tools-extra/clangd/tool/ClangdMain.cpp
500

why this change? user config is still loaded from those directories

Maybe after the user config text, add "Extra config may be specified by --extra-config-file"

509

"default" doesn't seem like the right term for this, as it's clearly not the default - the user is providing it!

Also, there's also been desire to provide config inline in a flag (as opposed to a file) as this is more self-contained. Calling this config when it's actually a config filename is a bit confusing.

maybe --extra-config-file?

512

I think mentioning --enable-config is more confusing than helpful, since it's on by default.

959

none of this path checking/resolution should be necessary, the fromYAMLFile provider already handles the case where the path does not exist.

We don't expand tildes in paths clangd (or clang, generally) processes.