Skip to content

Commit

Permalink
Merge branch 'BarryNolte/issue133' of https://github.com/BarryNolte/d…
Browse files Browse the repository at this point in the history
…2-vscode into BarryNolte/issue133
  • Loading branch information
BarryNolte committed Apr 23, 2024
2 parents 3b0ddc1 + f0db83d commit 4955ebd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
29 changes: 27 additions & 2 deletions syntaxes/d2.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"name": "d2",
"scopeName": "source.d2",
"patterns": [
{
"include": "#block_comment"
},
{
"include": "#comment"
},
Expand Down Expand Up @@ -272,7 +275,7 @@
},
{
"name": "keyword.reserved.d2",
"match": "(?:grid\\-gap|vertical\\-gap|horizontal\\-gap|classes|direction|grid\\-columns|grid\\-rows|text\\-transform|shape|layers|steps|tooltip|font|bold|italic|underline|top|left|icon|constraint|near|opacity|stroke|fill\\-pattern|fill|filled|stroke\\-width|width|height|double\\-border|border\\-radius|source\\-arrowhead|target\\-arrowhead|link|stroke\\-dash|font\\-size|font\\-color|shadow|multiple|3d|animated|class|label|style|import|vars|scenarios|on_click|src|dst)(?=\\s*[\\n#;\\[\\]{}|$'\":.<>*&()]|-+-|-+>|-+\\*)"
"match": "(?:grid\\-gap|vertical\\-gap|horizontal\\-gap|classes|direction|grid\\-columns|grid\\-rows|text\\-transform|shape|layers|steps|tooltip|font|bold|italic|underline|top|left|icon|constraint|near|opacity|stroke|fill\\-pattern|fill|filled|stroke\\-width|width|height|double\\-border|border\\-radius|source\\-arrowhead|target\\-arrowhead|link|stroke\\-dash|font\\-size|font\\-color|shadow|multiple|3d|animated|class|label|style|vars|scenarios|on_click|src|dst)(?=\\s*[\\n#;\\[\\]{}|$'\":.<>*&()]|-+-|-+>|-+\\*)"
},
{
"name": "punctuation.period.d2",
Expand Down Expand Up @@ -423,6 +426,9 @@
"begin": "\\[",
"end": "\\]",
"patterns": [
{
"include": "#block_comment"
},
{
"include": "#comment"
},
Expand Down Expand Up @@ -516,7 +522,26 @@
},
"comment": {
"name": "comment.line.number-sign.d2",
"match": "#.*"
"match": "#.*$"
},
"block_comment": {
"patterns": [
{
"name": "comment.block.d2",
"begin": "\"\"\"",
"end": "\"\"\"",
"beginCaptures": {
"0": {
"name": "punctuation.comment.start.d2"
}
},
"endCaptures": {
"0": {
"name": "punctuation.comment.end.d2"
}
}
}
]
},
"debug": {
"patterns": [
Expand Down
16 changes: 13 additions & 3 deletions syntaxes/d2.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ name: d2
scopeName: source.d2
patterns:
# - include: '#debug'
- include: "#block_comment"
- include: "#comment"
- include: "#semicolon"
- include: "#spread_substitution"
Expand Down Expand Up @@ -145,7 +146,7 @@ repository:
- include: "#key"
- include: "#error"
- name: keyword.reserved.d2
match: '(?:grid\-gap|vertical\-gap|horizontal\-gap|classes|direction|grid\-columns|grid\-rows|text\-transform|shape|layers|steps|tooltip|font|bold|italic|underline|top|left|icon|constraint|near|opacity|stroke|fill\-pattern|fill|filled|stroke\-width|width|height|double\-border|border\-radius|source\-arrowhead|target\-arrowhead|link|stroke\-dash|font\-size|font\-color|shadow|multiple|3d|animated|class|label|style|import|vars|scenarios|on_click|src|dst)(?=\s*[\n#;\[\]{}|$''":.<>*&()]|-+-|-+>|-+\*)'
match: '(?:grid\-gap|vertical\-gap|horizontal\-gap|classes|direction|grid\-columns|grid\-rows|text\-transform|shape|layers|steps|tooltip|font|bold|italic|underline|top|left|icon|constraint|near|opacity|stroke|fill\-pattern|fill|filled|stroke\-width|width|height|double\-border|border\-radius|source\-arrowhead|target\-arrowhead|link|stroke\-dash|font\-size|font\-color|shadow|multiple|3d|animated|class|label|style|vars|scenarios|on_click|src|dst)(?=\s*[\n#;\[\]{}|$''":.<>*&()]|-+-|-+>|-+\*)'
- name: punctuation.period.d2
match: '\.'
- name: keyword.operator.glob.d2
Expand Down Expand Up @@ -219,6 +220,7 @@ repository:
begin: '\['
end: '\]'
patterns:
- include: "#block_comment"
- include: "#comment"
- include: "#semicolon"
- include: "#substitution"
Expand Down Expand Up @@ -255,10 +257,18 @@ repository:
semicolon:
name: punctuation.semicolon.d2
match: ";"
# Single line comment
comment:
name: comment.line.number-sign.d2
match: "#.*"

match: "#.*$"
# Multi line comment
block_comment:
patterns:
- name: comment.block.d2
begin: '"""'
end: '"""'
beginCaptures: { 0: { name: punctuation.comment.start.d2 }}
endCaptures: { 0: { name: punctuation.comment.end.d2 }}
# See comment near top for debug's purpose.
debug:
patterns:
Expand Down

0 comments on commit 4955ebd

Please sign in to comment.