config

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

lsp-perl.el (3939B)


      1 ;;; lsp-perl.el --- lsp-perl config  -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2020 lsp-mode developers
      4 
      5 ;; Author: Hiroki Noda <kubo39@gmail.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-perl client
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 (defgroup lsp-perl nil
     30   "LSP support for Perl"
     31   :group 'lsp-mode
     32   :link '(url-link "https://github.com/richterger/Perl-LanguageServer")
     33   :package-version '(lsp-mode . "6.3"))
     34 
     35 (defcustom lsp-perl-language-server-path "perl"
     36   "Path to perl interpreter."
     37   :type 'string
     38   :group 'lsp-perl
     39   :package-version '(lsp-mode . "6.3"))
     40 
     41 (defcustom lsp-perl-language-server-port 13603
     42   "Choose listen port."
     43   :type 'integer
     44   :group 'lsp-perl
     45   :package-version '(lsp-mode . "6.3"))
     46 
     47 (defcustom lsp-perl-language-server-client-version "2.1.0"
     48   "Choose client version."
     49   :type 'string
     50   :group 'lsp-perl
     51   :package-version '(lsp-mode . "6.3"))
     52 
     53 (defcustom lsp-perl-perl-cmd nil
     54   "Path to perl interpreter used in Perl Language Server.
     55 Defaults to `perl' if nil."
     56   :type 'string
     57   :group 'lsp-perl
     58   :package-version '(lsp-mode . "7.0.1"))
     59 (defcustom lsp-perl-perl-inc nil
     60   "A vector of paths to add to perl library path."
     61   :type 'lsp-string-vector
     62   :group 'lsp-perl
     63   :package-version '(lsp-mode . "7.0.1"))
     64 (defcustom lsp-perl-file-filter nil
     65   "A vector of directories filtering perl file.
     66 Defaults to `[\".pm\" \".pl\"]' if nil."
     67   :type 'lsp-string-vector
     68   :group 'lsp-perl
     69   :package-version '(lsp-mode . "7.0.1"))
     70 (defcustom lsp-perl-ignore-dirs nil
     71   "A vector of directories to ignore.
     72 Defaults to `[\".vscode\" \".git\" \".svn\"]' if nil."
     73   :type 'lsp-string-vector
     74   :group 'lsp-perl
     75   :package-version '(lsp-mode . "7.0.1"))
     76 
     77 (defcustom lsp-perl-show-local-vars nil
     78   "If true, show also local variables in symbol view.
     79 Defaults to false if nil"
     80   :type 'boolean
     81   :group 'lsp-perl
     82   :package-version '(lsp-mode . "8.0.0"))
     83 
     84 (defcustom lsp-perl-log-level nil
     85   "Log level 0-2.
     86 Defaults to 0."
     87   :type 'integer
     88   :group 'lsp-perl
     89   :package-version '(lsp-mode . "8.0.0"))
     90 
     91 (lsp-register-custom-settings
     92  '(("perl.perlCmd" lsp-perl-perl-cmd)
     93    ("perl.perlInc" lsp-perl-perl-inc)
     94    ("perl.fileFilter" lsp-perl-file-filter)
     95    ("perl.ignoreDirs" lsp-perl-ignore-dirs)
     96    ("perl.showLocalVars" lsp-perl-show-local-vars t)
     97    ("perl.logLevel" lsp-perl-log-level)))
     98 
     99 (lsp-register-client
    100  (make-lsp-client :new-connection (lsp-stdio-connection
    101                                    (lambda ()
    102                                      (list lsp-perl-language-server-path
    103                                            "-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run" "--"
    104                                            (format "--port %d --version %s"
    105                                                    lsp-perl-language-server-port lsp-perl-language-server-client-version))))
    106                   :major-modes '(perl-mode cperl-mode)
    107                   :initialized-fn (lambda (workspace)
    108                                     (with-lsp-workspace workspace
    109                                       (lsp--set-configuration
    110                                        (lsp-configuration-section "perl"))))
    111                   :priority -2
    112                   :server-id 'perl-language-server))
    113 
    114 (lsp-consistency-check lsp-perl)
    115 
    116 (provide 'lsp-perl)
    117 ;;; lsp-perl.el ends here