Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client settings cannot be overridden #4382

Closed
3 tasks done
vljosa-vivodyne opened this issue Mar 19, 2024 · 0 comments · Fixed by #4383
Closed
3 tasks done

Client settings cannot be overridden #4382

vljosa-vivodyne opened this issue Mar 19, 2024 · 0 comments · Fixed by #4383
Labels

Comments

@vljosa-vivodyne
Copy link
Contributor

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

Calling lsp-register-custom-settings twice does not properly override the value because the hash table is created with the default :test 'eql. Therefore, when I try to override a setting using a string that is equal to the one used previously, it's added to the hash table as a new key.

Steps to reproduce

(clrhash lsp-client-settings)
(lsp-register-custom-settings '(("foo" "original value")))
(lsp-register-custom-settings '(("foo" "new value")))

(let ((hash-table-contents nil))
  (maphash (lambda (k v) (push (cons k v) hash-table-contents))
	   lsp-client-settings)
  hash-table-contents)
;; => (("foo" "new value") ("foo" "original value"))

(gethash "foo" lsp-client-settings)
;; => nil

Expected behavior

(let ((hash-table-contents nil))
  (maphash (lambda (k v) (push (cons k v) hash-table-contents))
	   lsp-client-settings)
  hash-table-contents)
;; => (("foo" "new value"))

(gethash "foo" lsp-client-settings)
;; => ("new value")

Which Language Server did you use?

pyright-langserver (but it shouldn't matter)

OS

MacOS

Error callstack

No response

Anything else?

I'll submit a PR in a minute.

vljosa-vivodyne added a commit to vljosa-vivodyne/lsp-mode that referenced this issue Mar 19, 2024
Create hash table with `:test 'equal` so that
`lsp-register-custom-settings` can be called again to override
settings.

Resolves emacs-lsp#4382
yyoncho pushed a commit that referenced this issue Mar 19, 2024
Create hash table with `:test 'equal` so that
`lsp-register-custom-settings` can be called again to override
settings.

Resolves #4382
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant