jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
154 stars 29 forks source link

attribute in macro can break syntax highlighting #474

Open hokein opened 4 years ago

hokein commented 4 years ago

moved from https://github.com/clangd/clangd/issues/385

The code with a problem is:

#pragma once

#if 1
#   define MACRO(attr) [[attr]]
#else
#   define MACRO(attr)
#endif

struct S {
    MACRO(deprecated("some unrecognized string size() some unrecognized string"))
    int f() { return 0; }
};

It looks like:

image

vscode 1.45.0 without any cpp extension.

ytimenkov commented 3 years ago

And another example here: https://github.com/microsoft/vscode-cpptools/issues/6560