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

C++ highlighting broken on class template specializations, but only with specific formatting #512

Open
1 of 5 tasks
alexr00 opened this issue Oct 22, 2020 · 0 comments
Open
1 of 5 tasks

Comments

@alexr00
Copy link

alexr00 commented Oct 22, 2020

Checklist

  • This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled"
  • This bug exists for C
  • This bug exists for C++
  • This bug exists for Objective-C
  • This bug exists for Objective-C++

The code with a problem is:

template <class T> struct example;

// highlighting works perfectly fine here
template <> struct example<unsigned> {};

// this also works perfectly fine
template <>
struct example<int> 
{};

// highlighting breaks at <>, doesn't matter if there is anything in it or not. 
// doesn't matter if the specialization is partial, full, CV-qualified, or anything else. 
template <> struct example<long> 
{};

It looks like:

image

The scope of the <> in the broken example is unexpected. The scope of the < is:

punctuation.section.angle-brackets.start.template.definition.cpp
source.cpp

When I would expect it to be:

punctuation.section.angle-brackets.start.template.definition.cpp
meta.template.definition.cpp
source.cpp

The scope of the > gets even more unexpected:

keyword.operator.comparison.cpp
meta.template.definition.cpp
source.cpp

Originally from @evanacox in microsoft/vscode#109098

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

1 participant