- Emacs Lisp 100%
| eglot-tinymist.el | ||
| LICENSE | ||
| README.org | ||
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:
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
-
eglot-tinymist-pin-main<<multiple-file>>- Pin your main file when you use multiple files
- Use it with a prefix argument to choose which file to choose
-
eglot-tinymist-start-default-preview<<preview-support>>- Start the default preview process.
-
eglot-tinymist-scroll-preview- 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!
- How to support config via
eglot-workspace-configuration -
export commands:
- request
- notification
-
Preview status:
- simple message
- progress indicator in the mode bar