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

Syntax update #7

Merged
merged 9 commits into from
Jun 5, 2018
Merged

Syntax update #7

merged 9 commits into from
Jun 5, 2018

Conversation

ehuss
Copy link
Collaborator

@ehuss ehuss commented Oct 1, 2017

Broad overview of changes:

  • Update the syntax to use Sublime's new sublime-syntax format.
  • Add complete support for everything in TOML 0.4 and be a little more robust in rejecting invalid syntax.
  • Update some scopes to match Sublime's naming convention.
  • (Bonus) Add local Goto Symbol support.

This fixes #6 and #5.

Detailed changes:

  • Boolean: Change scope constant.other.boolean to constant.language.

  • Integer/Float:

    • Support _ separator.
    • Assign keyword.operator.arithmetic to +- prefix.
    • Reject 0. and accept +0 and -0.
  • Datetime: Support all variants.

  • Strings:

    • Give escapes specific constant.character.escape scope, and reject invalid escapes.
    • Give the begin/end quotes separate scopes punctuation.definition.string.begin/end
    • Change scope of "double quoted strings" from string.quoted.*single* to string.quoted.*double*.
  • Key/value:

    • Key scope changed to entity.name.tag from keyword.key.
    • Equals scope changed to punctuation.definition.key-value from punctuation.definition.keyValuePair.
    • Keys now use the "string" contexts to better handle strings (such as escape highlighting).
    • Don't aggressively red-highlight while typing a key.
  • Array:

    • Give the open/close brackets separate punctuation.definition.array.begin/end scopes.
    • Give , separator the punctuation.separator.array scope.
    • Better rejection of invalid arrays.
  • Inline-table:

    • Give the open/close brackets separate punctuation.definition.inline-table.begin/end scopes.
    • Give , separator the punctuation.separator.inline-table scope.
    • Better rejection of invalid inline tables.
  • Table names:

    • Remove meta.tag.table (it was scoping the entire file).
    • Change name scope to entity.name.table from entity.other.attribute-name.table.
    • Support comments after the table name.
    • Give opening/closing brackets separate punctuation.definition.table.begin/end scopes.
    • Support quoted names in tables.
    • Support spaces separating parts of table name.

No changes to the syntax, yet.  This includes a syntax test.
constant.other.boolean -> constant.language
- Support _ separator.
- Assign keyword.operator.arithmetic to +- prefix.
- Reject 0. and accept +0 and -0.
This adds support for all the other datetime variants.
- Give escapes specific constant.character.escape scope,
  and reject invalid escapes.
- Give the begin/end quotes separate scopes
  punctuation.definition.string.begin/end
- Change scope of "double quoted strings" from string.quoted.*single*
  to string.quoted.*double*.
These are grouped together because the data-types context was changed to pop
off the stack once a successful match was made to make it more robust.

- Key/value changes:
  - Key scope changed to "entity.name.tag" from "keyword.key".
  - Equals scope changed to "punctuation.definition.key-value" from
    "punctuation.definition.keyValuePair".
  - Keys now use the "string" contexts to better handle strings (such as
    escape highlighting).
  - Don't aggressively red-highlight while typing a key.

- Array changes:
  - Give the open/close brackets separate
    punctuation.definition.array.begin/end scopes.
  - Give , separator the punctuation.separator.array scope.
  - Better rejection of invalid arrays.

- Inline-table changes:
  - Give the open/close brackets separate
    punctuation.definition.inline-table.begin/end scopes.
  - Give , separator the punctuation.separator.inline-table scope.
  - Better rejection of invalid inline tables.
- Remove meta.tag.table (it was scoping the entire file).
- Change name scope to "entity.name.table" from
  "entity.other.attribute-name.table".
- Support comments after the table name.
- Give opening/closing brackets separate
  punctuation.definition.table.begin/end scopes.
- Supported quoted names in tables.
- Support spaces separating parts of table name.
@sharkdp sharkdp mentioned this pull request May 2, 2018
@slimsag
Copy link

slimsag commented Jun 4, 2018

Would be great to get this merged in! Looks like there are a lot of valuable improvements made here

@hinxx
Copy link

hinxx commented Jun 5, 2018

Works as expect for me! Thanks!

@jasonwilliams jasonwilliams merged commit 4b0e58b into jasonwilliams:master Jun 5, 2018
@FichteFoll
Copy link

Big thanks to you, @ehuss! Now the syntax is actually usable 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to sublime-syntax
5 participants