Skip to content

Instantly share code, notes, and snippets.

@MasWag
Created February 28, 2024 06:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasWag/3a715f08e250cd29d2bf4f5eb7e46fb9 to your computer and use it in GitHub Desktop.
Save MasWag/3a715f08e250cd29d2bf4f5eb7e46fb9 to your computer and use it in GitHub Desktop.
A small configuration of satysfi-ts-mode + lsp-mode
(require 'package)
;;;; Add package-archives
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
;; Initialize
(package-initialize)
(require 'leaf)
(leaf satysfi-ts-mode
:ensure t
:vc (:url "https://github.com/Kyure-A/satysfi-ts-mode")
:mode (("\\.saty$" . satysfi-ts-mode)
("\\.satyh$" . satysfi-ts-mode)
("\\.satyg$" . satysfi-ts-mode))
:hook (satysfi-ts-mode-hook . lsp))
;; :config
;; (cond ((equal system-type 'darwin)
;; (setq satysfi-pdf-viewer-command "open -a Skim"
;; satysfi-command "opam exec satysfi"))
;; ((equal system-type 'gnu/linux)
;; (setq satysfi-pdf-viewer-command "/usr/bin/evince"
;; satysfi-command "opam exec satysfi")))
;; LSP
(leaf lsp-mode
:ensure t
:commands (lsp lsp-deferred)
:require lsp
:config
(add-to-list 'lsp-language-id-configuration '(satysfi-ts-mode . "satysfi-ls"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("~/.cargo/bin/satysfi-language-server"))
:major-modes '(satysfi-ts-mode)
:priority 0
:activation-fn (lsp-activate-on "satysfi-ls")
:server-id 'satysfi-ls)))
;; completion with company
(leaf company
:ensure t
:hook
(satysfi-ts-mode . company-mode)
:config
(setq lsp-completion-provider :capf)
(setq company-minimum-prefix-length 1)
;; We use lsp for completion
(push 'company-capf company-backends))
(leaf flycheck
:ensure t
;; Configure the key binding
:bind (:flycheck-mode-map
("M-n" . flycheck-next-error)
("M-p" . flycheck-previous-error)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment