From 5fca440bebc39de0fc4b9e171d9982afb6d9c954 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 11 May 2021 17:55:05 -0400 Subject: [PATCH] lang/beancount: add beancount-langserver support Mentioned in #5035. Remove when emacs-lsp/lsp-mode#2863 is resolved. --- modules/lang/beancount/config.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/lang/beancount/config.el b/modules/lang/beancount/config.el index e341ab2c2..c5fa6adb8 100644 --- a/modules/lang/beancount/config.el +++ b/modules/lang/beancount/config.el @@ -31,7 +31,20 @@ This msut be advised *before* beancount-mode loads, because (when (featurep! +lsp) (after! lsp-mode ;; TODO PR this upstream - (add-to-list 'lsp-language-id-configuration '(beancount-mode . "beancount"))) + (add-to-list 'lsp-language-id-configuration '(beancount-mode . "beancount")) + (defvar lsp-beancount-langserver-executable "beancount-langserver") + (defvar lsp-beancount-journal-file nil) + (defvar lsp-beancount-python-interpreter + (or (executable-find "python3") + (executable-find "python"))) + (lsp-register-client + (make-lsp-client :new-connection + (lsp-stdio-connection `(,lsp-beancount-langserver-executable "--stdio")) + :major-modes '(beancount-mode) + :initialization-options + `((journalFile . ,lsp-beancount-journal-file) + (pythonPath . ,lsp-beancount-python-interpreter)) + :server-id 'beancount-ls))) (add-hook 'beancount-mode-local-vars-hook #'lsp!)) (setq beancount-electric-currency t)