Skip to content

Commit dc4ce57

Browse files
committed
Update grammars
1 parent 581b87f commit dc4ce57

6 files changed

+112
-12
lines changed

.changeset/bright-starfishes-lick.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@code-hike/lighter": patch
3+
---
4+
5+
Update grammars

known-issues.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## New grammars
2+
3+
`lighter` uses the grammars from the `tm-grammars` package. When a grammar is updated you can use the new version by updating the `tm-grammars` package. But when a new grammar is added to `tm-grammars` we need to release a new version of `lighter` to include it.
4+
5+
To release a new version including new grammars:
6+
7+
- Update and download the `tm-grammars` dependency
8+
- Run `yarn regenerate`
9+
- Add a changeset (`yarn changeset`)
10+
- Commit and push the changes
11+
12+
## "Fetching resource from network" warning
13+
14+
Sometimes `lighter` fails to use the file system to get the grammars or themes, as a fallback it tries to fetch them from the network.
15+
16+
This is expected if you use `lighter` from the browser (or from an edge runtime which identifies itself as a browser).

lib/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"typescript": "^4.9.4",
4141
"vitest": "1.0.0-beta.1",
4242
"vscode-oniguruma": "1.7.0",
43-
"vscode-textmate": "9.0.0",
44-
"tm-grammars": "1.16.2"
43+
"vscode-textmate": "9.0.0"
4544
},
4645
"scripts": {
4746
"build": "rollup -c",
@@ -54,6 +53,7 @@
5453
"homepage": "https://codehike.org",
5554
"funding": "https://github.com/sponsors/code-hike",
5655
"dependencies": {
57-
"ansi-sequence-parser": "1.1.1"
56+
"ansi-sequence-parser": "1.1.1",
57+
"tm-grammars": "^1.21.10"
5858
}
5959
}

lib/src/dynamic-imports.ts

+12
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ export async function importGrammar(langId: string): Promise<any> {
4444
return import("tm-grammars/grammars/bicep.json");
4545
case "blade":
4646
return import("tm-grammars/grammars/blade.json");
47+
case "bsl":
48+
return import("tm-grammars/grammars/bsl.json");
4749
case "c":
4850
return import("tm-grammars/grammars/c.json");
4951
case "cadence":
5052
return import("tm-grammars/grammars/cadence.json");
53+
case "cairo":
54+
return import("tm-grammars/grammars/cairo.json");
5155
case "clarity":
5256
return import("tm-grammars/grammars/clarity.json");
5357
case "clojure":
@@ -64,6 +68,8 @@ export async function importGrammar(langId: string): Promise<any> {
6468
return import("tm-grammars/grammars/coffee.json");
6569
case "common-lisp":
6670
return import("tm-grammars/grammars/common-lisp.json");
71+
case "coq":
72+
return import("tm-grammars/grammars/coq.json");
6773
case "cpp":
6874
return import("tm-grammars/grammars/cpp.json");
6975
case "crystal":
@@ -236,6 +242,8 @@ export async function importGrammar(langId: string): Promise<any> {
236242
return import("tm-grammars/grammars/mdx.json");
237243
case "mermaid":
238244
return import("tm-grammars/grammars/mermaid.json");
245+
case "mipsasm":
246+
return import("tm-grammars/grammars/mipsasm.json");
239247
case "mojo":
240248
return import("tm-grammars/grammars/mojo.json");
241249
case "move":
@@ -326,6 +334,8 @@ export async function importGrammar(langId: string): Promise<any> {
326334
return import("tm-grammars/grammars/scheme.json");
327335
case "scss":
328336
return import("tm-grammars/grammars/scss.json");
337+
case "sdbl":
338+
return import("tm-grammars/grammars/sdbl.json");
329339
case "shaderlab":
330340
return import("tm-grammars/grammars/shaderlab.json");
331341
case "shellscript":
@@ -358,6 +368,8 @@ export async function importGrammar(langId: string): Promise<any> {
358368
return import("tm-grammars/grammars/system-verilog.json");
359369
case "systemd":
360370
return import("tm-grammars/grammars/systemd.json");
371+
case "talonscript":
372+
return import("tm-grammars/grammars/talonscript.json");
361373
case "tasl":
362374
return import("tm-grammars/grammars/tasl.json");
363375
case "tcl":

0 commit comments

Comments
 (0)