Semantic highlighting isn't working with CreateWindow macros
I also have a macro-related issue; not sure if this is intended.
When using macros defined in other files, sometimes the tokens/scopes are incorrect for macros inside the macro call.
For example:
CW_USEDEFAULT is a windows macro but for some reason it is white instead of blue since it doesn't have entity.name.function.preprocessor.cpp as the foreground.
However, when I define my own macros, the macros are now blue which seems to be correct:
So this highlighting is inconsistent.
Originally posted by @billgan1024 in https://github.com/microsoft/vscode-cpptools/issues/11248#issuecomment-1710909472
You appear to not be getting semantic highlighting for those macros in the CreateWindow call. Is IntelliSense working at that point or has it crashed? Do you see a "semantic token type" when viewing the token/scopes for the CreateWindow call?
Are you able to provide a simple repro? We could also try to see if can repro it ourselves based on the screenshot info...
Intellisense still seems to be working because I reloaded it:
but there's still no semantic highlighting.
Here is a simple repro:
#include <windows.h>
#define TITLE L"Test"
int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
HWND window = CreateWindow(
TITLE,
TITLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
800,
600,
0,
0,
0,
0);
#define num 3
#define x(y) num+y
x(num);
}
@sean-mcmanus any update on this? btw I've seen the exact same issue with Visual Studio, and it was fixed very recently.
@billgan1024 we share this code with Visual Studio, so that fix should flow into our extension the next time we take a merge. It won't be in 1.19 though because we're stabilizing for release. I expect it will be in 1.20.0. We could do a pre-release not long after 1.19 releases to stable.
@billgan1024 This is fixed in our 1.20.x pre-release channel.