Build a language pack
In this page you start a language pack, give the code map and the editor what they need for your language, and load it into your own Jacker.
Before you begin
- Build the author kit. See The author kit.
- Have a tree-sitter grammar for your language, built for WebAssembly (a
.wasmfile). The tree-sitter CLI builds one withtree-sitter build --wasm. - Start Jacker with
JACKER_PLUGINS=1 pnpm desktop:devfrom the jacker repository.
Create the plugin
- Create a starter plugin. Replace
PUBLISHERwith your publisher name andLANGwith your language’s id:The starter contains:jacker-plugin init language ./LANG --id PUBLISHER.LANG
plugin.json: the manifest, with one language whose extension is.LANG.grammars/tree-sitter-LANG.wasm: an empty placeholder grammar.grammars/tags.scmandgrammars/imports.scm: query files for the code map, with examples in comments.syntax/LANG.monarch.json: editor colouring.
- Replace the placeholder grammar with your own
.wasmfile, keeping the name or updatingcodemap.grammarinplugin.json. - In
plugin.json, setextensionsto your language’s file extensions. - Write
grammars/tags.scmagainst your grammar’s node names. See Code map queries. - Adjust
syntax/LANG.monarch.json. See Editor colouring with Monarch. - Check the plugin:
jacker-plugin validate ./LANG
Load it and check the result
- In Jacker, open Plugins, and on the Installed tab click Load local plugin…. Choose the plugin folder.
- Open a file with your extension in the Code view. Confirm that it’s coloured.
- Open the Map view. Confirm that your file’s symbols appear after the next index run.
If the plugin shows Failing, its reason names what’s wrong, such as a missing file. If a query doesn’t compile against your grammar, Jacker’s log records “plugin language unavailable in the code map” with the error, and that language is skipped in the code map.
Add a language server
A language server gives the editor completions, diagnostics, and go-to-definition. To add one:
- Declare the server program under
programs. A server that ships as a binary for each platform is abinaryprogram; one written for Node is anodeprogram. See The plugin.json manifest. - Name it in the language’s
server:Replace"server": { "program": "LANG_SERVER", "args": ["--stdio"], "rootMarkers": ["build.LANG"] }LANG_SERVERwith the program’s key underprograms.
A plugin’s language server runs only in trusted projects. It can add a server for a language Jacker has no server for; if your language uses an extension that has a built-in server (.ts, .js, .py, .dart, and related extensions), the built-in server is used.
What’s next
- See What a plugin’s programs can reach before your server needs the network or a cache folder.
- When it works, see Package and publish.