From 018779b30b258ab45aea4843aeaff142af7fc1d4 Mon Sep 17 00:00:00 2001 From: bugarela Date: Thu, 31 Aug 2023 17:11:17 -0300 Subject: [PATCH] Add lsp-quint emacs package --- editor-plugins/emacs/README.md | 18 ++++++++++ editor-plugins/emacs/lsp-quint.el | 56 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 editor-plugins/emacs/README.md create mode 100644 editor-plugins/emacs/lsp-quint.el diff --git a/editor-plugins/emacs/README.md b/editor-plugins/emacs/README.md new file mode 100644 index 000000000..db091242e --- /dev/null +++ b/editor-plugins/emacs/README.md @@ -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 "/editor-plugins/emacs/quint-mode.el") +(load-file "/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)) +``` diff --git a/editor-plugins/emacs/lsp-quint.el b/editor-plugins/emacs/lsp-quint.el new file mode 100644 index 000000000..0f09309a7 --- /dev/null +++ b/editor-plugins/emacs/lsp-quint.el @@ -0,0 +1,56 @@ +;;; lsp-quint.el --- Quint LSP Client settings +;;; +;; Copyright (C) 2023 Gabriela Moreira + +;; Author: Gabriela Moreira (gabriela@informal.systems) +;; 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