Skip to content

Commit 36d0592

Browse files
committed
fix: use generic lsp-ht functions in actions
Fix: #28
1 parent 6af606b commit 36d0592

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lsp-ltex.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,20 +537,20 @@ This file is use to activate the language server."
537537
"Execute action ACTION-HT by getting KEY and storing it in the RULES-PLIST.
538538
When STORE is non-nil, this will also store the new plist in the directory
539539
`lsp-ltex-user-rules-path'."
540-
(let ((args-ht (gethash key action-ht)))
541-
(dolist (lang (hash-table-keys args-ht))
540+
(let ((args-ht (lsp-get (if lsp-use-plists action-ht (elt action-ht 0)) key)))
541+
(dolist (lang (lsp-ltex--lsp-keys args-ht))
542542
(mapc (lambda (rule)
543543
(lsp-ltex--add-rule lang rule rules-plist)
544544
(when store
545545
(lsp-ltex--serialize-symbol rules-plist lsp-ltex-user-rules-path)))
546-
(gethash lang args-ht)))))
546+
(lsp-get args-ht (intern (concat ":" lang)))))))
547547

548548
(lsp-defun lsp-ltex--code-action-add-to-dictionary ((&Command :arguments?))
549549
"Handle action for \"_ltex.addToDictionary\"."
550550
;; Add rule internally to the `lsp-ltex--stored-dictionary' plist and
551551
;; store it in the directory `lsp-ltex-user-rules-path'
552552
(lsp-ltex--action-add-to-rules
553-
(elt arguments? 0) "words" 'lsp-ltex--stored-dictionary t)
553+
arguments? :words 'lsp-ltex--stored-dictionary t)
554554
;; Combine user configured words `lsp-ltex-dictionary' and the internal
555555
;; interactively generated `lsp-ltex--stored-dictionary', and store them in
556556
;; the internal `lsp-ltex--combined-dictionary', which is sent to ltex-ls
@@ -560,7 +560,7 @@ When STORE is non-nil, this will also store the new plist in the directory
560560

561561
(lsp-defun lsp-ltex--code-action-hide-false-positives ((&Command :arguments?))
562562
"Handle action for \"_ltex.hideFalsePositives\"."
563-
(lsp-ltex--action-add-to-rules (elt arguments? 0) "falsePositives"
563+
(lsp-ltex--action-add-to-rules arguments? :falsePositives
564564
'lsp-ltex--stored-hidden-false-positives t)
565565
(setq lsp-ltex--combined-hidden-false-positives
566566
(lsp-ltex-combine-plists lsp-ltex-hidden-false-positives
@@ -569,7 +569,7 @@ When STORE is non-nil, this will also store the new plist in the directory
569569

570570
(lsp-defun lsp-ltex--code-action-disable-rules ((&Command :arguments?))
571571
"Handle action for \"_ltex.disableRules\"."
572-
(lsp-ltex--action-add-to-rules (elt arguments? 0) "ruleIds"
572+
(lsp-ltex--action-add-to-rules arguments? :ruleIds
573573
'lsp-ltex--stored-disabled-rules t)
574574
(setq lsp-ltex--combined-disabled-rules
575575
(lsp-ltex-combine-plists lsp-ltex-disabled-rules

0 commit comments

Comments
 (0)