config

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

lsp-nim.el (3007B)


      1 ;;; lsp-nim.el --- description -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2020 emacs-lsp maintainers
      4 
      5 ;; Author: emacs-lsp maintainers
      6 ;; Keywords: lsp, nim
      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 ;; LSP Clients for the Nim Programming Language.
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 ;; Nim
     30 (defgroup lsp-nimlsp nil
     31   "LSP support for Nim, using nimlsp."
     32   :group 'lsp-mode
     33   :link '(url-link "https://github.com/PMunch/nimlsp"))
     34 
     35 (lsp-defcustom lsp-nim-project-mapping []
     36   "Nimsuggest project mapping. Sample value
     37 
     38 [(:projectFile \"root.nim\"
     39   :fileRegex \".*\\.nim\")]"
     40 
     41   :type '(lsp-repeatable-vector plist)
     42   :group 'lsp-nim
     43   :package-version '(lsp-mode . "9.0.0")
     44   :lsp-path "nim.projectMapping")
     45 
     46 (lsp-defcustom lsp-nim-timeout 120000
     47   "Timeout for restarting `nimsuggest'"
     48   :type 'number
     49   :group 'lsp-nim
     50   :package-version '(lsp-mode . "9.0.0")
     51   :lsp-path "nim.timeout")
     52 
     53 (lsp-defcustom lsp-nim-nimsuggest-path "nimsuggest"
     54   "Path to `nimsuggest' to use."
     55   :type 'number
     56   :group 'lsp-nim
     57   :package-version '(lsp-mode . "9.0.0")
     58   :lsp-path "nim.nimsuggestPath")
     59 
     60 (lsp-defcustom lsp-nim-auto-check-file t
     61   "Check the file on the fly"
     62   :type 'boolean
     63   :group 'lsp-nim
     64   :package-version '(lsp-mode . "9.0.0")
     65   :lsp-path "nim.autoCheckFile")
     66 
     67 (lsp-defcustom lsp-nim-auto-check-project t
     68   "Check the project after saving the file"
     69   :type 'boolean
     70   :group 'lsp-nim
     71   :package-version '(lsp-mode . "9.0.0")
     72   :lsp-path "nim.autoCheckProject")
     73 
     74 (defcustom lsp-nim-langserver "nimlangserver"
     75   "Path to `nimlangserver'"
     76   :type 'number
     77   :group 'lsp-nim
     78   :package-version '(lsp-mode . "9.0.0"))
     79 
     80 (defcustom lsp-nim-lsp "nimlsp"
     81   "Path to `nimlsp'"
     82   :type 'number
     83   :group 'lsp-nim
     84   :package-version '(lsp-mode . "9.0.0"))
     85 
     86 (lsp-register-client
     87  (make-lsp-client :new-connection (lsp-stdio-connection
     88                                    (lambda () lsp-nim-lsp))
     89                   :activation-fn (lsp-activate-on "nim")
     90                   :priority -1
     91                   :server-id 'nimlsp))
     92 
     93 (lsp-register-client
     94  (make-lsp-client :new-connection (lsp-stdio-connection
     95                                    (lambda () lsp-nim-langserver))
     96                   :synchronize-sections '("nim")
     97                   :activation-fn (lsp-activate-on "nim")
     98                   :server-id 'nimlangserver))
     99 
    100 (lsp-consistency-check lsp-nim)
    101 
    102 (provide 'lsp-nim)
    103 ;;; lsp-nim.el ends here