Eglot extension for tinymist
  • Emacs Lisp 100%
Find a file
2026-03-06 10:51:04 +01:00
eglot-tinymist.el fix: still unsure about the necessity of subclassing eglot 2026-03-06 10:31:59 +01:00
LICENSE doc: add LICENSE 2026-01-11 20:47:54 +01:00
README.org docs: add workspace config 2026-03-06 10:51:04 +01:00

A subclassed eglot-server for extended tinymist support

This is an attempt to extend eglot to provide some extra support for the tinymist lsp server

Especially I was interested in:

  1. multiple file project
  2. preview support

Basic setup

After installing the package add it to your eglot-server-programs

  (add-to-list 'eglot-server-programs
               '((typst-ts-mode :language-id "typst")
                 . (eglot-tinymist-server
                    . ("tinymist" "lsp"))))
  ;; to sync preview on file save
  (add-hook 'after-save-hook #'eglot-tinymist-scroll-preview)

Check if it work: If you evaluate (eglot-current-server) in a typst buffer you should see something that starts like this: #s(eglot-tinymist-server "EGLOT ... in your echo area

DOOM

Here is the configuration I personnaly use

⚠️ still slight bug as I need to reload the buffer for the lsp to start properly but it might be because of other stuff I'm not sure Help is welcome here…

(use-package! eglot-tinymist
  :after (:all eglot typst-ts-mode)
  :init
  (after! eglot
    (add-to-list 'eglot-server-programs
                 `((typst-ts-mode :language-id "typst")
                   . (eglot-tinymist-server
                      . ("tinymist" "lsp"))))
    )
  :config
  (map! :map typst-ts-mode-map
        :localleader
        :desc "Pin Current as main" "P" #'eglot-tinymist-pin-main
        :desc "Start preview" "S" #'eglot-tinymist-start-default-preview
        :desc "scroll preview" "s" #'eglot-tinymist-scroll-preview)
  (add-hook! 'after-save-hook :local #'eglot-tinymist-scroll-preview))

Configuration

Just put the following in your .dir-locals.el

((typst-ts-mode . ((eglot-workspace-configuration ;; see more info https://myriad-dreamin.github.io/tinymist/config/neovim.html
                    . (:preview (:browsing (:args ["--data-plane-host=127.0.0.1:23635"
                                                   "--open"])
                                 :invertColors "never")))))))

My basic workflow

  1. eglot-tinymist-pin-main <<multiple-file>>

    1. Pin your main file when you use multiple files
    2. Use it with a prefix argument to choose which file to choose
  2. eglot-tinymist-start-default-preview <<preview-support>>

    1. Start the default preview process.
  3. eglot-tinymist-scroll-preview

    1. Scroll preview to be at editor position

I'm not sure what some good keybindings for those commands could be, so I didn't add any by default.

Stuff leftover (for now):

Here's what I would like to see but that I don't know when I'll make it (or if I'll make it at all). If you want to see it sooner, make a PR!

  1. How to support config via eglot-workspace-configuration
  2. export commands:

    1. request
    2. notification
  3. Preview status:

    1. simple message
    2. progress indicator in the mode bar