Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlight fails for line inheriting from templated class and not finishing with "{" #629

Open
1 task done
jmigual opened this issue Mar 9, 2023 · 1 comment
Open
1 task done

Comments

@jmigual
Copy link

jmigual commented Mar 9, 2023

Checklist

  • This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled"

The code with a problem is:

// With templates
template <typename T> class MyClass {
};
template <typename T> class MyDerivedClass : public MyClass<T> 
{
};
template <typename T> class MyDerivedClass2 : public MyClass<T> {
};

// Without templates
class NonTemplate {
};
template <typename t> class MyDerivedClass3 : public NonTemplate 
{
};
template <typename t> class MyDerivedClass4 : public NonTemplate {
};

It looks like:

code

Default VS code theme (Dark+)

It should look like:

Line 4 has the keywords "class" and "public" in blue, the words "MyDerivedClass" and "MyClass" in green and the token "T" in green.


Related issues:

@jeff-hykin
Copy link
Owner

This is probably going to be a tough one to fix.

Its this is happening because of the screwed up template pattern.
The "T> class MyDerivedClass : public MyClass<T is swallowed by the <> of the first template.

C++ thought it'd be great to allow less-than and greater-than operators inside of template angle brackets, and it turns out thats a very hard thing to parse inside of recursive regular expressions. So this is kind of an artifact of that difficulty. The whole template matching pattern needs to be rewritten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants