Skip to content

Commit 24c7cb5

Browse files
authored
Quick fix release (#331)
* Display invalid.illegal in red in development env * Split screen language into its own file * Link some fallback patterns into ATL and screen blocks We'll need to take some time to set this up properly to prevent highlighting syntax in blocks that don't support them. For now this will do though * Disable multi-line string tags * Added hbox support * Fix call screen
1 parent f71c4ab commit 24c7cb5

File tree

6 files changed

+577
-281
lines changed

6 files changed

+577
-281
lines changed

examples/.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
},
88
"editor.tokenColorCustomizations": {
99
"textMateRules": [
10+
{
11+
"scope": "debug.invalid.illegal.unmatched.renpy",
12+
"settings": {
13+
"foreground": "#f00"
14+
}
15+
},
1016
{
1117
"scope": "renpy.meta.plain",
1218
"settings": {

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,16 @@
6969
"path": "./syntaxes/renpy.tmLanguage.json"
7070
},
7171
{
72-
"scopeName": "source.renpy.python",
73-
"path": "./syntaxes/renpy.python.tmLanguage.json"
72+
"scopeName": "source.renpy.screen",
73+
"path": "./syntaxes/renpy.screen.tmLanguage.json"
7474
},
7575
{
7676
"scopeName": "source.renpy.atl",
7777
"path": "./syntaxes/renpy.atl.tmLanguage.json"
78+
},
79+
{
80+
"scopeName": "source.renpy.python",
81+
"path": "./syntaxes/renpy.python.tmLanguage.json"
7882
}
7983
],
8084
"snippets": [

syntaxes/renpy.atl.tmLanguage.json

Lines changed: 82 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@
77
"repository": {
88
"atl": {
99
"comment": "https://www.renpy.org/doc/html/atl.html#atl-syntax-and-semantics",
10-
"patterns": [{ "include": "#atl-keywords" }, { "include": "#atl-blocks" }, { "include": "#atl-simple-expression" }, { "include": "#atl-warper" }, { "include": "#atl-event" }, { "include": "#atl-on" }, { "include": "#atl-function" }]
10+
"patterns": [
11+
{ "include": "source.renpy#conditionals" },
12+
{ "include": "#atl-keywords" },
13+
{ "include": "#atl-warper" },
14+
{ "include": "#atl-blocks" },
15+
{ "include": "#atl-simple-expression" },
16+
{ "include": "#atl-event" },
17+
{ "include": "#atl-on" },
18+
{ "include": "#atl-function" },
19+
{ "include": "#atl-fallback" }
20+
]
1121
},
1222
"atl-build-in-properties": {
1323
"comment": "https://www.renpy.org/doc/html/atl.html#list-of-transform-properties",
@@ -24,67 +34,67 @@
2434
},
2535
{
2636
"comment": "position props (int, absolute, or a float)",
27-
"name": "support.type.property-name.transform.renpy",
37+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
2838
"match": "\\b(?<!\\.)(?:xpos|ypos|xanchor|yanchor|xcenter|ycenter|radius)\\b"
2939
},
3040
{
3141
"comment": "position pair props",
32-
"name": "support.type.property-name.transform.renpy",
42+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
3343
"match": "\\b(?<!\\.)(?:pos|anchor|xycenter|around|alignaround|matrixanchor)\\b"
3444
},
3545
{
3646
"comment": "float props",
37-
"name": "support.type.property-name.transform.renpy",
47+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
3848
"match": "\\b(?<!\\.)(?:xalign|yalign|zoom|xzoom|yzoom|alpha|additive|angle|delay|events|zpos)\\b"
3949
},
4050
{
4151
"comment": "float pair props",
42-
"name": "support.type.property-name.transform.renpy",
52+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
4353
"match": "\\b(?<!\\.)(?:align|knot)\\b"
4454
},
4555
{
4656
"comment": "int props",
47-
"name": "support.type.property-name.transform.renpy",
57+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
4858
"match": "\\b(?<!\\.)(?:xoffset|yoffset|xtile|ytile)\\b"
4959
},
5060
{
5161
"comment": "int pair props",
52-
"name": "support.type.property-name.transform.renpy",
62+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
5363
"match": "\\b(?<!\\.)(?:offset)\\b"
5464
},
5565
{
5666
"comment": "boolean props",
57-
"name": "support.type.property-name.transform.renpy",
67+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
5868
"match": "\\b(?<!\\.)(?:rotate_pad|transform_anchor|nearest|crop_relative|subpixel|zzoom)\\b"
5969
},
6070
{
6171
"comment": "('#float' | None)",
62-
"name": "support.type.property-name.transform.renpy",
72+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
6373
"match": "\\b(?<!\\.)(?:rotate|xpan|ypan|blur)\\b"
6474
},
6575
{
6676
"comment": "('#position' | None)",
67-
"name": "support.type.property-name.transform.renpy",
77+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
6878
"match": "\\b(?<!\\.)(?:xsize|ysize)\\b"
6979
},
7080
{
7181
"comment": "('\\(int, int, int, int\\)' | '\\(float, float, float, float\\)' | None)",
72-
"name": "support.type.property-name.transform.renpy",
82+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
7383
"match": "\\b(?<!\\.)(?:crop)\\b"
7484
},
7585
{
7686
"comment": "('\\(int, int\\)' | None)",
77-
"name": "support.type.property-name.transform.renpy",
87+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
7888
"match": "\\b(?<!\\.)(?:corner1|corner2)\\b"
7989
},
8090
{
8191
"comment": "('\\(position, position\\)' | None)",
82-
"name": "support.type.property-name.transform.renpy",
92+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
8393
"match": "\\b(?<!\\.)(?:xysize)\\b"
8494
},
8595
{
8696
"comment": "('#string' | None)",
87-
"name": "support.type.property-name.transform.renpy",
97+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
8898
"match": "\\b(?<!\\.)(?:fit)\\b"
8999
},
90100
{
@@ -94,26 +104,25 @@
94104
},
95105
{
96106
"comment": "('#Matrix' | '#MatrixColor' | None)",
97-
"name": "support.type.property-name.transform.renpy",
107+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
98108
"match": "\\b(?<!\\.)(?:matrixcolor)\\b"
99109
},
100110
{
101111
"comment": "('#Matrix' | '#TransformMatrix' | None)",
102-
"name": "support.type.property-name.transform.renpy",
112+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
103113
"match": "\\b(?<!\\.)(?:matrixtransform)\\b"
104114
},
105115
{
106116
"comment": "('#bool' | '#float' | '\\(float, float, float\\)')",
107-
"name": "support.type.property-name.transform.renpy",
117+
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
108118
"match": "\\b(?<!\\.)(?:perspective)\\b"
109119
}
110120
]
111121
},
112122
"atl-simple-expression": {
113123
"patterns": [
114-
{ "include": "source.renpy#expressions" },
124+
{ "include": "source.renpy#renpy-only-expressions" },
115125
{ "include": "#atl-build-in-properties" },
116-
{ "include": "source.renpy.python#literal" },
117126
{ "include": "source.renpy.python#member-access" },
118127
{ "include": "source.renpy.python#illegal-operator" },
119128
{ "include": "source.renpy.python#operator" },
@@ -132,7 +141,13 @@
132141
{ "include": "source.renpy.python#special-variables" },
133142
{ "include": "source.renpy.python#ellipsis" },
134143
{ "include": "source.renpy.python#punctuation" },
135-
{ "include": "source.renpy.python#line-continuation" }
144+
{ "include": "source.renpy.python#line-continuation" },
145+
{
146+
"comment": "Tokenize identifiers",
147+
"name": "variable.name.python",
148+
"match": "\\b([[:alpha:]_]\\w*)\\b"
149+
},
150+
{ "include": "source.renpy#whitespace" }
136151
]
137152
},
138153
"atl-expression": {
@@ -196,6 +211,10 @@
196211
},
197212
"end": "$",
198213
"patterns": [{ "include": "#atl-expression" }]
214+
},
215+
{
216+
"comment": "TODO: This is a temporary include until we have proper support for all ATL keywords",
217+
"include": "source.renpy#keywords"
199218
}
200219
]
201220
},
@@ -240,7 +259,7 @@
240259
{ "include": "source.renpy.python#builtin-possible-callables" },
241260
{ "include": "#atl-build-in-events" },
242261
{
243-
"name": "entity.name.function.renpy meta.function-call.generic.renpy",
262+
"name": "entity.name.function.event.renpy meta.function-call.generic.renpy",
244263
"match": "\\b([[:alpha:]_]\\w*)\\b"
245264
}
246265
]
@@ -250,7 +269,7 @@
250269
{ "include": "source.renpy.python#builtin-possible-callables" },
251270
{ "include": "#atl-build-in-events" },
252271
{
253-
"name": "entity.name.function.renpy",
272+
"name": "entity.name.function.event.def.renpy",
254273
"match": "\\b([[:alpha:]_]\\w*)\\b"
255274
}
256275
]
@@ -296,7 +315,7 @@
296315
"patterns": [
297316
{ "include": "source.renpy.python#builtin-possible-callables" },
298317
{
299-
"name": "entity.name.function.renpy meta.function-call.generic.renpy",
318+
"name": "entity.name.function.atl-function.renpy meta.function-call.generic.renpy",
300319
"match": "\\b([[:alpha:]_]\\w*)\\b"
301320
}
302321
]
@@ -314,20 +333,56 @@
314333
{ "include": "#atl-build-in-warpers" },
315334
{ "include": "#atl-build-in-properties" },
316335
{
317-
"name": "entity.name.function.renpy meta.function-call.generic.renpy",
336+
"name": "entity.name.function.warper.renpy meta.function-call.generic.renpy",
318337
"match": "\\b([[:alpha:]_]\\w*)\\b"
319338
}
320339
]
321340
},
341+
"atl-warper-broken": {
342+
"comment": "TODO: This doesn't work right now, we can't assume all identifiers are warpers",
343+
"name": "meta.atl.warper.renpy",
344+
"begin": "(?<=^[ \\t]*)([[:alpha:]_]\\w*)\\b",
345+
"beginCaptures": {
346+
"1": { "patterns": [{ "include": "#atl-warper-name" }] }
347+
},
348+
"end": "(?=[ \\t]*#)|$",
349+
"patterns": [{ "include": "#atl-simple-expression" }]
350+
},
351+
322352
"atl-warper": {
323-
"comment": "https://www.renpy.org/doc/html/atl.html#warpers",
353+
"comment": "(TODO: For now we only support build-in warper highlighting) https://www.renpy.org/doc/html/atl.html#warpers",
324354
"name": "meta.atl.warper.renpy",
325-
"begin": "\\b(?<!\\.)([[:alpha:]_]\\w*)\\b[ \\t]*",
355+
"begin": "(?<=^[ \\t]*)(linear|ease|easein|easeout|ease_back|ease_bounce|ease_circ|ease_cubic|ease_elastic|ease_expo|ease_quad|ease_quart|ease_quint|easein_back|easein_bounce|easein_circ|easein_cubic|easein_elastic|easein_expo|easein_quad|easein_quart|easein_quint|easeout_back|easeout_bounce|easeout_circ|easeout_cubic|easeout_elastic|easeout_expo|easeout_quad|easeout_quart|easeout_quint)\\b",
326356
"beginCaptures": {
327357
"1": { "patterns": [{ "include": "#atl-warper-name" }] }
328358
},
329-
"end": "(?!\\G)",
359+
"end": "(?=[ \\t]*#)|$",
330360
"patterns": [{ "include": "#atl-simple-expression" }]
361+
},
362+
363+
"atl-fallback": {
364+
"comment": "TODO: This is a temp fix for missing pattern references",
365+
"patterns": [{ "include": "source.renpy" }]
366+
},
367+
368+
"transform": {
369+
"contentName": "meta.transform.block.renpy",
370+
"begin": "^([ \\t]+)?(transform)\\b[ \\t]*(.*)?(:)",
371+
"beginCaptures": {
372+
"1": { "name": "punctuation.whitespace.leading.renpy" },
373+
"2": { "name": "keyword.transform.renpy" },
374+
"3": {
375+
"patterns": [
376+
{
377+
"name": "variable.name.transform.renpy",
378+
"match": "\\b([[:alpha:]_]\\w*)\\b"
379+
}
380+
]
381+
},
382+
"4": { "name": "punctuation.section.atl.begin.renpy" }
383+
},
384+
"end": "^(?=(?!\\1)[ \\t]*[^\\s#]|\\1[^\\s#])",
385+
"patterns": [{ "include": "#atl" }]
331386
}
332387
}
333388
}

syntaxes/renpy.python.tmLanguage.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
},
261261
"member-access": {
262262
"name": "meta.member.access.python",
263+
"contentName": "variable.name.python",
263264
"begin": "(\\.)\\s*(?!\\.)",
264265
"end": "(?<=\\S)(?=\\W)|(^|(?<=\\s))(?=[^\\\\\\w\\s])|$",
265266
"beginCaptures": {
@@ -309,6 +310,7 @@
309310
},
310311
"odd-function-call": {
311312
"comment": "A bit obscured function call where there may have been anarbitrary number of other operations to get the function.E.g. \"arr[idx](args)\"",
313+
"name": "meta.odd-function-call.python",
312314
"begin": "(?<=\\]|\\))\\s*(?=\\()",
313315
"end": "(\\))",
314316
"endCaptures": {

0 commit comments

Comments
 (0)