zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
39.89k stars 2.08k forks source link

Dimming #if / #ifndef / ifdef macro blocks in C/C++ #13089

Open muqiuhan opened 3 weeks ago

muqiuhan commented 3 weeks ago

Check for existing issues

Describe the feature

As shown in the figure, when #if / #ifndef / #ifdef will not be compiled, the code block inside it will be dimmed.

If applicable, add mockups / screenshots to help present your vision of the feature

image

notpeter commented 3 weeks ago

The upstream language server (clangd) has some support for this as of version 17 (Sept 2023) and provides inactiveRegions annotation.

Inactive regions is a clangd LSP extension, but does not appear to explicitly documented in the clangd LSP extensions on their website. So basically this issue is a request for us to consume those annotations and add the ability to style them appropriately (grayed out) to match the behavior of other editors.