config

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

lsp-beancount.el (2034B)


      1 ;;; lsp-beancount.el --- Beancount Client settings         -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2021 emacs-lsp maintainers
      4 
      5 ;; Author: emacs-lsp maintainers
      6 ;; Keywords: lsp, beancount
      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 Beancount
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 (defgroup lsp-beancount nil
     30   "Settings for the Beancount Language Server."
     31   :group 'lsp-mode
     32   :link '(url-link "https://github.com/polarmutex/beancount-language-server")
     33   :package-version '(lsp-mode . "8.0.0"))
     34 
     35 (defcustom lsp-beancount-langserver-executable "beancount-language-server"
     36   "Command to start Beancount language server."
     37   :type 'string
     38   :group 'lsp-beancount
     39   :package-version '(lsp-mode . "8.0.0"))
     40 
     41 (defcustom lsp-beancount-journal-file nil
     42   "Path to Beancount journal file.
     43 
     44 The path can be absolute, or relative to the currently opened file.
     45 Use nil (the default) to use the current beancount buffer as the journal file."
     46   :type 'string
     47   :group 'lsp-beancount
     48   :package-version '(lsp-mode . "8.0.0"))
     49 
     50 (lsp-register-client
     51  (make-lsp-client
     52   :new-connection
     53   (lsp-stdio-connection
     54    (lambda ()
     55       `(,lsp-beancount-langserver-executable "--stdio")))
     56   :major-modes '(beancount-mode)
     57   :initialization-options
     58   `((journalFile . ,lsp-beancount-journal-file))
     59   :server-id 'beancount-ls))
     60 
     61 (lsp-consistency-check lsp-beancount)
     62 
     63 (provide 'lsp-beancount)
     64 ;;; lsp-beancount.el ends here