I have source files that contain macros loaded by a proprietary build toolchain. Unfortunately, Neovim doesn't have a plugin for the configuration file (emProject from SEGGER) and doesn't recognize these macros. As a result, they are not detected by clangd. Is there a way to adjust clangd's behavior?
Specifically, I would like to disable the graying out of code sections between the macros. I use Neovim, lsp-config, clangd, and mason, with all settings based on the NChad configuration.
If you're using clangd 17 or later, the coloring of inactive code regions can be disabled by adding the following to your clangd configuration:
SemanticTokens:
DisabledKinds: [InactiveCode]
Note: the above applies to clients that do not implement the textDocument/inactiveRegions
Language Server Protocol extension, and thus fall back to coloring inactive code regions using textDocument/semanticTokens
.
For clients that do implement textDocument/inactiveRegions
(such as vscode-clangd), there should be client-specific options for customizing the appearance of inactive regions (for example, the "clangd.inactiveRegions.useBackgroundHighlight"
setting in vscode-clangd).