config

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

lsp-remark.el (2596B)


      1 ;;; lsp-remark.el --- lsp-mode remark integration -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2021 lsp-mode maintainers
      4 
      5 ;; Author: lsp-mode maintainers
      6 ;; Keywords: languages
      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 client for remark-language-server
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 ;;; Markdown
     30 (defgroup lsp-remark nil
     31   "Settings for the markdown language server client."
     32   :group 'lsp-mode
     33   :link '(url-link "https://github.com/remarkjs/remark-language-server")
     34   :package-version '(lsp-mode . "9.0.0"))
     35 
     36 (defcustom lsp-remark-server-command "remark-language-server"
     37   "The binary (or full path to binary) which executes the server."
     38   :type 'string
     39   :group 'lsp-remark
     40   :package-version '(lsp-mode . "9.0.0"))
     41 
     42 (defcustom lsp-remark-server-command-args '("--stdio")
     43   "Command-line arguments for the markdown lsp server."
     44   :type '(repeat 'string)
     45   :group 'lsp-remark
     46   :package-version '(lsp-mode . "9.0.0"))
     47 
     48 (lsp-dependency 'remark-language-server
     49                 '(:system "remark-language-server")
     50                 '(:npm :package "remark-language-server"
     51                        :path "remark-language-server"))
     52 
     53 (lsp-register-client
     54  (make-lsp-client :new-connection (lsp-stdio-connection
     55                                    (lambda ()
     56                                      (cons (or (executable-find lsp-remark-server-command)
     57                                                (lsp-package-path 'remark-language-server))
     58                                            lsp-remark-server-command-args)))
     59                   :activation-fn (lsp-activate-on "markdown")
     60                   :initialized-fn (lambda (workspace)
     61                                     (with-lsp-workspace workspace
     62                                       (lsp--set-configuration (lsp-configuration-section "remark-language-server"))))
     63                   :priority 0
     64                   :server-id 'remark))
     65 
     66 (lsp-consistency-check lsp-remark)
     67 
     68 (provide 'lsp-remark)
     69 ;;; lsp-remark.el ends here