Skip to content

Commit 9c6909f

Browse files
Merge pull request #1 from hkimura-intersys/zed-extension-update
chore: bump version to 1.2.0
2 parents f9c5d4f + 92185e1 commit 9c6909f

13 files changed

Lines changed: 544 additions & 377 deletions

File tree

extension.toml

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

99
[grammars.objectscript]
1010
repository = "https://github.com/intersystems/tree-sitter-objectscript"
11-
commit = "c0f4461e18d0ac9f4625cddebfeb34ef13f99f8a"
11+
commit = "78f0fdb872bbb65084ee9a0d3ad44093cc913684"
1212
path = "udl"
13+
14+
[grammars.objectscript_core]
15+
repository = "https://github.com/intersystems/tree-sitter-objectscript"
16+
commit = "78f0fdb872bbb65084ee9a0d3ad44093cc913684"
17+
path = "core"
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
; EXPR GRAMMAR HIGHLIGHTS
2+
(pattern_expression) @string.regex
3+
(numeric_literal) @number
4+
(string_literal) @string
5+
6+
(keyword_pound_pound_class) @keyword
7+
(keyword_pound_pound_super) @keyword
8+
(system_defined_variable) @variable.special
9+
(system_defined_function) @variable.special
10+
(sql_field_modifier) @variable.special
11+
(property_name) @property
12+
(method_name) @function
13+
(parameter_name) @property
14+
(class_name) @type
15+
(macro) @constant
16+
17+
(routine_ref) @variable
18+
(sql_field_identifier) @variable
19+
(lvn) @variable
20+
(gvn) @variable
21+
(ssvn) @variable
22+
(instance_variable) @variable
23+
(objectscript_identifier) @variable
24+
25+
(method_arg) @variable.parameter
26+
; I didn't include ( or ) in this, because they are often grouped
27+
; as part of a sequence that gets turned into a single token, so they
28+
; don't get matched, and one ends up getting colored differently than the other.
29+
[
30+
"_"
31+
","
32+
":"
33+
"."
34+
".."
35+
"..."
36+
"'["
37+
"']"
38+
"']]"
39+
"\""
40+
"\"\""
41+
"["
42+
"]"
43+
"]]"
44+
"{"
45+
"}"
46+
"/"
47+
"\\"
48+
"#"
49+
"|"
50+
"||"
51+
"/"
52+
"/"
53+
"$$"
54+
] @punctuation
55+
56+
[
57+
"'&"
58+
"&"
59+
"&&"
60+
"'<"
61+
"'="
62+
"'>"
63+
"^"
64+
"-"
65+
"^$"
66+
"+"
67+
"<"
68+
"<="
69+
"="
70+
">"
71+
">="
72+
"@"
73+
"*"
74+
"**"
75+
"'"
76+
"'!"
77+
"'?"
78+
"!"
79+
"?"
80+
] @operator
81+
82+
(json_string_literal) @string
83+
(json_boolean_literal) @boolean
84+
(json_number_literal) @number
85+
(json_null_literal) @string
86+
(bracket) @punctuation.bracket
87+
88+
; CORE GRAMMAR HIGHLIGHTS
89+
(locktype) @variable
90+
91+
(macro_arg) @variable
92+
(macro_value) @constant.builtin
93+
keyword: (_) @keyword
94+
95+
(embedded_js_special_case_complete) @punctuation.special
96+
(embedded_sql_marker) @punctuation.special
97+
(embedded_sql_reverse_marker) @punctuation.special
98+
(html_marker) @punctuation.special
99+
(html_marker_reversed) @punctuation.special
100+
101+
(attribute) @attribute
102+
103+
(open_keywords) @attribute
104+
(use_keywords) @attribute
105+
(close_parameter_option_value) @attribute
106+
107+
[
108+
(line_comment_1)
109+
(line_comment_2)
110+
(line_comment_3)
111+
(line_comment_4)
112+
(block_comment)
113+
] @comment
114+
115+
(tag) @tag
116+
117+
[
118+
"--"
119+
";"
120+
"//"
121+
"#;"
122+
"##;"
123+
"$"
124+
] @punctuation
125+
126+
; UDL grammar highlights
127+
[
128+
(method_keyword_codemode_expression)
129+
(call_method_keyword)
130+
(method_keyword)
131+
(class_keywords)
132+
(query_keywords)
133+
(trigger_keyword)
134+
(method_keyword_language)
135+
(relationship_keyword)
136+
(foreignkey_keyword)
137+
(parameter_keyword)
138+
(projection_keyword)
139+
(index_keyword)
140+
(index_keyword_extent)
141+
(xdata_keyword)
142+
(xdata_keyword_mimetype)
143+
(property_keyword)
144+
145+
] @attribute
146+
147+
(documatic_line) @comment.doc
148+
149+
(query_name) @property
150+
(property_name) @property
151+
(relationship_name) @property
152+
(foreignkey_name) @property
153+
(parameter_name) @property
154+
(projection_name) @property
155+
(index_name) @property
156+
(xdata_name) @property
157+
(storage_name) @property
158+
159+
(return_type) @type.builtin
160+
(typename) @type
161+
(parameter_type) @type.builtin
162+
(index_type) @type.builtin
163+
(projection_type) @type.builtin
164+
(property_type) @type.builtin
165+
(index_property_type) @type.builtin
166+
167+
(identifier) @variable

languages/objectscript/indents.scm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
("{" @indents.begin)
2+
("}" @indents.end)
3+
4+
5+
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
; Core grammar injections
2+
(embedded_html
3+
(angled_bracket_fenced_text) @injection.content
4+
(#set! injection.language "html")
5+
)
6+
7+
(embedded_sql
8+
(_
9+
(paren_fenced_text) @injection.content
10+
)
11+
(#set! injection.language "sql")
12+
)
13+
14+
(embedded_js
15+
[
16+
(angled_bracket_fenced_text)
17+
(embedded_js_special_case)
18+
] @injection.content
19+
(#set! injection.language "javascript"))
20+
21+
22+
(embedded_xml
23+
(angled_bracket_fenced_text) @injection.content
24+
(#set! injection.language "xml")
25+
)
26+
27+
([
28+
(line_comment_1)
29+
(line_comment_2)
30+
(line_comment_3)
31+
(block_comment)
32+
] @injection.content
33+
(#set! injection.language "comment"))
34+
35+
36+
37+
; UDL injections
38+
;; Keywords, one of type language = "python", none of type codemode
39+
; External method body injection based on [ Language = ... ]
40+
(method_definition
41+
(external_method_keywords
42+
(method_keyword_language
43+
(rhs) @lang))
44+
(external_method_body_content) @injection.content
45+
(#set! injection.include-children "true")
46+
(#match? @lang "^[Pp][Yy][Tt][Hh][Oo][Nn]$")
47+
(#set! injection.language "python"))
48+
49+
(method_definition
50+
(external_method_keywords
51+
(method_keyword_language
52+
(rhs) @lang))
53+
(external_method_body_content) @injection.content
54+
(#set! injection.include-children "true")
55+
(#match? @lang "^[Tt][Ss][Qq][Ll]$")
56+
(#set! injection.language "tsql"))
57+
58+
(method_definition
59+
(external_method_keywords
60+
(method_keyword_language
61+
(rhs) @lang))
62+
(external_method_body_content) @injection.content
63+
(#set! injection.include-children "true")
64+
(#match? @lang "^[Ii][Ss][Pp][Ll]$")
65+
(#set! injection.language "ispl"))
66+
67+
68+
69+
;; External trigger with python body
70+
(
71+
(trigger
72+
(external_trigger
73+
(trigger_keywords
74+
(method_keyword_language
75+
(rhs) @lang))
76+
(external_method_body_content) @injection.content))
77+
(#set! injection.include-children "true")
78+
(#match? @lang "^[Pp][Yy][Tt][Hh][Oo][Nn]$")
79+
(#set! injection.language "python")
80+
)
81+
82+
;; External trigger with TSQL body
83+
(
84+
(trigger
85+
(external_trigger
86+
(trigger_keywords
87+
(method_keyword_language
88+
(rhs) @lang))
89+
(external_method_body_content) @injection.content))
90+
(#set! injection.include-children "true")
91+
(#match? @lang "^[Tt][Ss][Qq][Ll]$")
92+
(#set! injection.language "tsql")
93+
)
94+
95+
; A query must be of type %SQLQuery to have an SQL body, otherwise the body
96+
; is empty
97+
(query
98+
(return_type
99+
(typename
100+
(identifier) @_querytype
101+
(#match? @_querytype "^%[Ss][Qq][Ll][Qq][Uu][Ee][Rr][Yy]$")))
102+
(query_body
103+
(query_body_content) @injection.content)
104+
(#set! injection.language "sql")
105+
(#set! injection.include-children "true")
106+
)
107+
108+
; XDATA blocks:
109+
; - xdata_any requires a keyword list that includes MimeType
110+
; - xdata_xml allows an optional keyword list and defaults to XML
111+
112+
; ----------------------------
113+
; XDATA injections (MimeType)
114+
; ----------------------------
115+
116+
; text/markdown
117+
(xdata
118+
(xdata_any
119+
(xdata_keywords
120+
(xdata_keyword_mimetype (rhs) @mt))
121+
(external_method_body_content) @injection.content)
122+
(#set! injection.include-children "true")
123+
(#match? @mt "^\"?text/markdown\"?$")
124+
(#set! injection.language "markdown"))
125+
126+
; XML MimeTypes
127+
(xdata
128+
(xdata_any
129+
(xdata_keywords
130+
(xdata_keyword_mimetype (rhs) @mt))
131+
(external_method_body_content) @injection.content)
132+
(#set! injection.include-children "true")
133+
(#match? @mt "^\"?([Tt][Ee][Xx][Tt]|[Aa][Pp][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn])/[Xx][Mm][Ll]\"?$")
134+
(#set! injection.language "xml"))
135+
136+
; text/html
137+
(xdata
138+
(xdata_any
139+
(xdata_keywords
140+
(xdata_keyword_mimetype (rhs) @mt))
141+
(external_method_body_content) @injection.content)
142+
(#set! injection.include-children "true")
143+
(#match? @mt "^\"?text/html\"?$")
144+
(#set! injection.language "html"))
145+
146+
; application/json
147+
(xdata
148+
(xdata_any
149+
(xdata_keywords
150+
(xdata_keyword_mimetype (rhs) @mt))
151+
(external_method_body_content) @injection.content)
152+
(#set! injection.include-children "true")
153+
(#match? @mt "^\"?application/json\"?$")
154+
(#set! injection.language "json"))
155+
156+
; text/yaml or application/yaml
157+
(xdata
158+
(xdata_any
159+
(xdata_keywords
160+
(xdata_keyword_mimetype (rhs) @mt))
161+
(external_method_body_content) @injection.content)
162+
(#set! injection.include-children "true")
163+
(#match? @mt "^\"?([Tt][Ee][Xx][Tt]|[Aa][Pp][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn])/[Yy][Aa][Mm][Ll]\"?$")
164+
(#set! injection.language "yaml"))
165+
166+
; text/css
167+
(xdata
168+
(xdata_any
169+
(xdata_keywords
170+
(xdata_keyword_mimetype (rhs) @mt))
171+
(external_method_body_content) @injection.content)
172+
(#set! injection.include-children "true")
173+
(#match? @mt "^\"?text/css\"?$")
174+
(#set! injection.language "css"))
175+
176+
; -----------------------------------------
177+
; XDATA default (no MimeType): XML fallback
178+
; -----------------------------------------
179+
(xdata
180+
(xdata_xml
181+
(xdata_keywords)?
182+
(external_method_body_content) @injection.content)
183+
(#set! injection.include-children "true")
184+
(#set! injection.language "xml"))
185+
186+
187+
; Storage definition is XML
188+
(storage
189+
(storage_body
190+
(external_method_body_content) @injection.content)
191+
(#set! injection.language "xml")
192+
(#set! injection.include-children "true"))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name = "objectscript_core"
2+
grammar = "objectscript_core"
3+
path_suffixes = ["inc", "mac"]
4+
line_comments = ["// ", ";", ";;", "#;"]
5+
autoclose_before = ";:.,=}])>` \n\t\""
6+
brackets = [
7+
{ start = "{", end = "}", close = true, newline = true },
8+
{ start = "[", end = "]", close = true, newline = false },
9+
{ start = "(", end = ")", close = true, newline = false },
10+
]

0 commit comments

Comments
 (0)