Open vannaka opened 2 days ago
Hi @vannaka . VS Code doesn't currently provide the support necessary for an extension to improve this behavior. You might consider upvoting this issue: https://github.com/microsoft/vscode/issues/163954 That issue refers to bracket pair colorization, but highlighting (which it looks like you're referring to) would be similar.
Thanks for the quick response! When this issue affects the opening or closing curly brace of a function, that function will not appear in the intelisense database which can be very annoying while trying to navigate a large codebase. Is there any workaround?
@vannaka A potential workaround is to add some #if 0
(still visible to the tag parser) or #if __INTELLISENSE__
(only visible to IntelliSense) block that "fixes" the brace matching.
void foo( void ) {
if( 1
#ifdef NOT_DEFINED_SYMBOL
)
{
#else
)
{
#endif
}
#if 0
}
#endif
}
Environment
Bug Summary and Steps to Reproduce
Bug Summary: The below screenshots show the issue. The
#ifdef
section is properly being greyed out, but the parenthesis and curly brackets are not being paired properly. I've reproduced this on Windows 11 with the MSVC compiler, as well as on WSL with gcc. It appears to be OS/compiler agnostic. This seems similar to #12326, but not an exact match. Note that the behavion is the same whether#ifdef
or#if defined
is used.Steps to reproduce:
Open the following code in VSCode with the default
c_cpp_properties.json
:Expected behavior:
Configuration and Logs
c_cpp_properties.json
:C/C++: Log Diagnostics
Language server logging
:Other Extensions
No response
Additional context
No response