aboutsummaryrefslogtreecommitdiffstats
path: root/elpa/lsp-mode-20220505.630/lsp-steep.el
blob: 4e0e22fa742edc4f6042694aea7af548355f18ca (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
70
71
72
73
;;; lsp-steep.el --- lsp-mode for Steep  -*- lexical-binding: t; -*-

;; Copyright (C) 2020  Masafumi Koba

;; Author: Masafumi Koba <ybiquitous@gmail.com>
;; 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 Steep which is a Ruby type checker.

;;; Code:

(require 'lsp-mode)

(defgroup lsp-steep nil
  "LSP support for Steep, using the Steep language server."
  :group 'lsp-mode
  :link '(url-link "https://github.com/soutaro/steep"))

(defcustom lsp-steep-log-level "warn"
  "Log level of Steep."
  :type '(choice
          (const "fatal")
          (const "error")
          (const "warn")
          (const "info")
          (const "debug"))
  :group 'lsp-steep)

(defcustom lsp-steep-use-bundler nil
  "Run Steep using Bunder."
  :type 'boolean
  :safe #'booleanp
  :group 'lsp-steep)

(defcustom lsp-steep-server-path nil
  "Path of the Steep language server executable.
If specified, `lsp-steep-use-bundler' is ignored."
  :type 'file
  :group 'lsp-steep
  :package-version '(lsp-mode . "8.0.0"))

(defun lsp-steep--build-command ()
  "Build a command to start the Steep language server."
  (append
   (if (and lsp-steep-use-bundler (not lsp-steep-server-path)) '("bundle" "exec"))
   (list (or lsp-steep-server-path "steep") "langserver" "--log-level" lsp-steep-log-level)))

(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection #'lsp-steep--build-command)
  :major-modes '(ruby-mode enh-ruby-mode)
  :priority -3
  :server-id 'steep-ls))

(lsp-consistency-check lsp-steep)

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