Extended Mark for VS Code
Extended Mark in VS Code, and in vscode.dev and github.dev: highlighting, errors as you type,
hover, go to definition, references, the outline, completion and formatting, from xtmd's own
language server (ide/lsp), built in as WebAssembly so there is nothing to install; and a live
preview, the vscode target, that draws the page with VS Code's own components in the editor's
theme.
- Highlighting for
.xtmd and .xtmdpack: the code above a document's @@@ line, and the
Markdown below it with widget calls, holes, control lines and @// comments. A document with no
@@@ line is read as prose all through.
- The language server answers in a Node process (or a web worker in a browser), built from
ide/lsp into xtmd.wasm. The extension is self-contained: it needs no xtmd binary.
- Packs: a document is built with the packs its
xtmd.toml names, read through VS Code (so in
vscode.dev too) and given to the server.
- The preview compiles the text as it is edited and draws it beside the editor. A draft that
doesn't compile keeps the last page that did, and says why at its top; a widget that fails while
drawn is marked on its call in the editor. Reset the Preview's $state starts it again. It opens
from the preview button at the top right of a document (Alt-click: in its place), from a
document's tab or explorer menu, with Ctrl+K V (beside) or Ctrl+Shift+V (in its place), Cmd on a
Mac, and as an editor of its own: Extended Mark Preview, in Open With… and in the editor's own
menu of editors.
- File icons: a document is a page with the call sign on it, a pack a box with it, each for
light and dark themes (brand/README.md).
- Commands, from xtmd.wasm, in a browser too:
- Show the IR and Show as Markdown open what
xtmd build and xtmd md write on a page
of its own beside the document; nothing is saved.
- Check a Folder checks every
.xtmd and .xtmdpack file under it as the language server
checks an open one, into Problems.
- Migrate plans what
xtmd migrate would do (xtmd-migrate, in xtmd.wasm), asks its questions
one at a time, shows every change side by side with the file as it is, and on Write Them writes
it as one edit: Undo in any file it wrote takes the whole migration back. A document written for MKP 0.2 is moved by 0.2's frozen step (dist/migrate-0.2.cjs),
run with VS Code's own Node, with the 0.2 packs (folders with a manifest.mkp) in the
workspace; a browser has no Node, so there it is left as it is, and says why. A document still
named name.mkp.md offers to migrate.
*.ir.json and *.rir.json are checked against the IR schemas.
What it does is logged in its output channel (Extended Mark: Show the Log); nothing is sent
anywhere.
The vscode target
The preview is a target like any other (checks/target.yaml): core's 30 extern widgets, drawn by
src/webview/widgets.ts as VS Code draws its own UI. press is VS Code's button, checkbox, radio,
toggle, tab or list option; field its input box; slider, overlay and label in its colours; icon a
codicon. Markdown's blocks look as VS Code's Markdown preview draws them. The widgets keep the web
target's behaviour (events, keyboard, roles), which the checks hold every target to, and the
target is checked as every target is:
xtmd target check vscode # every case, in Chromium
Building and testing
npm install
npm test # builds dist/ (types checked first), then the grammar and language tests
npm run vscode # VS Code itself (downloaded into .vscode-test), driven and photographed into test/out
npm run package # xtmd-0.3.2.vsix
npm run vscode needs a screen; on a box without one, run it under Xvfb:
Xvfb :97 -screen 0 1600x1000x24 & DISPLAY=:97 npm run vscode.
| |