-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1153 from informalsystems/gabriela/emacs-lsp-client
Emacs client for quint language server
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Emacs support | ||
|
||
We have 2 packages for enabling support for Quint in Emacs. | ||
|
||
1. `quint-mode` is a major mode that enables simple syntax highlighting | ||
2. `lsp-quint` is a client for `lsp-mode`, enabling IDE features provided by `quint-language-server` | ||
|
||
These packages are not published anywhere for the moment. You can clone this git repo and add a configuration like the following (which uses `use-package`): | ||
|
||
```elisp | ||
(load-file "<path-to-quint-repo>/editor-plugins/emacs/quint-mode.el") | ||
(load-file "<path-to-quint-repo>/editor-plugins/emacs/lsp-quint.el") | ||
(require 'quint-mode) | ||
(add-to-list 'auto-mode-alist '("\\.qnt" . quint-mode)) | ||
(use-package lsp-quint | ||
:ensure t | ||
:hook (quint-mode . lsp)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
;;; lsp-quint.el --- Quint LSP Client settings | ||
;;; | ||
;; Copyright (C) 2023 Gabriela Moreira | ||
|
||
;; Author: Gabriela Moreira ([email protected]) | ||
;; URL: https://github.com/informalsystems/quint | ||
;; Version: 1.0.0 | ||
;; Created: 28 Aug 2023 | ||
;; Updated 21 Aug 2023 | ||
;; Keywords: languages | ||
|
||
;; This file is not part of GNU Emacs. | ||
|
||
;;; Commentary: | ||
|
||
;; A client for lsp-mode for the Quint Specification Language, using the quint language server. | ||
|
||
;;; Code: | ||
|
||
(require 'lsp-mode) | ||
(require 'lsp-completion) | ||
|
||
(defgroup lsp-quint nil | ||
"LSP support for the Quint Specification Language, using the quint language server." | ||
:link '(url-link "https://github.com/informalsystems/quint") | ||
:group 'lsp-mode | ||
:package-version '(lsp-mode . "6.3.2")) | ||
|
||
(lsp-dependency 'quint-language-server | ||
'(:system "quint-language-server") | ||
'(:npm :package "@informalsystems/quint-language-server" | ||
:path "quint-language-server")) | ||
|
||
(add-to-list 'lsp-language-id-configuration '(quint-mode . "quint")) | ||
(lsp-register-client | ||
(make-lsp-client :new-connection (lsp-stdio-connection | ||
(lambda () (list (lsp-package-path 'quint-language-server) "--stdio"))) | ||
:major-modes '(quint-mode) | ||
:activation-fn (lsp-activate-on "quint") | ||
:language-id "quint" | ||
:priority 0 | ||
:server-id 'quint-language-server | ||
:completion-in-comments? t | ||
:download-server-fn (lambda (_client callback error-callback _update?) | ||
(lsp-package-ensure | ||
'quint-language-server | ||
(-partial #'lsp-package-ensure | ||
'quint-language-server | ||
callback | ||
error-callback) | ||
error-callback)))) | ||
|
||
(lsp-consistency-check lsp-quint) | ||
|
||
(provide 'lsp-quint) | ||
;;; lsp-quint.el ends here |