Skip to content

Commit

Permalink
tweak(ltex): minor edits, add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed May 23, 2023
1 parent f02b0a7 commit 8e0421c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 1 addition & 3 deletions core/me-loaddefs.el
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,7 @@ Fallback to FALLBACK-RELEASE when it can't get the last one.

;;; Generated autoloads from ../modules/extras/me-eglot-ltex.el

(autoload 'ltex-ls-start "../modules/extras/me-eglot-ltex" "\
Start LTeX-LS as a TCP server at localhost:40001." t)
(register-definition-prefixes "../modules/extras/me-eglot-ltex" '("eglot-ltex-" "ltex-ls-"))
(register-definition-prefixes "../modules/extras/me-eglot-ltex" '("eglot-ltex-"))


;;; Generated autoloads from ../modules/extras/me-elisp-extras.el
Expand Down
22 changes: 13 additions & 9 deletions modules/extras/me-eglot-ltex.el
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,23 @@
(defvar eglot-ltex-disable-rules
(+deserialize-sym 'eglot-ltex-disable-rules eglot-ltex-user-rules-path))

(defun eglot-ltex--can-process-client-commands-a (srv cmd args)
(defun eglot-ltex--process-client-commands-a (_srv cmd args)
"Process LTeX-LS client commands."
(cond
((string= cmd "_ltex.addToDictionary")
(eglot-ltex--action-add-to-rules args :words 'eglot-ltex-dictionary t)
(message "[INFO] Word added to dictionary."))
(eglot-ltex--action-add-to-rules args :words 'eglot-ltex-dictionary 'store)
(message "Word added to dictionary."))
((string= cmd "_ltex.hideFalsePositives")
(eglot-ltex--action-add-to-rules args :falsePositives 'eglot-ltex-hidden-false-positives t)
(message "[INFO] Rule added to false positives."))
(eglot-ltex--action-add-to-rules args :falsePositives 'eglot-ltex-hidden-false-positives 'store)
(message "Rule added to false positives."))
((string= cmd "_ltex.disableRules")
(eglot-ltex--action-add-to-rules args :ruleIds 'eglot-ltex-disable-rules t)
(message "[INFO] Rule added to disable rules."))))
(eglot-ltex--action-add-to-rules args :ruleIds 'eglot-ltex-disable-rules 'store)
(message "Rule added to disable rules."))))

(defun eglot-ltex-workspace-config-fn (&optional _server)
"A function to use as a value of `eglot-workspace-configuration'.
It generates the workspace configuration dynamically, taking into account
changed values of `eglot-ltex-language', `eglot-ltex-dictrionary', and so on."
`(:ltex
(:language ,eglot-ltex-language
:dictionary ,eglot-ltex-dictionary
Expand Down Expand Up @@ -96,12 +100,12 @@ When STORE is non-nil, this will also store the new plist in the directory
(defun eglot-ltex-enable-handling-client-commands ()
"Enable Eglot hack to handle code actions of LTeX-LS."
(interactive)
(advice-add 'eglot-execute-command :before #'eglot-ltex--can-process-client-commands-a))
(advice-add 'eglot-execute-command :before #'eglot-ltex--process-client-commands-a))

(defun eglot-ltex-disable-handling-client-commands ()
"Disable Eglot hack to handle code actions of LTeX-LS."
(interactive)
(advice-remove 'eglot-execute-command #'eglot-ltex--can-process-client-commands-a))
(advice-remove 'eglot-execute-command #'eglot-ltex--process-client-commands-a))


(provide 'me-eglot-ltex)
Expand Down

0 comments on commit 8e0421c

Please sign in to comment.