config

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

lsp-typeprof.el (1837B)


      1 ;;; lsp-typeprof.el --- TypeProf server configuration  -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2022  Taiki Sugawara
      4 
      5 ;; Author: Taiki Sugawara <buzz.taiki@gmail.com>
      6 ;; Keywords: lsp, ruby
      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 ;; Client for TypeProf.
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 (defgroup lsp-typeprof nil
     30   "LSP support for Ruby, using the TypeProf language server."
     31   :group 'lsp-mode
     32   :link '(url-link "https://github.com/ruby/typeprof")
     33   :package-version '(lsp-mode . "9.0.0"))
     34 
     35 (defcustom lsp-typeprof-use-bundler nil
     36   "Run typeprof under bundler."
     37   :type 'boolean
     38   :safe #'booleanp
     39   :group 'lsp-typeprof
     40   :package-version '(lsp-mode . "9.0.0"))
     41 
     42 (defun lsp-typeprof--build-command ()
     43   "Build typeprof command."
     44   (let ((lsp-command '("typeprof" "--lsp" "--stdio")))
     45     (if lsp-typeprof-use-bundler
     46               (append '("bundle" "exec") lsp-command)
     47             lsp-command)))
     48 
     49 (lsp-register-client
     50  (make-lsp-client
     51   :new-connection (lsp-stdio-connection
     52                    #'lsp-typeprof--build-command)
     53   :priority -4
     54   :activation-fn (lsp-activate-on "ruby")
     55   :server-id 'typeprof-ls))
     56 
     57 (lsp-consistency-check lsp-typeprof)
     58 
     59 (provide 'lsp-typeprof)
     60 ;;; lsp-typeprof.el ends here