config

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

lsp-bufls.el (2123B)


      1 ;;; lsp-bufls.el --- bufls-langserver Client settings -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2023  Jim Myhrberg
      4 
      5 ;; Author: Jim Myhrberg
      6 ;; Keywords: lsp, protobuf, buf, bufls
      7 
      8 ;; This file is not part of GNU Emacs
      9 
     10 ;;; License:
     11 ;;
     12 ;; This program is free software: you can redistribute it and/or modify
     13 ;; it under the terms of the GNU General Public License as published by
     14 ;; the Free Software Foundation, either version 3 of the License, or
     15 ;; (at your option) any later version.
     16 ;;
     17 ;; This program is distributed in the hope that it will be useful,
     18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 ;; GNU General Public License for more details.
     21 ;;
     22 ;; You should have received a copy of the GNU General Public License
     23 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     24 
     25 ;;; Commentary:
     26 ;;
     27 ;; lsp-bufls client
     28 
     29 ;;; Code:
     30 
     31 (require 'lsp-mode)
     32 (require 'lsp-go)
     33 
     34 (defgroup lsp-bufls nil
     35   "Configuration options for lsp-bufls."
     36   :group 'lsp-mode
     37   :link '(url-lint "https://github.com/bufbuild/buf-language-server")
     38   :package-version '(lsp-mode . "9.0.0"))
     39 
     40 (defcustom lsp-bufls-args nil
     41   "Arguments to pass to bufls serve."
     42   :type '(repeat string)
     43   :package-version '(lsp-mode . "9.0.0"))
     44 
     45 (defcustom lsp-bufls-path "bufls"
     46   "Command to run bufls."
     47   :type 'string
     48   :package-version '(lsp-mode . "9.0.0"))
     49 
     50 (defun lsp-bufls-server--stdio-command ()
     51   "Return the command and args to start bufls-langserver."
     52   (let ((args (list lsp-bufls-path "serve")))
     53     (when (and (listp lsp-bufls-args)
     54                (> (length lsp-bufls-args) 0))
     55       (setq args (append args lsp-bufls-args)))
     56     args))
     57 
     58 (lsp-register-client
     59  (make-lsp-client :new-connection (lsp-stdio-connection
     60                                    #'lsp-bufls-server--stdio-command)
     61                   :activation-fn (lsp-activate-on "protobuf")
     62                   :language-id "protobuf"
     63                   :priority 0
     64                   :server-id 'bufls))
     65 
     66 (lsp-consistency-check lsp-bufls)
     67 
     68 (provide 'lsp-bufls)
     69 ;;; lsp-bufls.el ends here