Skip to content

Commit bad7ffd

Browse files
Merge pull request #3 from hkimura-intersys/v1.4.0
chore: bump version to 1.4.0
2 parents 06d40d7 + e171269 commit bad7ffd

10 files changed

Lines changed: 164 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
query_checks:
15+
name: Query checks
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
21+
- name: Set up ts_query_ls
22+
run: curl -fL https://github.com/ribru17/ts_query_ls/releases/latest/download/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz | tar -xz
23+
24+
- name: Lint query files
25+
run: ./ts_query_ls lint languages --config '{"language_retrieval_patterns":["languages/([^/]+)/[^/]+\\.scm$"]}'
26+
27+
- name: Check Zed highlight captures
28+
run: python3 scripts/lint_zed_captures.py

extension.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
id = "objectscript"
22
name = "InterSystems ObjectScript"
3-
version = "1.3.0"
3+
version = "1.4.0"
44
schema_version = 1
55
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_udl]
1010
repository = "https://github.com/intersystems/tree-sitter-objectscript"
11-
commit = "bd68f926f0b3451421be3b60387d0dce901aebe7"
11+
commit = "7aa01969d0fea2e75dc69f2be2244b13d8269d6f"
1212
path = "udl"
1313

1414
[grammars.objectscript_core]
1515
repository = "https://github.com/intersystems/tree-sitter-objectscript"
16-
commit = "bd68f926f0b3451421be3b60387d0dce901aebe7"
16+
commit = "7aa01969d0fea2e75dc69f2be2244b13d8269d6f"
1717
path = "core"
1818

1919
[grammars.objectscript]
2020
repository = "https://github.com/intersystems/tree-sitter-objectscript"
21-
commit = "bd68f926f0b3451421be3b60387d0dce901aebe7"
21+
commit = "7aa01969d0fea2e75dc69f2be2244b13d8269d6f"
2222
path = "objectscript"
2323

2424
[grammars.xml]

languages/objectscript/highlights.scm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
"#"
4848
"|"
4949
"||"
50-
"/"
51-
"/"
5250
"$$"
5351
] @punctuation
5452

@@ -165,4 +163,4 @@ keyword: (_) @keyword
165163
(property_type) @type.builtin
166164
(index_property_type) @type.builtin
167165

168-
(identifier) @variable
166+
(identifier) @variable

languages/objectscript_core/highlights.scm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
"#"
4848
"|"
4949
"||"
50-
"/"
51-
"/"
5250
"$$"
5351
] @punctuation
5452

@@ -121,4 +119,3 @@ keyword: (_) @keyword
121119
"##;"
122120
"$"
123121
] @punctuation
124-

languages/objectscript_udl/highlights.scm

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
(objectscript_identifier) @variable
2323

2424
(method_arg) @variable.parameter
25-
; I didn't include ( or ) in this, because they are often grouped
25+
; I didn't include '(' or ')' in this, because they are often grouped
2626
; as part of a sequence that gets turned into a single token, so they
2727
; don't get matched, and one ends up getting colored differently than the other.
2828
[
@@ -47,9 +47,13 @@
4747
"#"
4848
"|"
4949
"||"
50-
"/"
51-
"/"
5250
"$$"
51+
"--"
52+
";"
53+
"//"
54+
"#;"
55+
"##;"
56+
"$"
5357
] @punctuation
5458

5559
[
@@ -68,13 +72,13 @@
6872
"="
6973
">"
7074
">="
71-
"@"
75+
"@"
7276
"*"
7377
"**"
7478
"'"
7579
"'!"
7680
"'?"
77-
"!"
81+
"!"
7882
"?"
7983
] @operator
8084

@@ -83,8 +87,6 @@
8387
(json_number_literal) @number
8488
(json_null_literal) @string
8589
(bracket) @punctuation.bracket
86-
87-
;; inherits: objectscript_expr
8890
(locktype) @variable
8991

9092
(macro_arg) @variable
@@ -113,16 +115,6 @@ keyword: (_) @keyword
113115

114116
(tag) @tag
115117

116-
[
117-
"--"
118-
";"
119-
"//"
120-
"#;"
121-
"##;"
122-
"$"
123-
] @punctuation
124-
125-
;; inherits: objectscript_core
126118
; ------------------ UDL -------------------
127119

128120
[

languages/objectscript_udl/injections.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636

37-
; UDL injections
37+
; UDL grammar injections
3838
;; Keywords, one of type language = "python", none of type codemode
3939
; External method body injection based on [ Language = ... ]
4040
(method_definition

languages/xml/highlights.scm

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
(PubidLiteral) @string.special
107107

108-
(SystemLiteral (URI) @markup.link)
108+
(SystemLiteral (URI) @link_uri)
109109

110110
;; Processing instructions
111111

@@ -154,15 +154,13 @@
154154

155155
;; Text
156156

157-
(CharData) @markup
157+
(CharData) @text
158158

159159
(CDSect
160-
(CDStart) @markup.heading
161-
(CData) @markup.raw
162-
"]]>" @markup.heading)
160+
(CDStart) @punctuation.markup
161+
(CData) @text.literal
162+
"]]>" @punctuation.markup)
163163

164164
;; Misc
165165

166166
(Comment) @comment
167-
168-
(ERROR) @error

scripts/lint_zed_captures.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/usr/bin/env python3
2+
3+
"""Validate highlight captures against Zed's syntax capture names."""
4+
5+
from __future__ import annotations
6+
7+
import re
8+
import sys
9+
from pathlib import Path
10+
11+
12+
CAPTURE_PATTERN = re.compile(r"@([A-Za-z0-9_.-]+)")
13+
ALLOWED_ZED_CAPTURES = {
14+
"attribute",
15+
"boolean",
16+
"comment",
17+
"comment.doc",
18+
"constant",
19+
"constructor",
20+
"embedded",
21+
"emphasis",
22+
"emphasis.strong",
23+
"enum",
24+
"function",
25+
"function.builtin",
26+
"hint",
27+
"keyword",
28+
"label",
29+
"link_text",
30+
"link_uri",
31+
"namespace",
32+
"number",
33+
"operator",
34+
"predictive",
35+
"preproc",
36+
"primary",
37+
"property",
38+
"punctuation",
39+
"punctuation.bracket",
40+
"punctuation.delimiter",
41+
"punctuation.list_marker",
42+
"punctuation.markup",
43+
"punctuation.special",
44+
"selector",
45+
"selector.pseudo",
46+
"string",
47+
"string.escape",
48+
"string.regex",
49+
"string.special",
50+
"string.special.symbol",
51+
"tag",
52+
"text",
53+
"text.literal",
54+
"title",
55+
"type",
56+
"variable",
57+
"variable.special",
58+
"variant",
59+
}
60+
61+
62+
def is_allowed(capture: str) -> bool:
63+
if capture.startswith("_"):
64+
return True
65+
66+
parts = capture.split(".")
67+
for i in range(len(parts), 0, -1):
68+
prefix = ".".join(parts[:i])
69+
if prefix in ALLOWED_ZED_CAPTURES:
70+
return True
71+
return False
72+
73+
74+
def collect_highlight_files(root: Path) -> list[Path]:
75+
return sorted(root.glob("languages/*/highlights.scm"))
76+
77+
78+
def main() -> int:
79+
root = Path.cwd()
80+
highlight_files = collect_highlight_files(root)
81+
if not highlight_files:
82+
print("No highlights.scm files found under languages/*/")
83+
return 1
84+
85+
failures: list[tuple[Path, int, str]] = []
86+
for highlight_file in highlight_files:
87+
text = highlight_file.read_text(encoding="utf-8")
88+
for line_number, line in enumerate(text.splitlines(), start=1):
89+
for match in CAPTURE_PATTERN.finditer(line):
90+
capture = match.group(1)
91+
if not is_allowed(capture):
92+
failures.append((highlight_file, line_number, capture))
93+
94+
if failures:
95+
print("Unsupported highlight captures detected:")
96+
for path, line_number, capture in failures:
97+
relative_path = path.relative_to(root)
98+
print(f"- {relative_path}:{line_number} uses @{capture}")
99+
print("\nUse Zed capture names (or subscopes of them) for highlights.")
100+
return 1
101+
102+
print("All highlight captures are compatible with Zed capture names.")
103+
return 0
104+
105+
106+
if __name__ == "__main__":
107+
sys.exit(main())

themes/tokyonight-day.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@
230230
"variable": {
231231
"color": "#3760bf"
232232
},
233+
"variable.special": {
234+
"color": "#c64343"
235+
},
233236
"variable.builtin": {
234237
"color": "#f52a65"
235238
},

themes/tokyonight-light.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
"variable": {
6262
"color": "#3760bf"
6363
},
64+
"variable.special": {
65+
"color": "#bf3a4c"
66+
},
67+
"variable.parameter": {
68+
"color": "#8f5e15"
69+
},
6470
"constant": {
6571
"color": "#8f3f71"
6672
},

0 commit comments

Comments
 (0)