From 344ee204c8e7de6d13b84f30198b3a7e247f74b6 Mon Sep 17 00:00:00 2001 From: Abdelhak Bougouffa Date: Thu, 15 Sep 2022 01:20:43 +0200 Subject: [PATCH 1/2] Add support for the `_ltex.checkDocument` command --- lsp-ltex.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lsp-ltex.el b/lsp-ltex.el index 940ff02..7226bce 100644 --- a/lsp-ltex.el +++ b/lsp-ltex.el @@ -354,6 +354,28 @@ and concatenate them." (setq res (plist-put res prop (vconcat val (plist-get res prop)))))) res)) +;; +;; (@* "LTeX Special Commands") +;; + +;; https://valentjn.github.io/ltex/ltex-ls/server-usage.html#_ltexcheckdocument-server +(defun lsp-ltex-check-document () + "Trigger the check of the current buffer/region." + (interactive) + (when-let ((file (buffer-file-name))) + (let* ((uri (lsp--path-to-uri file)) + (beg (region-beginning)) + (end (region-end)) + (req (if (region-active-p) + `(:uri ,uri + :range ,(lsp--region-to-range beg end)) + `(:uri ,uri))) + (ret (lsp-send-execute-command "_ltex.checkDocument" req))) + (if (and ret (plist-get ret :success)) + (message "Command executed successfully.") + (message "An error occured while executing the command: %s" + (plist-get ret :errorMessage)))))) + ;; ;; (@* "Installation and Upgrade" ) ;; From e4744b77e64483b6d6f2a7f631751bbe5dd223bc Mon Sep 17 00:00:00 2001 From: Abdelhak Bougouffa Date: Thu, 15 Sep 2022 01:32:51 +0200 Subject: [PATCH 2/2] Add initial implementation for `_ltex.getServerStatus` --- lsp-ltex.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lsp-ltex.el b/lsp-ltex.el index 7226bce..17e2163 100644 --- a/lsp-ltex.el +++ b/lsp-ltex.el @@ -376,6 +376,11 @@ and concatenate them." (message "An error occured while executing the command: %s" (plist-get ret :errorMessage)))))) +;; https://valentjn.github.io/ltex/ltex-ls/server-usage.html#_ltexgetserverstatus-server +(defun lsp-ltex-get-server-status () + "Get the server status." + (lsp-send-execute-command "_ltex.getServerStatus")) + ;; ;; (@* "Installation and Upgrade" ) ;;