Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[RFC] Sublime Syntax Main Key Sort Order

Open deathaxe opened this issue 5 years ago • 2 comments

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 avatar Jul 22 '20 19:07 deathaxe

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 :)

keith-hall avatar Oct 12 '21 20:10 keith-hall

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

ngc92 avatar Nov 18 '22 20:11 ngc92