1. Introduction
  2. Editor Integration
  3. Common Configurations
  4. 1. Editor Frontends
    1. 1.1. VS Cod(e,ium)
    2. 1.2. Neovim
    3. 1.3. Emacs
    4. 1.4. Sublime Text
    5. 1.5. Helix
    6. 1.6. Zed
  5. Features
  6. 2. Command line interface
  7. 3. Code Documentation
  8. 4. Code Completion
  9. 5. Exporting Documents
  10. 6. Document Preview
  11. 7. Testing
  12. 8. Linting
  13. 9. Other Features
  14. Service Overview
  15. Overview of Service
  16. 10. Principles
  17. 11. Commands System
  18. 12. LSP Inputs
  19. 13. Type System
  20. Service Development
  21. 14. Crate Docs
  22. 15. LSP and CLI
  23. 16. Language Queries
  24. 17. Document Preview

Tinymist Docs

Run and configure tinymist in Emacs for Typst.

#

Features

See Tinymist Features for a list of features.

#

Finding Executable

To enable LSP, you must install tinymist. You can find tinymist 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 command typst-ts-lsp-download-binary to download the latest stable binary of tinymist at typst-ts-lsp-download-path.

  • Build from source by cargo. You can also compile and install latest tinymist by Cargo.

    1
    cargo install --git https://github.com/Myriad-Dreamin/tinymist --locked tinymist
    1
    cargo install --git https://github.com/Myriad-Dreamin/tinymist --locked tinymist

#

Setup Server

1
(with-eval-after-load 'eglot
2
  (with-eval-after-load 'typst-ts-mode
3
    (add-to-list 'eglot-server-programs
4
                 `((typst-ts-mode) .
5
                   ,(eglot-alternatives `(,typst-ts-lsp-download-path
6
                                          "tinymist"
7
                                          "typst-lsp"))))))
1
(with-eval-after-load 'eglot
2
  (with-eval-after-load 'typst-ts-mode
3
    (add-to-list 'eglot-server-programs
4
                 `((typst-ts-mode) .
5
                   ,(eglot-alternatives `(,typst-ts-lsp-download-path
6
                                          "tinymist"
7
                                          "typst-lsp"))))))

Above code adds tinymist downloaded by typst-ts-lsp-download-binary, tinymist in your PATH and typst-lsp in your PATH to the typst-ts-mode entry of eglot-server-programs.

#

Extra Settings

#

Configuring Language Server

You can either use eglot-workspace-configuration or specifying launch arguments for tinymist.

#
eglot-workspace-configuration

For example, if you want to export PDF on save:

1
  (setq-default eglot-workspace-configuration
2
                '(:tinymist (:exportPdf "onSave")))
1
  (setq-default eglot-workspace-configuration
2
                '(:tinymist (:exportPdf "onSave")))

You can also have configuration per directory. Be sure to look at the documentation of eglot-workspace-configuration by describe-symbol..

See Tinymist Server Configuration for references.

#
Launch Arguments

For example:

1
(with-eval-after-load 'eglot
2
  (with-eval-after-load 'typst-ts-mode
3
    (add-to-list 'eglot-server-programs
4
                 `((typst-ts-mode) .
5
                   ,(eglot-alternatives `((,typst-ts-lsp-download-path "--font-path" "<your-font-path>")
6
                                          ("tinymist" "--font-path" "<your-font-path>")
7
                                          "typst-lsp"))))))
1
(with-eval-after-load 'eglot
2
  (with-eval-after-load 'typst-ts-mode
3
    (add-to-list 'eglot-server-programs
4
                 `((typst-ts-mode) .
5
                   ,(eglot-alternatives `((,typst-ts-lsp-download-path "--font-path" "<your-font-path>")
6
                                          ("tinymist" "--font-path" "<your-font-path>")
7
                                          "typst-lsp"))))))

You can run command tinymist help lsp to view all available launch arguments for configuration.