Skip to content

Commit

Permalink
Update web-tree-sitter and tweak keymap upgrader (zmkfirmware#2593)
Browse files Browse the repository at this point in the history
* fix(docs): Fix TypeScript import diagnostics

Set the TypeScript module resolution mode to "bundler" so it correctly
resolves imports in .ts files instead of showing errors in IDEs.

* chore(docs): Update web-tree-sitter

Updated web-tree-sitter, and switched from having a copy of
tree-sitter-devicetree.wasm in the repo to using the latest version of
the tree-sitter-devicetree module, which now contains the .wasm file.

* fix(docs): Make keymap upgrader resize vertically only

Changed the textarea in the keymap ugprader to allow only vertical
resizing. This better fits the layout of the page, and it prevents you
from shrinking the box horizontally to the point where it doesn't fit
anything.
  • Loading branch information
joelspadin authored and earwin committed Nov 13, 2024
1 parent c7dfbd0 commit 1f2a89d
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 6 deletions.
61 changes: 57 additions & 4 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^18.0.0",
"react-toastify": "^10.0.6",
"web-tree-sitter": "^0.23.0"
"tree-sitter-devicetree": "^0.12.1",
"web-tree-sitter": "^0.24.3"
},
"browserslist": {
"production": [
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/KeymapUpgrader/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
font-size: var(--ifm-font-size-base);
line-height: var(--ifm-pre-line-height);
tab-size: 4;
resize: vertical;

color: var(--ifm-pre-color);
background-color: var(--ifm-pre-background);
Expand Down
7 changes: 6 additions & 1 deletion docs/src/keymap-upgrade/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const TREE_SITTER_WASM_URL = new URL(
import.meta.url
);

const TREE_SITTER_DEVICETREE_WASM_URL = new URL(
"/node_modules/tree-sitter-devicetree/tree-sitter-devicetree.wasm",
import.meta.url
);

export let Devicetree: Parser.Language;

export async function initParser() {
Expand All @@ -17,7 +22,7 @@ export async function initParser() {
return prefix + path;
},
});
Devicetree = await Parser.Language.load("/tree-sitter-devicetree.wasm");
Devicetree = await Parser.Language.load(TREE_SITTER_DEVICETREE_WASM_URL.href);
}

export function createParser() {
Expand Down
Binary file removed docs/static/tree-sitter-devicetree.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["src/"],
"compilerOptions": {
"types": ["node", "@docusaurus/theme-classic"],
"moduleResolution": "Bundler",
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,
Expand Down

0 comments on commit 1f2a89d

Please sign in to comment.