Skip to content

Commit

Permalink
Fix coloring of Types with '-' in their name. (#245)
Browse files Browse the repository at this point in the history
Types like `X-Of` weren't highlighted as type.
  • Loading branch information
floitsch authored Feb 18, 2024
1 parent 60efd96 commit 6e23f81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions vscode/syntaxes/toit.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,11 +741,11 @@
"patterns": [
{
"name": "entity.name.type.toit",
"match": "\\b(?<!-)_?[A-Z][0-9]*(?<!-)\\b[?]?"
"match": "\\b(?<!-)_?[A-Z][A-Z_-]*[a-z][\\w-]*(?<!-)\\b[?]?"
},
{
"name": "entity.name.type.toit",
"match": "\\b(?<!-)_?[A-Z][A-Z_-]*[a-z][\\w-]*(?<!-)\\b[?]?"
"match": "\\b(?<!-)_?[A-Z][0-9]*_?(?<!-)\\b[?]?"
},
{
"name": "entity.name.type.shorts.toit",
Expand Down
6 changes: 4 additions & 2 deletions vscode/syntaxes/toit.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,12 @@ repository:
# - single capitalized character -> a type: 'class A'.
# - single capitalized character followed by a number -> also a type: `class C1`.
# - capitalized identifier with at least on lower-case character: a type.
- name: entity.name.type.toit
match: \b(?<!-)_?[A-Z][0-9]*(?<!-)\b[?]?

# Match the longer type first, so that we match something like `X-Of`.
- name: entity.name.type.toit
match: \b(?<!-)_?[A-Z][A-Z_-]*[a-z][\w-]*(?<!-)\b[?]?
- name: entity.name.type.toit
match: \b(?<!-)_?[A-Z][0-9]*_?(?<!-)\b[?]?
- name: entity.name.type.shorts.toit
match: \b(?<!-)(int|bool|float|string)(?<!-)\b[?]?
- name: entity.name.type.any_none.toit
Expand Down

0 comments on commit 6e23f81

Please sign in to comment.