Skip to content

Commit

Permalink
Update grammars
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed Dec 26, 2024
1 parent 581b87f commit dc4ce57
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-starfishes-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@code-hike/lighter": patch
---

Update grammars
16 changes: 16 additions & 0 deletions known-issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## New grammars

`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.

To release a new version including new grammars:

- Update and download the `tm-grammars` dependency
- Run `yarn regenerate`
- Add a changeset (`yarn changeset`)
- Commit and push the changes

## "Fetching resource from network" warning

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.

This is expected if you use `lighter` from the browser (or from an edge runtime which identifies itself as a browser).
6 changes: 3 additions & 3 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"typescript": "^4.9.4",
"vitest": "1.0.0-beta.1",
"vscode-oniguruma": "1.7.0",
"vscode-textmate": "9.0.0",
"tm-grammars": "1.16.2"
"vscode-textmate": "9.0.0"
},
"scripts": {
"build": "rollup -c",
Expand All @@ -54,6 +53,7 @@
"homepage": "https://codehike.org",
"funding": "https://github.com/sponsors/code-hike",
"dependencies": {
"ansi-sequence-parser": "1.1.1"
"ansi-sequence-parser": "1.1.1",
"tm-grammars": "^1.21.10"
}
}
12 changes: 12 additions & 0 deletions lib/src/dynamic-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ export async function importGrammar(langId: string): Promise<any> {
return import("tm-grammars/grammars/bicep.json");
case "blade":
return import("tm-grammars/grammars/blade.json");
case "bsl":
return import("tm-grammars/grammars/bsl.json");
case "c":
return import("tm-grammars/grammars/c.json");
case "cadence":
return import("tm-grammars/grammars/cadence.json");
case "cairo":
return import("tm-grammars/grammars/cairo.json");
case "clarity":
return import("tm-grammars/grammars/clarity.json");
case "clojure":
Expand All @@ -64,6 +68,8 @@ export async function importGrammar(langId: string): Promise<any> {
return import("tm-grammars/grammars/coffee.json");
case "common-lisp":
return import("tm-grammars/grammars/common-lisp.json");
case "coq":
return import("tm-grammars/grammars/coq.json");
case "cpp":
return import("tm-grammars/grammars/cpp.json");
case "crystal":
Expand Down Expand Up @@ -236,6 +242,8 @@ export async function importGrammar(langId: string): Promise<any> {
return import("tm-grammars/grammars/mdx.json");
case "mermaid":
return import("tm-grammars/grammars/mermaid.json");
case "mipsasm":
return import("tm-grammars/grammars/mipsasm.json");
case "mojo":
return import("tm-grammars/grammars/mojo.json");
case "move":
Expand Down Expand Up @@ -326,6 +334,8 @@ export async function importGrammar(langId: string): Promise<any> {
return import("tm-grammars/grammars/scheme.json");
case "scss":
return import("tm-grammars/grammars/scss.json");
case "sdbl":
return import("tm-grammars/grammars/sdbl.json");
case "shaderlab":
return import("tm-grammars/grammars/shaderlab.json");
case "shellscript":
Expand Down Expand Up @@ -358,6 +368,8 @@ export async function importGrammar(langId: string): Promise<any> {
return import("tm-grammars/grammars/system-verilog.json");
case "systemd":
return import("tm-grammars/grammars/systemd.json");
case "talonscript":
return import("tm-grammars/grammars/talonscript.json");
case "tasl":
return import("tm-grammars/grammars/tasl.json");
case "tcl":
Expand Down
Loading

0 comments on commit dc4ce57

Please sign in to comment.