Skip to content

Commit 9560e64

Browse files
authored
Merge pull request #4 from anka-213/fix-textmate-grammar
Add support for char literals in textmate grammar
2 parents c302a2a + a1b0d18 commit 9560e64

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

language-configuration.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@
1313
],
1414
// symbols that are auto closed when typing
1515
"autoClosingPairs": [
16-
["{", "}"],
17-
["[", "]"],
18-
["(", ")"],
19-
["\"", "\""],
20-
["'", "'"]
16+
// Should not autoclose in char literals,
17+
// but the only option is string literals, so that'll have to do
18+
{ "open": "{", "close": "}", "notIn": ["string"] },
19+
{ "open": "{-", "close": "-}", "notIn": ["string"] },
20+
{ "open": "[", "close": "]", "notIn": ["string"] },
21+
{ "open": "(", "close": ")", "notIn": ["string"] },
22+
{ "open": "\"", "close": "\"", "notIn": ["string"] },
23+
{ "open": "`", "close": "`", "notIn": ["string", "comment"]},
2124
],
2225
// symbols that can be used to surround a selection
2326
"surroundingPairs": [
2427
["{", "}"],
2528
["[", "]"],
2629
["(", ")"],
2730
["\"", "\""],
28-
["'", "'"]
29-
]
31+
["`", "`"]
32+
],
33+
"folding": {
34+
"offSide": true
35+
}
3036
}

syntaxes/unison.tmLanguage.json

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"include": "#numeric"
1010
},{
1111
"include": "#text"
12+
},{
13+
"include": "#char"
1214
},{
1315
"include": "#match_with"
1416
},{
@@ -69,6 +71,8 @@
6971
"include": "#eof_comment"
7072
},{
7173
"include": "#line_comment"
74+
},{
75+
"include": "#block_comment"
7276
}]
7377
},
7478
"eof_comment": {
@@ -155,13 +159,37 @@
155159
},
156160
"text": {
157161
"name": "string.quoted.double.unison",
158-
"match": "(\")(.*?)(\")",
162+
"begin": "\"",
163+
"end": "\"",
164+
"beginCaptures": {
165+
"0": {
166+
"name": "punctuation.definition.string.begin.unison"
167+
}
168+
},
169+
"endCaptures": {
170+
"0": {
171+
"name": "punctuation.definition.string.end.unison"
172+
}
173+
},
174+
"patterns": [
175+
{
176+
"name": "constant.character.escape.unison",
177+
"match": "\\\\."
178+
}
179+
]
180+
},
181+
"char": {
182+
"name": "string.quoted.single.unison",
183+
"match": "([?])(([\\\\].)|([^\\\\]))",
159184
"captures": {
160185
"1": {
161186
"name": "punctuation.definition.string.begin.unison"
162187
},
163188
"3": {
164-
"name": "punctuation.definition.string.end.unison"
189+
"name": "constant.character.escape.unison"
190+
},
191+
"4": {
192+
"name": "string.quoted.single.unison"
165193
}
166194
}
167195
},

0 commit comments

Comments
 (0)