diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae23d4..e748aab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,13 @@ itself where its source is at hand. - Everything is built in a staging directory and started there once before it replaces what is installed; a failure leaves things exactly as they were. `--dry-run` prints every action. - `scripts/test-ide.sh` tests it; `scripts/package-ide.sh` writes the release files (`install.sh`, `llembas-ide-.tar.gz`, `SHA256SUMS`). +### Fixed (LLeMbas IDE) + +- Shell scripts and TSX files are coloured by their compiled grammars: a file type whose name is + not its grammar's (`sh`, `typescriptreact`, `javascriptreact`, `jsonc`) had none started for it. +- An install that is refused leaves nothing behind, not even the empty directories above its + prefix, and a release address that is not `https://` is refused in words. + ## [1.0.0-beta.5] — 2026-11-27 ### Fixed (VS Code / VSCodium) diff --git a/ide/config/lua/llembas_ide/treesitter.lua b/ide/config/lua/llembas_ide/treesitter.lua index d0fa4a2..ed4948a 100644 --- a/ide/config/lua/llembas_ide/treesitter.lua +++ b/ide/config/lua/llembas_ide/treesitter.lua @@ -6,6 +6,16 @@ local M = {} M.compiled = false +--- A grammar, and the file types it colours beside the one of its own name. +M.filetypes = { + bash = { "sh" }, + tsx = { "typescriptreact" }, + javascript = { "javascriptreact" }, + vimdoc = { "help" }, + json = { "jsonc" }, + html = { "xhtml" }, +} + local function parsers_dir() local dir = require("llembas_ide").prefix .. "/site/pack/llembas/start/llembas-parsers/parser" return vim.fn.isdirectory(dir) == 1 and dir or nil @@ -19,6 +29,13 @@ function M.setup() local ok = pcall(vim.cmd.packadd, "nvim-treesitter") if ok and pcall(require, "nvim-treesitter.query_predicates") then M.compiled = true + -- File types whose name is not their grammar's. nvim-treesitter names these when it starts + -- up; its start-up is off here, so they are named here, for the grammars that are compiled. + local has = {} + for _, lang in ipairs(M.languages()) do has[lang] = true end + for lang, fts in pairs(M.filetypes) do + if has[lang] then pcall(vim.treesitter.language.register, lang, fts) end + end else table.insert(require("llembas_ide").problems, "treesitter: grammars are compiled but nvim-treesitter's queries are missing") end diff --git a/ide/install.sh b/ide/install.sh index ac529eb..1a688ec 100755 --- a/ide/install.sh +++ b/ide/install.sh @@ -73,6 +73,7 @@ DRY=0 TMP="" STAGE="" OLD="" +MADE="" SWAPPED=() PLACED=() DONE=0 @@ -122,6 +123,11 @@ cleanup() { # A prefix this run made and left empty goes again. if [ -n "$PREFIX" ] && [ -d "$PREFIX" ] && [ "$DONE" != 1 ]; then rmdir "$PREFIX/site/pack" "$PREFIX/site" "$PREFIX" 2>/dev/null || true + if [ ! -d "$PREFIX" ] && [ -n "${MADE:-}" ]; then + while IFS= read -r made; do + [ -z "$made" ] || rmdir "$made" 2>/dev/null || break + done <<<"$MADE" + fi fi exit "$status" } @@ -587,6 +593,14 @@ install_from() { say "LLeMbas IDE $version (dry run: nothing is downloaded or written)" else say "LLeMbas IDE $version" + # The directories above the prefix that are not there yet: made now, and taken away again, + # deepest first, if this run ends with nothing installed. + MADE="" + up="$(dirname "$PREFIX")" + while [ ! -d "$up" ] && [ "$up" != / ] && [ "$up" != . ]; do + MADE="$MADE$up"$'\n' + up="$(dirname "$up")" + done mkdir -p "$PREFIX" TMP="$(mktemp -d)" STAGE="$(mktemp -d "$PREFIX/.staging.XXXXXX")"