Open rianquinn opened 5 years ago
As shown here, "const" and "noexcept" are not the same color, and "Deleter" changes color as well
This is due to a lack of support for trailing return types.
@jeff-hykin Additionally, keywords should be avoided inside the member access.
Hmmm I thought we had a previous issue about trailing return types but I can't find it.
Sadly @rianquinn , as Matter123 said, we haven't worked on trailing return types yet so all highlighting for them (if any) is accidental. Current highlighting is probably from pointer access e.g.this->member_var
additionally (just fyi) having auto
on the line-before and the {
on the line after would make it nearly impossible for the parser to know get_deleter() was a function-definition and not a function call, which would change how the trailing return type was parsed even once we do have support.
A trailing return type is the only valid syntax that looks like that in the function head.
More precisely a line that starts with foo()
can only be a function call when inside of a method context. Therefore outside of a method context any line that has the form foo() -> bar
must contain a trailing return type.
@jeff-hykin I think the grammar can be more aggressive in asserting that its a function definition rather than a variable declaration when a trailing return type is present (https://github.com/jeff-hykin/cpp-textmate-grammar/issues/198)
std::string s("comment") -> bar
should never be valid.
Previous discussion https://github.com/jeff-hykin/cpp-textmate-grammar/issues/371
Care needs to be taken about user-defined template deduction guides.
template<class C>
A(C b) -> typename C::type
Though I am not sure that there actually is a difference un how syntax highlighting would be performed.
Checklist
"C_Cpp.enhancedColorization": "Disabled"
The code with a problem is:
It looks like:
screenshot + theme name preferable
It should look like:
"const" and "noexcept" show different colors based on return type. It appears that trailing returns are not highlighting properly