Skip to content

Commit f9c5d4f

Browse files
chore: Bump to 1.1.0 with updated grammar
1 parent 91c4b23 commit f9c5d4f

5 files changed

Lines changed: 64 additions & 16 deletions

File tree

extension.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
id = "objectscript"
22
name = "InterSystems ObjectScript"
3-
version = "1.0.1"
3+
version = "1.1.0"
44
schema_version = 1
55
authors = ["Dave McCaldon <davem@intersystems.com>"]
66
description = "InterSystems IRIS ObjectScript Extension"
77
repository = "https://github.com/intersystems/zed-objectscript"
88

9-
[grammars.objectscript_udl]
9+
[grammars.objectscript]
1010
repository = "https://github.com/intersystems/tree-sitter-objectscript"
11-
commit = "320a28654593428e5a7da76b034ce9d5a1cc528a"
11+
commit = "c0f4461e18d0ac9f4625cddebfeb34ef13f99f8a"
1212
path = "udl"

languages/objectscript_udl/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name = "objectscript_udl"
2-
grammar = "objectscript_udl"
1+
name = "objectscript"
2+
grammar = "objectscript"
33
path_suffixes = ["cls"]
44
line_comments = ["// ", ";", ";;", "#;"]
55
autoclose_before = ";:.,=}])>` \n\t\""

languages/objectscript_udl/highlights.scm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
; Numeric literals
2222
; e.g. 12345
23-
(integer_literal) @number
24-
(decimal_literal) @float
23+
(numeric_literal) @number
2524

2625
; System variable name
2726
; e.g. $IO, $SY[SYTEM]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; Indentation rules for ObjectScript UDL (Zed)
2+
3+
; --- Class Definition ---
4+
; Indent everything inside the class_body’s braces.
5+
(class_body "{" @start "}" @end) @indent
6+
7+
; If individual class statements can wrap, indent their interior.
8+
(class_body (class_statement) @indent)
9+
10+
; --- Command arguments that may wrap across lines ---
11+
(command_write (keyword_write) (write_argument) @indent)
12+
(command_set (keyword_set) (set_argument) @indent)
13+
(command_do (keyword_do) (do_parameter) @indent)
14+
(command_kill (keyword_kill) (kill_argument) @indent)
15+
(command_lock (keyword_lock) (command_lock_argument) @indent)
16+
(command_read (keyword_read) (read_argument) @indent)
17+
(command_open (keyword_open) (open_parameter) @indent)
18+
(command_close (keyword_close) (close_parameter) @indent)
19+
(command_use (keyword_use) (use_parameter) @indent)
20+
21+
; --- Block-style commands delimited by braces ---
22+
(command_while "{" @start "}" @end) @indent
23+
(command_for "{" @start "}" @end) @indent
24+
(command_if "{" @start "}" @end) @indent
25+
(elseif_block "{" @start "}" @end) @indent
26+
(else_block "{" @start "}" @end) @indent
27+
28+
; --- Old-style FOR / IF / ELSE ---
29+
(command_for (for_parameter) @indent)
30+
(command_for (statement) @indent)
31+
(command_if (expression) @indent)
32+
(command_if (statement) @indent)
33+
(command_else (statement) @indent)
34+
35+
; --- Generic fallbacks for braces/parentheses spanning multiple lines ---
36+
(_ "{" "}" @end) @indent
37+
(_ "(" ")" @end) @indent
38+

languages/objectscript_udl/injections.scm

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,31 @@
44
(embedded_html
55
(angled_bracket_fenced_text) @injection.content
66
(#set! injection.language "html")
7+
(#set! injection.include-children "false")
8+
(#set! injection.combined "true")
79
)
810

911
(embedded_sql
1012
(_
1113
(paren_fenced_text) @injection.content
1214
)
1315
(#set! injection.language "sql")
16+
(#set! injection.include-children "false")
17+
(#set! injection.combined "true")
1418
)
1519

1620
(embedded_js
1721
(angled_bracket_fenced_text) @injection.content
1822
(#set! injection.language "javascript")
23+
(#set! injection.include-children "false")
24+
(#set! injection.combined "true")
1925
)
2026

2127
(embedded_xml
2228
(angled_bracket_fenced_text) @injection.content
2329
(#set! injection.language "xml")
30+
(#set! injection.include-children "false")
31+
(#set! injection.combined "true")
2432
)
2533

2634
([
@@ -61,14 +69,16 @@
6169
)
6270

6371
; XDATA blocks. There's a MimeType keyword that defines the content-type
64-
; but we need to individually match each one so that we can specify the
65-
; name of the tree-sitter grammar to inject.
72+
; To prevent overlapping matches, we use a different body for the case where
73+
; no MimeType is given and default to XML, otherwise we extract the language
74+
; from the mimetype.
75+
6676
(xdata
6777
keywords:
6878
(_
6979
(kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype "\"text/markdown\""))
7080
)
71-
body: (_) @injection.content
81+
body: (xdata_body_content_any) @injection.content
7282
(#set! injection.language "markdown")
7383
(#set! injection.include-children "true")
7484
)
@@ -78,7 +88,8 @@
7888
(_
7989
(kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype "\"text/xml\""))
8090
)
81-
body: (_) @injection.content
91+
; NOTE: Since MimeType is given, we match xdata_body_content_any not xml
92+
body: (xdata_body_content_any) @injection.content
8293
(#set! injection.language "xml")
8394
(#set! injection.include-children "true")
8495
)
@@ -88,7 +99,7 @@
8899
(_
89100
(kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype "\"text/html\""))
90101
)
91-
body: (_) @injection.content
102+
body: (xdata_body_content_any) @injection.content
92103
(#set! injection.language "html")
93104
(#set! injection.include-children "true")
94105
)
@@ -98,7 +109,7 @@
98109
(_
99110
(kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype "\"application/json\""))
100111
)
101-
body: (_) @injection.content
112+
body: (xdata_body_content_any) @injection.content
102113
(#set! injection.language "json")
103114
(#set! injection.include-children "true")
104115
)
@@ -108,14 +119,14 @@
108119
(_
109120
(kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype "\"text/css\""))
110121
)
111-
body: (_) @injection.content
122+
body: (xdata_body_content_any) @injection.content
112123
(#set! injection.language "css")
113124
(#set! injection.include-children "true")
114125
)
115126

116-
; Match other less specific XDATAs
127+
; Match an unspecified XDATA -- defaults to XML
117128
(xdata
118-
body: (_) @injection.content
129+
body: (xdata_body_content_xml) @injection.content
119130
(#set! injection.language "xml")
120131
(#set! injection.include-children "true")
121132
)

0 commit comments

Comments
 (0)