config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

lsp-move.el (2194B)


      1 ;;; lsp-move.el --- MOVE client settings -*- lexical-binding: t -*-
      2 
      3 ;; Copyright (C) 2023 Dmitri Makarov
      4 
      5 ;; Author: Dmitri Makarov
      6 ;; Keywords: lsp, move
      7 
      8 ;; This program is free software; you can redistribute it and/or modify
      9 ;; it under the terms of the GNU General Public License as published by
     10 ;; the Free Software Foundation, either version 3 of the License, or
     11 ;; (at your option) any later version.
     12 
     13 ;; This program is distributed in the hope that it will be useful,
     14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 ;; GNU General Public License for more details.
     17 
     18 ;; You should have received a copy of the GNU General Public License
     19 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     20 
     21 ;;; Commentary:
     22 
     23 ;;; To enable lsp-move include the following lisp code in init.el after
     24 ;;; loading lsp-mode
     25 ;;;
     26 ;;;    (with-eval-after-load 'lsp-mode
     27 ;;;      (require 'move-mode)
     28 ;;;      (require 'lsp-move)
     29 ;;;      (add-hook 'move-mode-hook #'lsp)
     30 ;;;
     31 ;;; See `lsp-clients-move-analyzer-executable' to customize the path to move-analyzer.
     32 
     33 ;;; Code:
     34 
     35 (require 'lsp-mode)
     36 
     37 (defgroup lsp-move nil
     38   "LSP support for Move."
     39   :group 'lsp-mode
     40   :link '(url-link "https://github.com/move-language/move"))
     41 
     42 (defcustom lsp-clients-move-analyzer-executable "move-analyzer"
     43   "The move-analyzer executable to use.
     44 Leave as just the executable name to use the default behavior of
     45 finding the executable with `exec-path'."
     46   :group 'lsp-move
     47   :risky t
     48   :type 'file)
     49 
     50 (defcustom lsp-clients-move-analyzer-args '()
     51   "Extra arguments for the move-analyzer executable."
     52   :group 'lsp-move
     53   :risky t
     54   :type '(repeat string))
     55 
     56 (defun lsp-clients--move-analyzer-command ()
     57   "Generate the language server startup command."
     58   `(,lsp-clients-move-analyzer-executable ,@lsp-clients-move-analyzer-args))
     59 
     60 (lsp-register-client
     61  (make-lsp-client
     62   :new-connection (lsp-stdio-connection
     63                    'lsp-clients--move-analyzer-command)
     64   :activation-fn (lsp-activate-on "move")
     65   :major-modes '(move-mode)
     66   :priority -1
     67   :server-id 'move-analyzer))
     68 
     69 (provide 'lsp-move)
     70 
     71 ;;; lsp-move.el ends here