diff --git a/lsp-ltex.el b/lsp-ltex.el index 940ff02..17e2163 100644 --- a/lsp-ltex.el +++ b/lsp-ltex.el @@ -354,6 +354,33 @@ 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)))))) + +;; 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" ) ;;