aboutsummaryrefslogtreecommitdiffstats
path: root/elpa/lsp-mode-20220505.630/lsp-remark.el
blob: 19cdaa7fab8c5d165afb22d2ab4161831db2ee61 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; lsp-remark.el --- lsp-mode remark integration -*- lexical-binding: t; -*-

;; Copyright (C) 2021 lsp-mode maintainers

;; Author: lsp-mode maintainers
;; Keywords: languages

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;;  LSP client for remark-language-server

;;; Code:

(require 'lsp-mode)

;;; Markdown
(defgroup lsp-remark nil
  "Settings for the markdown language server client."
  :group 'lsp-mode
  :link '(url-link "https://github.com/remarkjs/remark-language-server")
  :package-version '(lsp-mode . "8.0.1"))

(defcustom lsp-remark-server-command "remark-language-server"
  "The binary (or full path to binary) which executes the server."
  :type 'string
  :group 'lsp-remark
  :package-version '(lsp-mode . "8.0.1"))

(defcustom lsp-remark-server-command-args '("--stdio")
  "Command-line arguments for the markdown lsp server."
  :type '(repeat 'string)
  :group 'lsp-remark
  :package-version '(lsp-mode . "8.0.1"))

(lsp-dependency 'remark-language-server
                '(:system "remark-language-server")
                '(:npm :package "remark-language-server"
                       :path "remark-language-server"))

(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection
                                   (lambda ()
                                     (cons (or (executable-find lsp-remark-server-command)
                                               (lsp-package-path 'remark-language-server))
                                           lsp-remark-server-command-args)))
                  :activation-fn (lsp-activate-on "markdown")
                  :initialized-fn (lambda (workspace)
                                    (with-lsp-workspace workspace
                                      (lsp--set-configuration (lsp-configuration-section "remark-language-server"))))
                  :priority 0
                  :server-id 'remark))

(lsp-consistency-check lsp-remark)

(provide 'lsp-remark)
;;; lsp-remark.el ends here