lsp-groovy.el (2222B)
1 ;;; lsp-groovy.el --- description -*- lexical-binding: t; -*- 2 3 ;; Copyright (C) 2020 emacs-lsp maintainers 4 5 ;; Author: emacs-lsp maintainers 6 ;; Keywords: lsp, groovy 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 Clients for the Groovy Programming Language. 24 25 ;;; Code: 26 27 (require 'lsp-mode) 28 (require 'f) 29 30 (defgroup lsp-groovy nil 31 "LSP support for Groovy, using groovy-language-server." 32 :group 'lsp-mode 33 :link '(url-link "https://github.com/GroovyLanguageServer/groovy-language-server")) 34 35 (defcustom lsp-groovy-server-file (f-join lsp-server-install-dir "groovy-language-server-all.jar") 36 "JAR file path for groovy-language-server-all.jar." 37 :group 'lsp-groovy 38 :risky t 39 :type 'file) 40 41 (defun lsp-groovy--lsp-command () 42 "Generate LSP startup command." 43 `("java" "-jar" ,(expand-file-name lsp-groovy-server-file))) 44 45 (defcustom lsp-groovy-classpath ["/usr/local/opt/groovy/libexec/lib"] 46 "List of paths to Groovy JARs." 47 :group 'lsp-groovy 48 :risky t 49 :type 'lsp-string-vector) 50 51 (lsp-register-custom-settings 52 '(("groovy.classpath" lsp-groovy-classpath))) 53 54 (lsp-register-client 55 (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-groovy--lsp-command) 56 :major-modes '(groovy-mode) 57 :priority -1 58 :server-id 'groovy-ls 59 :initialized-fn (lambda (workspace) 60 (with-lsp-workspace workspace 61 (lsp--set-configuration (lsp-configuration-section "groovy")))))) 62 63 (lsp-consistency-check lsp-groovy) 64 65 (provide 'lsp-groovy) 66 ;;; lsp-groovy.el ends here