You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When auto-configure is enabled, remove hooks for disabled options (#3078)
* When auto-configure is enabled, remove hooks for disabled options
When `lsp-auto-configure' is enabled, hooks are automatically added to
`lsp-configure-hook' for any options which are enabled. However, if any
of those options are later disabled, the hooks were not removed from
`lsp-configure-hook`; therefore the corresponding behaviour did not
get disabled.
So add the relevant `remove-hook' calls when options are not enabled.
Partial fix for #2525.
* Call lsp--auto-configure from lsp-configure-buffer
Currently `lsp' is the only thing calling `lsp--auto-configure', which
means that auto-configuration only activates when `lsp-mode' called,
rather than when a buffer needs to be configured.
If we consider the following flow:
1. An option `lsp-headerline-breadcrumb-enable' (say) is set to `t'.
2. `lsp-mode` is called, triggering `lsp--auto-configure', which in
turn executes:
(add-hook 'lsp-configure-hook 'lsp-headerline-breadcrumb-mode)
3. `lsp-headerline-breadcrumb-enable' is set to `nil'.
4. Another buffer is opened.
5. At this point, `lsp-headerline-breadcrumb-mode' is still in
`lsp-configure-hook', therefore, the breadcrumb headerline will be
activated even though the option is disabled. Clearly this is
undesirable, as reported in #2525.
So call `lsp--auto-configure` from `lsp-configure-buffer', so that
any hooks which need to be removed will get removed.
Fixes#2525.
0 commit comments