File: lsp-ruby-syntax-tree.el

package info (click to toggle)
lsp-mode 9.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 22,472 kB
  • sloc: lisp: 27,961; makefile: 62; java: 34; cpp: 33; javascript: 31; xml: 23; python: 14; sh: 2
file content (59 lines) | stat: -rw-r--r-- 1,888 bytes parent folder | download
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
;;; lsp-ruby-syntax-tree.el --- lsp-mode for the Ruby syntax_tree gem -*- lexical-binding: t; -*-

;; Copyright (C) 2022 Geoffrey Lessel

;; Author: Geoffrey Lessel
;; 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 the Ruby syntax_tree gem.

;;; Code:

(require 'lsp-mode)

(defgroup lsp-ruby-syntax-tree nil
  "LSP support for the Ruby syntax_tree gem."
  :group 'lsp-mode
  :link '(url-link "https://github.com/ruby-syntax-tree/syntax_tree"))

(defcustom lsp-ruby-syntax-tree-use-bundler nil
  "Run stree (the syntax_tree executable) using bundler."
  :type 'boolean
  :safe #'booleanp
  :group 'lsp-ruby-syntax-tree)

(defcustom lsp-ruby-syntax-tree-format-options nil
  "Options to pass to the stree lsp server."
  :type '(repeat string)
  :group 'lsp-ruby-syntax-tree)

(defun lsp-ruby-syntax-tree--build-command ()
  (append
   (if lsp-ruby-syntax-tree-use-bundler '("bundle" "exec"))
   '("stree" "lsp")
   lsp-ruby-syntax-tree-format-options))

(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection #'lsp-ruby-syntax-tree--build-command)
  :activation-fn (lsp-activate-on "ruby")
  :priority -4
  :server-id 'ruby-syntax-tree-ls))

(provide 'lsp-ruby-syntax-tree)
;;; lsp-ruby-syntax-tree.el ends here