Tinymist Helix Support for Typst
Run and configure tinymist in helix for Typst.
See Tinymist Features for a list of features.
To enable LSP, you must install tinymisttinymist. You can find tinymisttinymist by:
-
Night versions available at GitHub Actions.
-
Stable versions available at GitHub Releases.
If you are using the latest version of typst-ts-mode, then you can use commandtypst-ts-lsp-download-binarytypst-ts-lsp-download-binaryto download the latest stable binary oftinymisttinymistattypst-ts-lsp-download-pathtypst-ts-lsp-download-path. -
Build from source by cargo. You can also compile and install latest
tinymisttinymistby Cargo.
Update .config/helix/languages.toml.config/helix/languages.toml to use tinymist.
Default Preview Feature and Background Preview Feature are suitable in helix.
When working under power-saving mode or with resource-consumed projects, typst compilations costs too much CPU and memory resources. You can configure the extension to run in syntax only mode, i.e. only performing elementary tasks, like syntax checking, syntax-only code analysis and formatting by setting the tinymist.syntaxOnlytinymist.syntaxOnly to enableenable or onPowerSavingonPowerSaving in the configuration.
For more information about power-saving mode, see Syntax-Only Mode.
There is a way in Neovim, but you cannot invoke related commands with arguments by :lsp-workspace-command in helix. As a candidate solution, assuming your having following directory layout:
You could create .helix/languages.toml in the project folder with the following contents:
Then all diagnostics and autocompletion will be computed according to the main.typmain.typ.
Note: With that configuration, if you’re seeing a file that is not reachable by main.typmain.typ, you will not get diagnostics and autocompletion correctly in that file.
To configure the language server, edit the language-server.tinymistlanguage-server.tinymist section. For example, if you want to export PDF on typing and output files in $root_dir/target$root_dir/target directory:
To enable a live preview you can use the preview.backgroundpreview.background:
See Tinymist Server Configuration for references.