Skip to content

Commit 8903da3

Browse files
Fix client settings cannot be overridden (#4383)
Create hash table with `:test 'equal` so that `lsp-register-custom-settings` can be called again to override settings. Resolves #4382
1 parent 06a21b8 commit 8903da3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lsp-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8514,7 +8514,7 @@ session workspace folder configuration for the server."
85148514
(funcall initialization-options-or-fn)
85158515
initialization-options-or-fn)))
85168516

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

test/lsp-mode-test.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,13 @@
175175
"textDocument/hover")))
176176
2)))
177177

178+
(ert-deftest lsp-test--register-custom-settings-override ()
179+
"Test that custom settings can be overridden."
180+
(clrhash lsp-client-settings)
181+
(lsp-register-custom-settings '(("foo" "original value")))
182+
(lsp-register-custom-settings '(("foo" "new value")))
183+
(should (equal (gethash "foo" lsp-client-settings) '("new value"))))
184+
185+
186+
178187
;;; lsp-mode-test.el ends here

0 commit comments

Comments
 (0)