lsp-sorbet.el (1980B)
1 ;;; lsp-sorbet.el --- Sorbet server configuration -*- lexical-binding: t; -*- 2 3 ;; Copyright (C) 2020 4 5 ;; Author: Christopher Wilson <chris@sencjw.com> 6 ;; Keywords: 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-sorbet client 24 25 ;;; Code: 26 27 (require 'lsp-mode) 28 29 (defgroup lsp-sorbet nil 30 "LSP support for Ruby, using the Sorbet language server." 31 :group 'lsp-mode 32 :link '(url-link "https://github.com/sorbet/sorbet") 33 :package-version '(lsp-mode . "8.0.0")) 34 35 (defcustom lsp-sorbet-use-bundler nil 36 "Run sorbet under bundler" 37 :type 'boolean 38 :group 'lsp-sorbet 39 :package-version '(lsp-mode . "8.0.0")) 40 41 (defcustom lsp-sorbet-as-add-on nil 42 "Run sorbet LSP server alongside other LSP server(s)" 43 :type 'boolean 44 :group 'lsp-sorbet 45 :package-version '(lsp-mode . "8.0.0")) 46 47 (defun lsp-sorbet--build-command () 48 "Build sorbet command" 49 (let ((lsp-command '("srb" "typecheck" "--lsp" "--disable-watchman"))) 50 (if lsp-sorbet-use-bundler 51 (append '("bundle" "exec") lsp-command) 52 lsp-command))) 53 54 (lsp-register-client 55 (make-lsp-client 56 :add-on? lsp-sorbet-as-add-on 57 :new-connection (lsp-stdio-connection 58 #'lsp-sorbet--build-command) 59 :priority -2 60 :activation-fn (lsp-activate-on "ruby") 61 :server-id 'sorbet-ls)) 62 63 (lsp-consistency-check lsp-sorbet) 64 65 (provide 'lsp-sorbet) 66 ;;; lsp-sorbet.el ends here