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

[RFC] Sublime Syntax Main Key Sort Order #2430

Open
deathaxe opened this issue Jul 22, 2020 · 2 comments
Open

[RFC] Sublime Syntax Main Key Sort Order #2430

deathaxe opened this issue Jul 22, 2020 · 2 comments
Labels

Comments

@deathaxe
Copy link
Collaborator

deathaxe commented Jul 22, 2020

The number of main keys in the sublime-syntax file format increases. While it seems common practise to have variables context before contexts the header keys are sorted alphabetically only.

I'd propose to group the name, scope and version keys as they describe the the syntax itself.

The file_extensions and first_line_match should follow and be separated by an empty line,

Here's an example of how it could look like:

%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
# https://www.mysyntax.com/specs/index.html
name: MySyntax
scope: source.mysyntax
version: 2
hidden: false

extends:
  - souse.basesyntax
  - souse.basesyntax2

file_extensions:
  - main_ext
  - ext2

hidden_file_extensions:
  - any
  - thing

first_line_match: |-
  (?x:
    ^\#! .* \b(mysyntax)\b |                                   # shebang
    ^/[/*] \s* -\*- .*? \bmysyntax\b \s* -\*-(?: \s* [/*]/)?  # editorconfig
  )

variables:
  var1: ...

contexts:
  main:
    ...
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue Jul 26, 2020
This commit...

1. updates XML/DTD syntax to sublime-syntax version 2.
2. sorts the main keys according to proposal sublimehq#2430
3. sorts hidden file extensions
4. removes some quotation marks from values.
wbond pushed a commit that referenced this issue Aug 18, 2020
This commit...

1. updates XML/DTD syntax to sublime-syntax version 2.
2. sorts the main keys according to proposal #2430
3. sorts hidden file extensions
4. removes some quotation marks from values.
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue Mar 21, 2021
Fixes sublimehq#2759

This commit...

1. sorts main header keys according to sublimehq#2430
2. adds or update `first_line_match` patterns to all appropriate syntax
   definitions in order to support emacs mode tags.

   Examples:

   // -*-c-*-
   // -*- c -*-
   // -*- mode: c -*-
   // -*- mode: c++; -*-
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue Mar 21, 2021
Fixes sublimehq#2759

This commit...

1. sorts main header keys according to sublimehq#2430
2. adds or update `first_line_match` patterns to all appropriate syntax
   definitions in order to support emacs mode tags.

   Examples:

   // -*-c-*-
   // -*- c -*-
   // -*- mode: c -*-
   // -*- mode: c++; -*-
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue Mar 21, 2021
Fixes sublimehq#2759

This commit...

1. sorts main header keys according to sublimehq#2430
2. adds or update `first_line_match` patterns to all appropriate syntax
   definitions in order to support emacs mode tags.

   Examples:

   // -*-c-*-
   // -*- c -*-
   // -*- mode: c -*-
   // -*- mode: c++; -*-
@deathaxe deathaxe added the RFC label Aug 19, 2021
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue Sep 12, 2021
This commit...

1. updates to sublime-syntax "version 2"
2. re-orders header contexts sublimehq#2430
3. replaces `pop: true` by `pop: 1`
keith-hall added a commit that referenced this issue Sep 25, 2021
)

* [Regular Expressions] Split into common syntax and boost syntax

* [Regular Expressions] Move remaining anonymous contexts to named ones

* [Regular Expressions] Update to sublime-syntax version 2

This commit...

1. updates to sublime-syntax "version 2"
2. re-orders header contexts #2430
3. replaces `pop: true` by `pop: 1`

* [Regular Expression] Rename Regexp Common syntax file

This commit renames "Regexp Common" to "Regexp (Basic)" to make it follow the naming scheme

   `<main name> (<derivative>)`

which is already used by several syntaxes of this repo to express
inheritance.

* [Regular Expression] Remove unnecessary multi-set statement

* [Regular Expression] Move group-start-common context

* [Regular Expression] avoid unreached lookahead

`base-group` and `group-body` of same content but distinguish by the way
they pop, only. The latter consumes closing parens, while the former
does not.

Including the former into latter causes the lookahead `(?=\))` of the
former being added into the latter one, which doesn't make sense.

This commit therefore includes `base-literal` vs.
`base-literal-extended` into `group-body` and its extended counterpart
to exclude that unnecessary lookahead.

* [Regular Expression] Tweak extended lien comment punctuation

* [Regular Expression] Reorganize context names

This commit...

1. renames all non-popping context names to plural
2. renames some `inside-...` contexts to `...-body` as some of them
   already used the latter nameing scheme.
3. adds a dedicated context for `line-comments` in case an inherited
   syntax wants to modify them.


Notes: 

1. This commit doesn't change behavior.
2. Goal is a common naming scheme, which is important if this package
   becomes a base for inheritance.

* [Regular Expression] Rename unexpected-qualifier(s) contexts

This commit applies plural/singular for (non-)popping
unexpected-qualifier(s) contexts.

As several qualifiers may be present in `unexpected-quantifier-pop` it
feels more natural to name this context `maybe-unexpected-quantifiers`.

* [Regular Expression] Use multi-push for charset ranges

This commit creates a named context for `charset-ranges` and pushes both
`charset-range-begin` and `charset-range-end` on stack at the same time.

It slightly improves parsing performance.

* [Regular Expression] Merge escaped-chars contexts

* [Regular Expression] Add popping escaped-char contexts

... in case it needs to be addressed by an inherited syntax.

* [Regular Expression] Move backslash child contexts

This commit moves backslash related children below the `backslash`
context.

* [Regular Expression] Remove meta.literal

This commit removes `meta.literal` as it causes each literal character
to be tokenized separately, which slows down the syntax definition.

Note: Clojure's and Perl's syntax tests are relaxed to not check for
      the removed meta scope anymore.

* [Regular Expression] Reorganize backslashes context

This commit splits `backslashes` context into anchors, backrefs, backslashes

* [Regular Expression] Move group-start-common

This commit moves the group-start-common context in
Regexp.sublime-syntax to the same relative position as in the basic
syntax and removes some unnecessary quotes.

* [Regular Expression] Remove quotes

* Update Regular Expressions/RegExp (Basic).sublime-syntax

Co-authored-by: deathaxe <deathaxe@web.de>

Co-authored-by: DeathAxe <deathaxe82@googlemail.com>
Co-authored-by: deathaxe <deathaxe@web.de>
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue Sep 29, 2021
This commit...

1. updates all syntax definitions to version 2 syntax format
2. replaces pop: true by pop: 1
3: resorts main keys according to sublimehq#2430
deathaxe added a commit that referenced this issue Oct 1, 2021
This commit...

1. updates all syntax definitions to version 2 syntax format
2. replaces pop: true by pop: 1
3: resorts main keys according to #2430
@keith-hall
Copy link
Collaborator

As there has been no oppositions to this, I'd personally say that this is now the standard and perhaps should be written in our RFC repository https://github.com/SublimeText/ScopeNamingGuidelines :)

azizk pushed a commit to elixir-editors/elixir-sublime-syntax that referenced this issue Oct 26, 2021
Basically applies sublimehq/Packages#2430

Just another idea. Just drop it, if you don't like it.
azizk pushed a commit to elixir-editors/elixir-sublime-syntax that referenced this issue Oct 26, 2021
Basically applies sublimehq/Packages#2430

Just another idea. Just drop it, if you don't like it.
jrappen added a commit to jrappen/Packages that referenced this issue Oct 28, 2021
- Split `JSON.sublime-syntax` into ... using inheritance:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Although the base syntax does not define a `prototype`, we add
  `meta_include_prototype: false` to the base syntax, to prevent
  inheriting syntaxes from injecting rules.
- make use of `variables`
- Add many more file extensions for `JSON` and `JSONC`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `JSON`, `JSONC`
        - `mapping` (objects), `sequence` (arrays)
- leave `JSON` headers in `Markdown` as json only, but split up
  fenced code blocks into `json` and `jsonc` to behave similarly
  to `GitHub Flavored Markdown`
- fix tests for `meta.mapping meta.mapping.*`
- make `mapping.*` contexts more modular

- fix sublimehq#285 as requested by Jon
- address sublimehq#757 and use tips to fix line comments for `JSONC`
- address sublimehq#2430 and use sort-order as requested by deathaxe
- address sublimehq#2852 and use tips to fix scopes of curly braces &
  square brackets in `JSON`

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: deathaxe <deathaxe@users.noreply.github.com>
jrappen added a commit to jrappen/Packages that referenced this issue Oct 28, 2021
- Split `JSON.sublime-syntax` into ... using inheritance:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Although the base syntax does not define a `prototype`, we add
  `meta_include_prototype: false` to the base syntax, to prevent
  inheriting syntaxes from injecting rules.
- make use of `variables`
- Add many more file extensions for `JSON` and `JSONC`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `JSON`, `JSONC`
        - `mapping` (objects), `sequence` (arrays)
- leave `JSON` headers in `Markdown` as json only, but split up
  fenced code blocks into `json` and `jsonc` to behave similarly
  to `GitHub Flavored Markdown`
- fix tests for `meta.mapping meta.mapping.*`
- make `mapping.*` contexts more modular

- fix sublimehq#285 as requested by Jon
- address sublimehq#757 and use tips to fix line comments for `JSONC`
- address sublimehq#2430 and use sort-order as requested by deathaxe
- address sublimehq#2852 and use tips to fix scopes of curly braces &
  square brackets in `JSON`

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: deathaxe <deathaxe@users.noreply.github.com>
jrappen added a commit to jrappen/Packages that referenced this issue Oct 28, 2021
- Split `JSON.sublime-syntax` into ... using inheritance:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Although the base syntax does not define a `prototype`, we add
  `meta_include_prototype: false` to the base syntax, to prevent
  inheriting syntaxes from injecting rules.
- make use of `variables`
- Add many more file extensions for `JSON` and `JSONC`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `JSON`, `JSONC`
        - `mapping` (objects), `sequence` (arrays)
- leave `JSON` headers in `Markdown` as json only, but split up
  fenced code blocks into `json` and `jsonc` to behave similarly
  to `GitHub Flavored Markdown`
- fix tests for `meta.mapping meta.mapping.*`
- make `mapping.*` contexts more modular

- fix sublimehq#285 as requested by Jon
- address sublimehq#757 and use tips to fix line comments for `JSONC`
- address sublimehq#2430 and use sort-order as requested by deathaxe
- address sublimehq#2852 and use tips to fix scopes of curly braces &
  square brackets in `JSON`

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: deathaxe <deathaxe@users.noreply.github.com>
jrappen added a commit to jrappen/Packages that referenced this issue Oct 28, 2021
- Split `JSON.sublime-syntax` into ... using inheritance:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Although the base syntax does not define a `prototype`, we add
  `meta_include_prototype: false` to the base syntax, to prevent
  inheriting syntaxes from injecting rules.
- make use of `variables`
- Add many more file extensions for `JSON` and `JSONC`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `JSON`, `JSONC`
        - `mapping` (objects), `sequence` (arrays)
- leave `JSON` headers in `Markdown` as json only, but split up
  fenced code blocks into `json` and `jsonc` to behave similarly
  to `GitHub Flavored Markdown`
- fix tests for `meta.mapping meta.mapping.*`
- make `mapping.*` contexts more modular

- fix sublimehq#285 as requested by Jon
- address sublimehq#757 and use tips to fix line comments for `JSONC`
- address sublimehq#2430 and use sort-order as requested by deathaxe
- address sublimehq#2852 and use tips to fix scopes of curly braces &
  square brackets in `JSON`

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: deathaxe <deathaxe@users.noreply.github.com>
deathaxe added a commit that referenced this issue Oct 28, 2021
* [Common] Add or update emacs mode patterns

Fixes #2759

This commit...

1. sorts main header keys according to #2430
2. adds or update `first_line_match` patterns to all appropriate syntax
   definitions in order to support emacs mode tags.

   Examples:

   // -*-c-*-
   // -*- c -*-
   // -*- mode: c -*-
   // -*- mode: c++; -*-

* [ActionScript] Fix first line pattern

* [ASP] Fix first line pattern

Moves `-*- asp -*-` to HTML (ASP).sublime-syntax

* [JSP] Add missing first line pattern

* [Java] Revert first line pattern

JSP is html like syntax and probably doesn't need or never sees such
mode comment.

* [ASP] Revert first line pattern

HTML (ASP) won't probably see any such comment, thus removing it.

* [All] Allow anything in front of emacs mode tag comments

Sync with PR #2862

* [Haskell] Add shebang to first_line_match

* [Lua] Add shebang to first_line_match

* [ShellScript] Add DASH shebang

* [PHP] Add minor version support in shebang

Syncs modification from #2915 to add support for
php executables such as

    php
    php7
    php71
    php7.1
    php7.1.3

to `first_line_match`'s shebang/editorconfig pattern.

* [Batch File] Add "@echo on" to first_line_match
jrappen added a commit to jrappen/Packages that referenced this issue Oct 28, 2021
- Split `JSON.sublime-syntax` into ... using inheritance:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Although the base syntax does not define a `prototype`, we add
  `meta_include_prototype: false` to the base syntax, to prevent
  inheriting syntaxes from injecting rules.
- make use of `variables`
- Add many more file extensions for `JSON` and `JSONC`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `JSON`, `JSONC`
        - `mapping` (objects), `sequence` (arrays)
- leave `JSON` headers in `Markdown` as json only, but split up
  fenced code blocks into `json` and `jsonc` to behave similarly
  to `GitHub Flavored Markdown`
- fix tests for `meta.mapping meta.mapping.*`
- make `mapping.*` contexts more modular

- fix sublimehq#285 as requested by Jon
- address sublimehq#757 and use tips to fix line comments for `JSONC`
- address sublimehq#2430 and use sort-order as requested by deathaxe
- address sublimehq#2852 and use tips to fix scopes of curly braces &
  square brackets in `JSON`

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: deathaxe <deathaxe@users.noreply.github.com>
jrappen added a commit to jrappen/Packages that referenced this issue Oct 31, 2021
- Using inheritance split up `JSON.sublime-syntax` into:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Add many more file extensions for `JSON` & `JSONC`:
    - add doc links to exensions where applicable as a reference to be
      able to more quickly verify that they (still) use said syntax
      flavor
- Add JSON5 with support for:
    - explicitly pos numbers, hexadecimal ints, Infinity and NaN
    - single quoted strings
    - more escape chars for strings
- Only allow objects or arrays at the top level
    - add `meta.toc-list` scope to top level object keys to add them to
      the symbol list (also add tests, see below)
- Make use of newer syntax features including those only available in
  `version: 2` syntaxes
- Make use of `variables`
- Highlighting speed improvements for empty objects and empty arrays
- Significantly improve number highlighting
- Correctly scope number signs with `constant.numeric.sign` instead of
  `keyword.operator.arithmetic`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `json`, `jsonc` & `json5`
        - `mapping` (objects), `sequence` (arrays)
    - Add symbols tests for:
        - scope: `meta.toc-list.json | meta.toc-list.json5`
        - languages: `json`, `jsonc` & `json5`
- Fix tests for `meta.mapping meta.mapping.*`
- Make `mapping.*` contexts more modular
- Leave `JSON` headers in `Markdown` as `json` only, but split up fenced
  code blocks into `json`, `jsonc` & `json5` to behave similarly to
  `GitHub Flavored Markdown`


BREAKING CHANGES:

- scopes for number signs have changed from being
  `keyword.operator.arithmetic` to `constant.numeric.sign`


- fix sublimehq#285 as requested by Jon
- address sublimehq#757 using tips to fix line comments for `JSONC`
- address sublimehq#2430 using sort-order as requested by deathaxe
- address sublimehq#2852 using tips to fix scopes of curly braces & square
  brackets in `JSON`


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: deathaxe <deathaxe@users.noreply.github.com>
jrappen added a commit to jrappen/Packages that referenced this issue Oct 31, 2021
- Using inheritance split up `JSON.sublime-syntax` into:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- Add many more file extensions for `JSON` & `JSONC`:
    - add doc links to exensions where applicable as a reference to be
      able to more quickly verify that they (still) use said syntax
      flavor
- Add JSON5 with support for:
    - explicitly pos numbers, hexadecimal ints, Infinity and NaN
    - single quoted strings
    - more escape chars for strings
- Only allow objects or arrays at the top level
    - add `meta.toc-list` scope to top level object keys to add them to
      the symbol list (also add tests, see below)
- Make use of newer syntax features including those only available in
  `version: 2` syntaxes
- Make use of `variables`
- Highlighting speed improvements for empty objects and empty arrays
- Significantly improve number highlighting
- Correctly scope number signs with `constant.numeric.sign` instead of
  `keyword.operator.arithmetic`
- Significantly extend tests to cover more parts of the syntaxes
  defined:
    - Split original test file into logical parts
    - Add indentation tests for:
        - `json`, `jsonc` & `json5`
        - `mapping` (objects), `sequence` (arrays)
    - Add symbols tests for:
        - scope: `meta.toc-list.json | meta.toc-list.json5`
        - languages: `json`, `jsonc` & `json5`
- Fix tests for `meta.mapping meta.mapping.*`
- Make `mapping.*` contexts more modular
- Leave `JSON` headers in `Markdown` as `json` only, but split up fenced
  code blocks into `json`, `jsonc` & `json5` to behave similarly to
  `GitHub Flavored Markdown`

BREAKING CHANGES:

- scopes for number signs have changed from being
  `keyword.operator.arithmetic` to `constant.numeric.sign`

- fix sublimehq#285 as requested by Jon
- address sublimehq#757 using tips to fix line comments for `JSONC`
- address sublimehq#2430 using sort-order as requested by deathaxe
- address sublimehq#2852 using tips to fix scopes of curly braces & square
  brackets in `JSON`

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: deathaxe <deathaxe@users.noreply.github.com>
princemaple pushed a commit to elixir-editors/elixir-sublime-syntax that referenced this issue Nov 2, 2021
Basically applies sublimehq/Packages#2430

Just another idea. Just drop it, if you don't like it.
jrappen added a commit to jrappen/Packages that referenced this issue Dec 2, 2021
- Using inheritance split up `JSON.sublime-syntax` into:
    - `JSON (Basic).sublime-syntax` with `scope:source.json.basic`
    - `JSON.sublime-syntax` with `scope:source.json`
    - `JSONC.sublime-syntax` with `scope:source.json.jsonc`
    - `JSON5.sublime-syntax` with `scope:source.json.json5`
- 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:
    - (correctly formatted) JSON code can now be prettified or minified
      via the context menu or the command palette
    - 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)
- JSONC:
    - highlight some files by default as `JSONC` (as decided by Jon
      in sublimehq#285)
    - highlight leading & multiple commas as invalid, trailing as valid
- JSON5:
    - explicitly pos numbers, hexadecimal ints, Infinity and NaN
    - single quoted strings
    - more escape chars for strings
    - ECMA identifierName as object keys (thanks to Thomas)
        - scoped as plain unquoted strings
    - line continuation in strings (with tests thanks to Keith)
- Objects:
    - Add `meta.toc-list` scope to top level object keys to add them to
      the symbol list (also add tests, see below)
    - 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)
- Syntaxes:
    - 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 Thomas)
- Tests:
    - Significantly extend tests to cover more parts of the syntaxes
      defined.
    - Split original test file into logical parts
    - Add indentation tests for:
        - `json`, `jsonc` & `json5`
        - `mapping` (objects), `sequence` (arrays)
    - Add symbols tests for:
        - scope: `meta.toc-list.json | meta.toc-list.json5`
        - languages: `json`, `jsonc` & `json5`
    - Fix tests for `meta.mapping meta.mapping.*`
- Leave `JSON` headers in `Markdown` as `json` only, but split up fenced
  code blocks into `json`, `jsonc` & `json5` 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 target `JSONC.sublime-syntax` instead to have
  the same user experience as before.


- fix sublimehq#285
- address sublimehq#481 to remove incompatible regex patterns according to Will
- address sublimehq#757 to fix line comments for `JSONC` (thanks to Keith)
- address sublimehq#2430 using sort-order (as requested by deathaxe)
- address sublimehq#2852 to fix scopes of curly braces & square brackets in
  `JSON` (thanks to Thomas)
- 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>
mitranim pushed a commit to mitranim/Packages that referenced this issue Mar 25, 2022
This commit...

1. updates XML/DTD syntax to sublime-syntax version 2.
2. sorts the main keys according to proposal sublimehq#2430
3. sorts hidden file extensions
4. removes some quotation marks from values.
mitranim pushed a commit to mitranim/Packages that referenced this issue Mar 25, 2022
…blimehq#3034)

* [Regular Expressions] Split into common syntax and boost syntax

* [Regular Expressions] Move remaining anonymous contexts to named ones

* [Regular Expressions] Update to sublime-syntax version 2

This commit...

1. updates to sublime-syntax "version 2"
2. re-orders header contexts sublimehq#2430
3. replaces `pop: true` by `pop: 1`

* [Regular Expression] Rename Regexp Common syntax file

This commit renames "Regexp Common" to "Regexp (Basic)" to make it follow the naming scheme

   `<main name> (<derivative>)`

which is already used by several syntaxes of this repo to express
inheritance.

* [Regular Expression] Remove unnecessary multi-set statement

* [Regular Expression] Move group-start-common context

* [Regular Expression] avoid unreached lookahead

`base-group` and `group-body` of same content but distinguish by the way
they pop, only. The latter consumes closing parens, while the former
does not.

Including the former into latter causes the lookahead `(?=\))` of the
former being added into the latter one, which doesn't make sense.

This commit therefore includes `base-literal` vs.
`base-literal-extended` into `group-body` and its extended counterpart
to exclude that unnecessary lookahead.

* [Regular Expression] Tweak extended lien comment punctuation

* [Regular Expression] Reorganize context names

This commit...

1. renames all non-popping context names to plural
2. renames some `inside-...` contexts to `...-body` as some of them
   already used the latter nameing scheme.
3. adds a dedicated context for `line-comments` in case an inherited
   syntax wants to modify them.


Notes: 

1. This commit doesn't change behavior.
2. Goal is a common naming scheme, which is important if this package
   becomes a base for inheritance.

* [Regular Expression] Rename unexpected-qualifier(s) contexts

This commit applies plural/singular for (non-)popping
unexpected-qualifier(s) contexts.

As several qualifiers may be present in `unexpected-quantifier-pop` it
feels more natural to name this context `maybe-unexpected-quantifiers`.

* [Regular Expression] Use multi-push for charset ranges

This commit creates a named context for `charset-ranges` and pushes both
`charset-range-begin` and `charset-range-end` on stack at the same time.

It slightly improves parsing performance.

* [Regular Expression] Merge escaped-chars contexts

* [Regular Expression] Add popping escaped-char contexts

... in case it needs to be addressed by an inherited syntax.

* [Regular Expression] Move backslash child contexts

This commit moves backslash related children below the `backslash`
context.

* [Regular Expression] Remove meta.literal

This commit removes `meta.literal` as it causes each literal character
to be tokenized separately, which slows down the syntax definition.

Note: Clojure's and Perl's syntax tests are relaxed to not check for
      the removed meta scope anymore.

* [Regular Expression] Reorganize backslashes context

This commit splits `backslashes` context into anchors, backrefs, backslashes

* [Regular Expression] Move group-start-common

This commit moves the group-start-common context in
Regexp.sublime-syntax to the same relative position as in the basic
syntax and removes some unnecessary quotes.

* [Regular Expression] Remove quotes

* Update Regular Expressions/RegExp (Basic).sublime-syntax

Co-authored-by: deathaxe <deathaxe@web.de>

Co-authored-by: DeathAxe <deathaxe82@googlemail.com>
Co-authored-by: deathaxe <deathaxe@web.de>
mitranim pushed a commit to mitranim/Packages that referenced this issue Mar 25, 2022
This commit...

1. updates all syntax definitions to version 2 syntax format
2. replaces pop: true by pop: 1
3: resorts main keys according to sublimehq#2430
mitranim pushed a commit to mitranim/Packages that referenced this issue Mar 25, 2022
* [Common] Add or update emacs mode patterns

Fixes sublimehq#2759

This commit...

1. sorts main header keys according to sublimehq#2430
2. adds or update `first_line_match` patterns to all appropriate syntax
   definitions in order to support emacs mode tags.

   Examples:

   // -*-c-*-
   // -*- c -*-
   // -*- mode: c -*-
   // -*- mode: c++; -*-

* [ActionScript] Fix first line pattern

* [ASP] Fix first line pattern

Moves `-*- asp -*-` to HTML (ASP).sublime-syntax

* [JSP] Add missing first line pattern

* [Java] Revert first line pattern

JSP is html like syntax and probably doesn't need or never sees such
mode comment.

* [ASP] Revert first line pattern

HTML (ASP) won't probably see any such comment, thus removing it.

* [All] Allow anything in front of emacs mode tag comments

Sync with PR sublimehq#2862

* [Haskell] Add shebang to first_line_match

* [Lua] Add shebang to first_line_match

* [ShellScript] Add DASH shebang

* [PHP] Add minor version support in shebang

Syncs modification from sublimehq#2915 to add support for
php executables such as

    php
    php7
    php71
    php7.1
    php7.1.3

to `first_line_match`'s shebang/editorconfig pattern.

* [Batch File] Add "@echo on" to first_line_match
jrappen added a commit to jrappen/Packages that referenced this issue May 31, 2022
- 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>
jrappen added a commit to jrappen/Packages that referenced this issue May 31, 2022
- 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>
jrappen added a commit to jrappen/Packages that referenced this issue May 31, 2022
- 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>
jrappen added a commit to jrappen/Packages that referenced this issue Jun 1, 2022
- 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>
@ngc92
Copy link
Contributor

ngc92 commented Nov 18, 2022

As there has been no oppositions to this, I'd personally say that this is now the standard and perhaps should be written in our RFC repository https://github.com/SublimeText/ScopeNamingGuidelines :)

In addition, it would be good to update the examples given in https://www.sublimetext.com/docs/syntax.html

skyronic pushed a commit to vuejs/vue-syntax-highlight that referenced this issue Feb 1, 2023
deathaxe added a commit to SublimeText/YamlPipelines that referenced this issue Feb 27, 2023
This commit applies main key sort order for syntax version 2

implements: sublimehq/Packages#2430
deathaxe added a commit to SublimeText/YamlPipelines that referenced this issue Feb 28, 2023
* Reorder main keys

This commit applies main key sort order for syntax version 2

implements: sublimehq/Packages#2430

* Replace pop: true with pop: 1

This commit replaces pop: true to 

1. avoid mixed styles if multiple levels of pop may be added. 
2. as some statements use `pop: 1` already.
3. it makes it more clear to be a syntax version 2.

* Distinguish interpolation and string interpolation

This commit makes sure to clear `string` scopes where needed, so only
meta.string meta.interpolation is left.

* Add interpolation support for quoted strings
Ultra-Instinct-05 added a commit to Sublime-Instincts/PyScript that referenced this issue Jan 7, 2024
This commit rearranges header keys as per
sublimehq/Packages#2430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants