Open alexr00 opened 5 years ago
Original issue: https://github.com/Microsoft/vscode/issues/71821
Yes it was intentional, and I agree we will try to keep changes like this to a minimum since many themes already setup with the old way.
From here on out, I'll put any similar changes on this post.
keyword.operator.functionlike.cpp keyword.operator
will match all of the operators like alignas, sizeof, etc that require parentheses keyword.operator.wordlike.cpp keyword.operator
will match all of the operators that use alpha numeric characters (that are not functionlike)memory keyword.operator
will match both keyword.operator.new
and keyword.operator.delete
new
and delete
changed
keyword.control
keyword.operator.memory.new
keyword.operator.new
and keyword.operator.delete
using
keyword changed
keyword.control
keyword.other.using
and
, or
, xor
, etc have received additional specificity
alias keyword.operator
keyword.operator.wordlike keyword.operator
or keyword.operator.or
operator
keyword was changed
keyword.control
keyword.other.operator
variable.other.object.accessor
source.cpp
variable.other.member
variable.other.object.property
(middle) and variable.other.property
(end) punctuation.definition.scope
punctuation.section.block.begin.bracket.curly.namespace.cpp
punctuation.section.block.end.bracket.curly.namespace.cpp
decltype
is now tagged
storage.type.decltype
and keyword.other.decltype
meta.class-struct-block
, meta.extern-block
, meta.namespace-block
meta.block.class
meta.block.struct
meta.block.union
meta.block.enum
meta.block.extern
meta.block.namespace
entity.name.type.namespace
entity.name.namespace
()
's
punctuation.section.parens
meta.parens.c
meta
, but might be meta.block
or similar ]keyword.operator
storage.modifier.pointer
and storage.modifier.reference
entity.name.type.namespace.scope-resolution
entity.name.scope-resolution
entity.name.scope-resolution.function.call
entity.name.scope-resolution.function.definition
entity.name.scope-resolution.function.definition.operator-overload
entity.name.scope-resolution.namespace.alias
entity.name.scope-resolution.namespace.block
entity.name.scope-resolution.namespace.using
entity.name.scope-resolution.template.call
entity.name.scope-resolution.template.definition
::
punctuation.separator.namespace.access
punctuation.separator.scope-resolution
punctuation.separator.scope-resolution.function.call
punctuation.separator.scope-resolution.function.definition
punctuation.separator.scope-resolution.function.definition.operator-overload
punctuation.separator.scope-resolution.namespace.alias
punctuation.separator.scope-resolution.namespace.block
punctuation.separator.scope-resolution.namespace.using
punctuation.separator.scope-resolution.template.call
punctuation.separator.scope-resolution.template.definition
punctuation.separator.namespace.access
for better backwards compatibilitykeyword.operator.comparision
punctuation.section.angle-brackets.begin.template.call
punctuation.section.angle-brackets.end.template.call
punctuation.section.angle-brackets.begin.template.definition
punctuation.section.angle-brackets.end.template.definition
punctuation.section.arguments.begin.bracket.round.cpp
punctuation.section.arguments.end.bracket.round.cpp
punctuation.definition.parameters.begin.preprocessor
punctuation.definition.parameters.end.preprocessor
The reason it was changed is because new
and delete
are completely unrelated to control flow. I picked operator
since that's what what I believed it was classified under the C++ spec.
@matter123 pointed out in his pull request its only an operator under a special case. Additionally its debatable that the coloration would be improved if it were labeled with keyword.other
.
@alexr00 should we go ahead and make the change from keyword.operator
to keyword.other
?
Having the big changes here is perfect, thank you. I took a quick look at how other languages handle new: coffee keyword.operator.new.coffee
JS keyword.operator.new.js
groovy keyword.control.new.groovy
java keyword.control.new.java
There isn't a real consensus. Based on what the VS Code themes already have, keyword.operator.new
would be good. keyword.other
, like keyword.operator.memory
would still require changes to the theme. I'm happy to make minor updates to themes though. If you prefer keyword.operator.memory
more, then feel free to leave it and I'll make the update to include it here and in the equivalent places in the other themes.
keyword.operator.new
is probably the best. I noticed on [expr.new]/4
the standard refers to the new operator. Though change is still needed for keyword.operator.delete
Thats interesting @alexr00 I'll try to get a complete list of changes by the end of tonight. There is a file in this repo syntax_examples.cpp
it is designed to visually debug the syntax highlighter changes. You can probably use it to quickly see how everything looks.
@alexr00 The list isn't 100% complete, but I believe it covers everything that would be considered an issue. Many of the changes were made tonight to try to get all of the changes done now. I probably won't be able to make changes for about a week or more, but I'll be around daily for GitHub communication.
Do note that these changes are C++ exclusive. We are working on an ideal way to port them to C.
I believe the new keyword.operator.wordlike
, keyword.operator.functionlike
should take care of most of the issues.
Today I added a tags.txt
, that gets auto generated with the syntax. It just sorts and lists out all of the tags that are in the grammar, it should be useful for keeping track of when things are added and removed. @matter123
@alexr00 The Objective-C and Objective-C++ are fully restored/fixed. Yesterday we expanded the repo's structure to accommodate multiple languages. We added both the Objective-C and Objective-C++ syntaxes along with integration tests for both of them. Neither of them are dependent on C and C++ repos anymore. There's also been some work done on improving the Objective-C++ syntax, but to be on the safe side those changes are not included.
If you want to know more about why this happened in the first place, see here: https://github.com/jeff-hykin/cpp-textmate-grammar/issues/107#issue-434543514
Once the updated Objective-C and Objective-C++ are in VS Code, we can actually instantly fix some long standing bugs related to https://github.com/atom/language-c/issues/146
To make pulling the latest changes easy, here's a scope-change guide for the "dark+" and "dark" themes.
I'd recommend adding
source.cpp keyword.operator.new
rather than
keyword.operator.new.cpp
The second way makes it where additional specificity like keyword.operator.new.overload.cpp
will break the theme
The only scope in the "Control flow keywords" that is control flow is keyword.control
, all of the others (keyword.operator.new.cpp
, keyword.operator.delete
, keyword.other.using
, keyword.other.operator
) are unrelated to control flow. So you might want to rename that group to something like "Special Keywords"
dark plus
// probably make these white #d4d4d4 (same as keyword.operator)
"storage.modifier.pointer",
"storage.modifier.reference"
// probably put these with the "Control flow keywords"/"Special Keywords"
"keyword.operator.functionlike keyword.operator", // typeid(), alignas(), etc
"keyword.operator.wordlike keyword.operator", // and, or, xor, not, etc
// C++ attributes, maybe color them purple, blue, or light blue
"entity.other.attribute",
"punctuation.section.attribute.begin",
"punctuation.section.attribute.end",
// might want to put the overloadee in "Function declarations"
"entity.name.operator.overloadee"
// might want to add this to "Types declaration and references"
// since its almost always a class or namespace that is the scope-resolution
"entity.name.scope-resolution"
dark theme:
// probably want to color blue:
"support.type"
"keyword.operator.wordlike keyword.operator"
// probably make these white #d4d4d4 (same as keyword.operator)
"storage.modifier.pointer"
"storage.modifier.reference"
@jeff-hykin thank you for the detailed description of the issue and for all the fixes and suggestions! We are planning on releasing soon, and I want all these changes to be in insiders for a while before they go out in stable. As soon as we have branched for release (probably in the next couple week days) I'll bring in your Objective C and Objective C++ changes.
Great 👍 and I agree, I'd be more comfortable with them staying in the insiders branch for awhile.
Starting at v1.22.0
you might get downstream complaints about no SQL highlighting.
v1.22.0
removes the source.sql
since it creates frequent unfixable cascading breakages. The side effect is that no SQL keywords will be highlighted inside of raw strings.string.quoted.double.raw.sql
and/or string.quoted.double.raw.SQL
textmate scope. Extensions/editors can target that scope to provide SQL highlighting for those that still want it. Not great I know, but I think its better than defaulting to cascading breakages.
It looks like new used to be keyword.control.cpp. Now it is keyword.operator.memory.new.cpp. Is this intentional? If it's intentional, we can add the it into the themes in VS Code, but ideally there wouldn't be too many changes like this since it requires constant updating of the themes.