-
Notifications
You must be signed in to change notification settings - Fork 588
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
Scope for keys in mappings/dictionaries (e.g. JSON, YAML) #421
Comments
Personally, the first thing I do when I install ST on a new machine is modify the color scheme to highlight JSON keys. To me, it just looks wrong to have it not colored. Especially as punctuation is not colored, its harder to distinguish at a glance, where a key ends and the punctuation begins. Keys are strings and should be highlighted - simple as IMO ;) As for scope name, I have an additional question - do we want any keys to show up in "Goto Anything"? I believe that at a minimum, "root" level keys should appear here for easier document traversal, but that's just my 2 cents. |
The sublime-syntax definition PR uses Obviously I realise that a different selector could be used for symbols, but again, I like the consistency - all symbols are therefore automatically/by default colored the same by the color schemes, no extra work required. |
Oh, I might as well voice my opinion too. I'm strongly in favor of 1 for all languages. It just makes things more consistent and it makes sense to highlight "string keys" differently compared to "normal strings". The YAML-tmLanguage also uses some PS: I need to check out the sublime-syntax def PR and see if I can work with it. Since I made the YAML def, I might tune it to be more precise and won't have to start from scratch, which I originally intended. |
Combining a meta scope with a proper scope for the key makes the most "general" sense to me. For instance, I don't know if this is going to be something we can fully standardize. |
One thing I did for my sublime-snippet PR (#576) was to use the |
Because I work a lot with syntax definition for JSON-based file formats currently, I took a look into this again. I have collected a few examples for "keys" in different languages. JSON{"key": "value", "key2": null, "3": 3, "key4": 3.14} JSON only allows strings as keys, which must be quoted. JavaScriptvar o = {key: "value", "key2": null, 3: 3, "key4": 3.14} JS seems to allow quoted strings as keys and treats everything else as an unquoted string. When looking up values, it seems that they are converted to strings, because Pythond = {"key": "value", "key2": None, 3: 3, "key4": 3.14} Python evaluates keys the same way it does for values. Lualocal t = {key = "value", key2 = nil, [3] = 3, ["key4"] = 3.14} Lua only allows unquoted strings as its table keys, unless you wrap the key in (Unlike in Python, you can also use tables as keys but they only compare by reference.) With these examples, we can observe:
This leads myself to the following conclusions, respectively:
This allows color schemes to target the entire key in general ( Remaining issueWhen strings appear in a structure/expression that is used as a key (tuples or function calls in dicts for Python), they would get matched by |
If I recall correctly, JavaScript has keys scoped as unquoted strings and there was a huge backlash over the change. See #141. While I understand the argument for Also note that JavaScript supports expression as keys: {
[myvar==true ? 'one' : 'two']: 'value'
} |
Yes, and they do have a point there, because to them the change did exactly the opposite of what we are trying to achieve here. We want to standardize scopes for different colorization of keys, while the change they complained about was that their keys look the same as the values. Special-casing JavaScript object keys with a different scope name seems contradictory here. JS and Lua share a common trait (besides unquoted keys) in that they both use the same data structure for both "mappings" and "objects" and use attribute-access syntax synonymously with item-access syntax ( This post was edited. |
Patching the seemingly most popular color scheme, Monokai, to support these scope changes should be an easy step forward and pave the way for other scheme authors. Ensuring the other most popular color schemes (on Package Control) are updated before the next beta build should be possible as well. We might want to consider a mailing list, a platform (the forum) or just a github issue with announcements about the default packages and scope naming standards for color scheme developers. What I'm mostly concerned is: If we are to averse from change, nothing may change at all. I'm sure some people won't like the changes to Python decorators either because their color will change, for example. There will also be people who prefer to have their JSON keys be colored the same as their values (God knows why). |
This commit scopes the first line after a push/set statement as `meta.expect-include-list-or-content`. The following lines are scoped as `meta.include-list` until a none-empty line with a different indention level is detected or it does not start with a `-` in case the first line is an include. If the first line does not contain an include, no special scoping is performed. The sequence is handled as normal `context_content` then. Some more test cases were added to ensure correctness of the changes. Note: 1. By pushing into a dedicated context for includes, the `meta.include-list` covers `\n` by design the same way as any `meta.block` or `meta.group` does in other syntax definitions. The include-list ends with the `\n` of the last include-item. 2. The `meta.flow-sequence.yaml` was removed because: a) it does not have any function b) it seems dedicated for arrays `[]` c) it is not part of the default YAML.sublime-syntax d) it does not comply with sublimehq/Packages#421
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <Ultra-Instinct-05@users.noreply.github.com> Co-authored-by: Jack Cherng <jfcherng@users.noreply.github.com> Co-authored-by: Janos Wortmann <jwortmann@users.noreply.github.com> Co-authored-by: Jon Skinner <jps@sublimetext.com> Co-authored-by: FichteFoll <FichteFoll@users.noreply.github.com> Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com> Co-authored-by: Michael B. Lyons <michaelblyons@users.noreply.github.com> Co-authored-by: Rafał Chłodnicki <rchl@users.noreply.github.com> Co-authored-by: Thomas Smith <Thom1729@users.noreply.github.com> Co-authored-by: Will Bond <wbond@users.noreply.github.com> Co-authored-by: deathaxe <deathaxe@users.noreply.github.com>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <Ultra-Instinct-05@users.noreply.github.com> Co-authored-by: Jack Cherng <jfcherng@users.noreply.github.com> Co-authored-by: Janos Wortmann <jwortmann@users.noreply.github.com> Co-authored-by: Jon Skinner <jps@sublimetext.com> Co-authored-by: FichteFoll <FichteFoll@users.noreply.github.com> Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com> Co-authored-by: Michael B. Lyons <michaelblyons@users.noreply.github.com> Co-authored-by: Rafał Chłodnicki <rchl@users.noreply.github.com> Co-authored-by: Thomas Smith <Thom1729@users.noreply.github.com> Co-authored-by: Will Bond <wbond@users.noreply.github.com> Co-authored-by: deathaxe <deathaxe@users.noreply.github.com>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <Ultra-Instinct-05@users.noreply.github.com> Co-authored-by: Jack Cherng <jfcherng@users.noreply.github.com> Co-authored-by: Janos Wortmann <jwortmann@users.noreply.github.com> Co-authored-by: Jon Skinner <jps@sublimetext.com> Co-authored-by: FichteFoll <FichteFoll@users.noreply.github.com> Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com> Co-authored-by: Michael B. Lyons <michaelblyons@users.noreply.github.com> Co-authored-by: Rafał Chłodnicki <rchl@users.noreply.github.com> Co-authored-by: Thomas Smith <Thom1729@users.noreply.github.com> Co-authored-by: Will Bond <wbond@users.noreply.github.com> Co-authored-by: deathaxe <deathaxe@users.noreply.github.com>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <Ultra-Instinct-05@users.noreply.github.com> Co-authored-by: Jack Cherng <jfcherng@users.noreply.github.com> Co-authored-by: Janos Wortmann <jwortmann@users.noreply.github.com> Co-authored-by: Jon Skinner <jps@sublimetext.com> Co-authored-by: FichteFoll <FichteFoll@users.noreply.github.com> Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com> Co-authored-by: Michael B. Lyons <michaelblyons@users.noreply.github.com> Co-authored-by: Rafał Chłodnicki <rchl@users.noreply.github.com> Co-authored-by: Thomas Smith <Thom1729@users.noreply.github.com> Co-authored-by: Will Bond <wbond@users.noreply.github.com> Co-authored-by: deathaxe <deathaxe@users.noreply.github.com>
Terminology:
string
,entity
orconstant
and specifications of those.meta
andpuncutation
scopes.Introduction
I'd like to discuss the standardization of a specific scope name for key elements in dictionaries or mappings or objects or whatever you call them in your language.
Currently, the JSON definition doesn't have any specific highlighting for keys which it could certainly use and I inteded to add for a while (see also wbond/package_control_channel#5496). There are different scopes for the key and value, but in a way that makes it impossible to specifically target the key with a selector.
In the YAML definition
entity.name.tag
is used, which is a "steal" from xml-like syntaxes where entity.name.tag should denote a tag name.In most programming languages, no special highlighting is done.
Earlier this year, the JavaScript syntax was updated with a colored scope for keys in object literals, but many people seemed opposed of this change (hurr change is bad durr), thus causing the change to be reverted and an uncolored meta scope being used instead.
Concluding questions
entity.name.key
.The text was updated successfully, but these errors were encountered: