Skip to content

Commit

Permalink
Fix client settings cannot be overridden (#4383)
Browse files Browse the repository at this point in the history
Create hash table with `:test 'equal` so that
`lsp-register-custom-settings` can be called again to override
settings.

Resolves #4382
  • Loading branch information
vljosa-vivodyne authored Mar 19, 2024
1 parent 06a21b8 commit 8903da3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -8514,7 +8514,7 @@ session workspace folder configuration for the server."
(funcall initialization-options-or-fn)
initialization-options-or-fn)))

(defvar lsp-client-settings (make-hash-table)
(defvar lsp-client-settings (make-hash-table :test 'equal)
"For internal use, any external users please use
`lsp-register-custom-settings' function instead")

Expand Down
9 changes: 9 additions & 0 deletions test/lsp-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,13 @@
"textDocument/hover")))
2)))

(ert-deftest lsp-test--register-custom-settings-override ()
"Test that custom settings can be overridden."
(clrhash lsp-client-settings)
(lsp-register-custom-settings '(("foo" "original value")))
(lsp-register-custom-settings '(("foo" "new value")))
(should (equal (gethash "foo" lsp-client-settings) '("new value"))))



;;; lsp-mode-test.el ends here

0 comments on commit 8903da3

Please sign in to comment.