lsp-ruby-syntax-tree.el (1888B)
1 ;;; lsp-ruby-syntax-tree.el --- lsp-mode for the Ruby syntax_tree gem -*- lexical-binding: t; -*- 2 3 ;; Copyright (C) 2022 Geoffrey Lessel 4 5 ;; Author: Geoffrey Lessel 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 the Ruby syntax_tree gem. 24 25 ;;; Code: 26 27 (require 'lsp-mode) 28 29 (defgroup lsp-ruby-syntax-tree nil 30 "LSP support for the Ruby syntax_tree gem." 31 :group 'lsp-mode 32 :link '(url-link "https://github.com/ruby-syntax-tree/syntax_tree")) 33 34 (defcustom lsp-ruby-syntax-tree-use-bundler nil 35 "Run stree (the syntax_tree executable) using bundler." 36 :type 'boolean 37 :safe #'booleanp 38 :group 'lsp-ruby-syntax-tree) 39 40 (defcustom lsp-ruby-syntax-tree-format-options nil 41 "Options to pass to the stree lsp server." 42 :type '(repeat string) 43 :group 'lsp-ruby-syntax-tree) 44 45 (defun lsp-ruby-syntax-tree--build-command () 46 (append 47 (if lsp-ruby-syntax-tree-use-bundler '("bundle" "exec")) 48 '("stree" "lsp") 49 lsp-ruby-syntax-tree-format-options)) 50 51 (lsp-register-client 52 (make-lsp-client 53 :new-connection (lsp-stdio-connection #'lsp-ruby-syntax-tree--build-command) 54 :activation-fn (lsp-activate-on "ruby") 55 :priority -4 56 :server-id 'ruby-syntax-tree-ls)) 57 58 (provide 'lsp-ruby-syntax-tree) 59 ;;; lsp-ruby-syntax-tree.el ends here