config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

lsp-steep.el (2208B)


      1 ;;; lsp-steep.el --- lsp-mode for Steep  -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2020  Masafumi Koba
      4 
      5 ;; Author: Masafumi Koba <ybiquitous@gmail.com>
      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 Steep which is a Ruby type checker.
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 (defgroup lsp-steep nil
     30   "LSP support for Steep, using the Steep language server."
     31   :group 'lsp-mode
     32   :link '(url-link "https://github.com/soutaro/steep"))
     33 
     34 (defcustom lsp-steep-log-level "warn"
     35   "Log level of Steep."
     36   :type '(choice
     37           (const "fatal")
     38           (const "error")
     39           (const "warn")
     40           (const "info")
     41           (const "debug"))
     42   :group 'lsp-steep)
     43 
     44 (defcustom lsp-steep-use-bundler nil
     45   "Run Steep using Bundler."
     46   :type 'boolean
     47   :safe #'booleanp
     48   :group 'lsp-steep)
     49 
     50 (defcustom lsp-steep-server-path nil
     51   "Path of the Steep language server executable.
     52 If specified, `lsp-steep-use-bundler' is ignored."
     53   :type 'file
     54   :group 'lsp-steep
     55   :package-version '(lsp-mode . "8.0.0"))
     56 
     57 (defun lsp-steep--build-command ()
     58   "Build a command to start the Steep language server."
     59   (append
     60    (if (and lsp-steep-use-bundler (not lsp-steep-server-path)) '("bundle" "exec"))
     61    (list (or lsp-steep-server-path "steep") "langserver" "--log-level" lsp-steep-log-level)))
     62 
     63 (lsp-register-client
     64  (make-lsp-client
     65   :new-connection (lsp-stdio-connection #'lsp-steep--build-command)
     66   :activation-fn (lsp-activate-on "ruby")
     67   :priority -3
     68   :server-id 'steep-ls))
     69 
     70 (lsp-consistency-check lsp-steep)
     71 
     72 (provide 'lsp-steep)
     73 ;;; lsp-steep.el ends here