Skip to content

Random regressions due to lsp overriding user settings via lsp-register-custom-settings #4420

Open
@Hi-Angel

Description

@Hi-Angel

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

Commit 782e1dc by @LaurenceWarne introduced a regression and broke mypy completely for me. That happened, because I had set the same lsp-server settings that the commit modified.

Further research shown that there's nothing wrong with the commit per se, instead the problem is in how lsp-mode handles lsp-server settings. Whatever user sets with lsp-register-custom-settings is being overwritten by lsp-mode, leading to random problems like this one.

Instead lsp-register-custom-settings should not overwrite settings that a user has set.

Steps to reproduce

  1. Create /tmp/.emacs with the following content:
    (package-initialize)
    (use-package lsp-mode
      :config
      (setq lsp-log-io t)
      (lsp-register-custom-settings '(("pylsp.plugins.pylsp_mypy.enabled" t t))))
  2. Start emacs as emacs -Q -l /tmp/.emacs test.py
  3. Start lsp-mode in the test.py buffer by evaluating M-x lsp
  4. Switch to buffer with communication log by evaluating M-x lsp-workspace-show-log
  5. Search for word pylsp_mypy and look at the value of enabled just below the pylsp_mypy line

Expected behavior

It is true.

Which Language Server did you use?

pylsp

OS

Linux

Error callstack

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions