config

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

lsp-dockerfile.el (2525B)


      1 ;;; lsp-dockerfile.el --- description -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2020 emacs-lsp maintainers
      4 
      5 ;; Author: emacs-lsp maintainers
      6 ;; Keywords: lsp, dockerfile
      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 Dockerfile documents.
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 
     30 ;;; Dockerfile
     31 
     32 (defgroup lsp-dockerfile nil
     33   "Dockerfile LSP client, provided by the Dockerfile Language Server."
     34   :group 'lsp-mode
     35   :version "8.0.0"
     36   :link '(url-link "https://github.com/rcjsuen/dockerfile-language-server-nodejs"))
     37 
     38 (defcustom lsp-dockerfile-language-server-command
     39   '("docker-langserver" "--stdio")
     40   "The command that starts the docker language server."
     41   :group 'lsp-dockerfile
     42   :type '(repeat :tag "List of string values" string))
     43 
     44 (lsp-dependency 'docker-langserver
     45                 '(:system "docker-langserver")
     46                 '(:npm :package "dockerfile-language-server-nodejs"
     47                        :path "docker-langserver"))
     48 
     49 (lsp-register-client
     50  (make-lsp-client :new-connection (lsp-stdio-connection
     51                                    (lambda ()
     52                                      `(,(or (executable-find
     53                                              (cl-first lsp-dockerfile-language-server-command))
     54                                             (lsp-package-path 'docker-langserver))
     55                                        ,@(cl-rest lsp-dockerfile-language-server-command))))
     56                   :activation-fn (lsp-activate-on "dockerfile")
     57                   :priority -1
     58                   :server-id 'dockerfile-ls
     59                   :download-server-fn (lambda (_client callback error-callback _update?)
     60                                         (lsp-package-ensure 'docker-langserver
     61                                                             callback error-callback))))
     62 
     63 (lsp-consistency-check lsp-dockerfile)
     64 
     65 (provide 'lsp-dockerfile)
     66 ;;; lsp-dockerfile.el ends here