config

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

lsp-idris.el (2164B)


      1 ;;; lsp-idris.el --- Description -*- lexical-binding: t; -*-
      2 ;;
      3 ;; Copyright (C) 2022 skykanin
      4 ;;
      5 ;; Author: skykanin <https://github.com/skykanin>
      6 ;; Keywords: idris lsp
      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 ;; This file is not part of GNU Emacs.
     22 ;;
     23 ;;; Commentary:
     24 
     25 ;; LSP Client for the Idris2 Programming Language.
     26 
     27 ;;; Code:
     28 
     29 (require 'lsp-mode)
     30 (require 'lsp-semantic-tokens)
     31 
     32 (defgroup lsp-idris nil
     33   "LSP support for Idris."
     34   :link '(url-link "https://github.com/idris-community/idris2-lsp")
     35   :group 'lsp-mode
     36   :tag "Lsp Idirs"
     37   :package-version '(lsp-mode . "9.0.0"))
     38 
     39 (defcustom lsp-idris2-lsp-path "idris2-lsp"
     40   "Command to start Idris 2 language server process."
     41   :group 'lsp-idris
     42   :type 'string
     43   :package-version '(lsp-mode . "9.0.0"))
     44 
     45 (defcustom lsp-idris2-lsp-trace-server "off"
     46   "Traces the communication between VS Code and the language server."
     47   :group 'lsp-idris
     48   :type '(choice (:tag "off" "messages" "verbose"))
     49   :package-version '(lsp-mode . "9.0.0"))
     50 
     51 (lsp-register-custom-settings
     52   '(("idris2-lsp.trace.server" lsp-idris2-lsp-trace-server)
     53     ("idris2-lsp.path" lsp-idris2-lsp-path)))
     54 
     55 ;; Register the client itself
     56 (lsp-register-client
     57   (make-lsp-client
     58    :new-connection (lsp-stdio-connection lsp-idris2-lsp-path)
     59    ;; Activate lsp on idris or idris2 buffers
     60    :activation-fn (lsp-activate-on "idris" "idris2")
     61    ;; This should run under idris-mode and idris2-mode.
     62    :major-modes '(idris-mode idris2-mode)
     63    :language-id "idris"
     64    :server-id 'idris2-lsp))
     65 
     66 (provide 'lsp-idris)
     67 ;;; lsp-idris.el ends here