Bug 465481 - Code inside #if directive in c/c++ gets highlighted as commented when LSP Client's Semantic Highlighting Option is enabled
Summary: Code inside #if directive in c/c++ gets highlighted as commented when LSP Cli...
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 22.12.2
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-08 16:34 UTC by sussybakalol328
Modified: 2023-02-08 18:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Code with #if directive (29.24 KB, image/png)
2023-02-08 16:34 UTC, sussybakalol328
Details
Code without #if directive (26.00 KB, image/png)
2023-02-08 16:35 UTC, sussybakalol328
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sussybakalol328 2023-02-08 16:34:47 UTC
Created attachment 156076 [details]
Code with #if directive

SUMMARY
Code inside #if directive gets highlighted as commented when LSP Client's Semantic Highlighting Option is enabled

The LSP Server is clangd

On removing the #if directives and reopening the file from within Kate, Code Highlighting works normally

STEPS TO REPRODUCE
1. Enable the Semantic Highlighting option from LSP Client Settings
2. Write some C/C++ code inside #if directives
Comment 1 sussybakalol328 2023-02-08 16:35:32 UTC
Created attachment 156077 [details]
Code without #if directive
Comment 2 Waqar Ahmed 2023-02-08 18:33:41 UTC
This is a feature, not a bug :)

When the macro directive is not defined/disabled etc.  The code has no effect, and thus is treated as disabled / commented. This helps in easily telling if the macro has any affect or not. Of course it can be a bit annoying at times e.g with header only stb style libraries. But Kate can't do anything about this as it is not Kate that decides this, but clangd. So if you want to argue about the behavior best take it up with clangd devs