Closed BeefaloKing closed 5 years ago
Thanks for the report! Noting I see the same thing as your screenshot in 1.40.0-nightly10 on macOS 10.12.6.
Both the name and initializer list of template class constructors have incorrect syntax highlighting when defined outside the class declaration.
Just so I'm on the same page, can you point to exactly where this is in your example?
The foo()
and data(nullptr)
on line 17. These should match the highlighting for the constructor bar()
on line 20.
Additionally, if foo()
were not a constructor, and had a return type, it would be highlighted correctly. (e.g. template<typename T> int foo<T>::foobar()
)
Heyo @maxbrunsfeld :wave:! We talked about this one today and think it might belong in https://github.com/tree-sitter/tree-sitter-cpp but were wondering if you could confirm?
think it might belong in https://github.com/tree-sitter/tree-sitter-cpp but were wondering if you could confirm?
Yup, you're right: we currently don't parse those template constructors correctly. Thanks!
Should I create a separate issue over there or is this (part of) an already known issue?
ahh sorry, missed your comment @BeefaloKing - I went ahead and copied over your issue so we'll close this in favor of that issue: https://github.com/tree-sitter/tree-sitter-cpp/issues/50.
Prerequisites
Description
Both the name and initializer list of template class constructors have incorrect syntax highlighting when defined outside the class declaration.
Edit: Added clarity in screenshot
Steps to Reproduce
class bar { public: bar(); private: int *data; };
template foo::foo() : data(nullptr)
{}
bar::bar() : data(nullptr) {}