Bug 465481

Summary: Code inside #if directive in c/c++ gets highlighted as commented when LSP Client's Semantic Highlighting Option is enabled
Product: [Applications] kate Reporter: sussybakalol328
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: 22.12.2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Code with #if directive
Code without #if directive

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