EvgeniyPeshkov / syntax-highlighter

Syntax Highlighter extension for Visual Studio Code (VSCode). Based on Tree-sitter.
https://marketplace.visualstudio.com/items?itemName=evgeniypeshkov.syntax-highlighter
MIT License
210 stars 43 forks source link

[C++] __attribute__ highlighting #21

Closed bbatliner closed 3 years ago

bbatliner commented 5 years ago

There seem to be some inconsistencies that appear when __attribute__ is used on a struct:

struct __attribute__((packed)) struct1_t {
    static constexpr int A  = 1;
    static constexpr int B  = 2;
    static constexpr int C  = 3;
};

struct struct2_t {
    static constexpr int A  = 1;
    static constexpr int B  = 2;
    static constexpr int C  = 3;
};

image

The static modifiers are highlighted differently - do you know why?

EvgeniyPeshkov commented 5 years ago

Hi @bbatliner , It's the same situation as in #23 . I will try to fix this, but it may take some time.

bbatliner commented 5 years ago

__attribute__ correctly highlights for functions and doesn't corrupt the tree. I'm seeing the same issue for structs, however.

image

Is this the intended behavior for now?

EvgeniyPeshkov commented 5 years ago

You are right. As I posted in #23 :

throw and virtual have been fixed indeed. But highlighting of structs with __attribute__ is still corrupted, it became slightly better though. It seems, that attributes are fixed only for functions in tree-sitter-cpp. So let's leave #21 open for a while. I'll try to ask tree-sitter-cpp developers to fix this issues.

But I was wrong, that it became slightly better =). So we are waiting until __attribute__ is fixed in tree-sitter-cpp for structs.