config

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

lsp-emmet.el (2152B)


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