From 713698d2ca0dfe45ca8b468d4f1e1c629fea2d34 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 5 Feb 2024 04:28:11 -0700 Subject: [PATCH] Documentation: Recommend disabling clangd's IncludeCleaner feature --- Documentation/EmacsConfiguration.md | 4 ++++ Documentation/HelixConfiguration.md | 4 ++++ Documentation/VSCodeConfiguration.md | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/Documentation/EmacsConfiguration.md b/Documentation/EmacsConfiguration.md index 811e6f6b9d..5591545cf2 100644 --- a/Documentation/EmacsConfiguration.md +++ b/Documentation/EmacsConfiguration.md @@ -15,6 +15,10 @@ CompileFlags: - "-UNO_TLS" - "-I/path/to/serenity/Toolchain/Local/x86_64/x86_64-pc-serenity/include/c++/13.1.0" - "-I/path/to/serenity/Toolchain/Local/x86_64/x86_64-pc-serenity/include/c++/13.1.0/x86_64-pc-serenity" + +Diagnostics: + UnusedIncludes: None + MissingIncludes: None ``` You will need to change `/path/to/serenity` and change `13.1.0` to diff --git a/Documentation/HelixConfiguration.md b/Documentation/HelixConfiguration.md index 54dda231f8..0c6ece27f3 100644 --- a/Documentation/HelixConfiguration.md +++ b/Documentation/HelixConfiguration.md @@ -6,6 +6,10 @@ The following `.clangd` should be placed in the project root: CompileFlags: CompilationDatabase: Build/x86_64 # Or whatever architecture you're targeting, e.g. aarch64 Add: [-D__serenity__] + +Diagnostics: + UnusedIncludes: None + MissingIncludes: None ``` You also need to configure the clangd server to detect headers properly from the Serenity toolchain. To do this, create a `.helix/languages.toml` file in the project root: diff --git a/Documentation/VSCodeConfiguration.md b/Documentation/VSCodeConfiguration.md index b551b63ae7..86543f3de9 100644 --- a/Documentation/VSCodeConfiguration.md +++ b/Documentation/VSCodeConfiguration.md @@ -25,8 +25,15 @@ Depending on which configuration you use most, set the CompilationDatabase confi CompileFlags: Add: [-D__serenity__] CompilationDatabase: Build/x86_64 + +Diagnostics: + UnusedIncludes: None + MissingIncludes: None ``` +The UnusedIncludes and MissingIncludes flags are used to disable the [Include Cleaner](https://clangd.llvm.org/design/include-cleaner) feature of newer clangd releases. +It can be re-enabled if you don't mind the noisy inlay hints and problems in the problem view. + Run ``./Meta/serenity.sh run`` at least once to generate the ``compile_commands.json`` file. In addition to the ``.clangd`` file, the ``settings.json`` file below has a required ``clangd.arguments`` entry for ``--query-driver`` that allows clangd to find the cross-compiler's built-in include paths.