Fix lsp-ui-doc-mode non-idempotency#798
Open
radon-at-beeper wants to merge 1 commit intoemacs-lsp:masterfrom
Open
Fix lsp-ui-doc-mode non-idempotency#798radon-at-beeper wants to merge 1 commit intoemacs-lsp:masterfrom
radon-at-beeper wants to merge 1 commit intoemacs-lsp:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per https://www.gnu.org/software/emacs/manual/html_node/elisp/Minor-Mode-Conventions.html:
The existing implementation of
lsp-ui-doc-modewas not idempotent. The first time it was enabled, it ranlsp-ui-doc--setup-mouse, which invoked:The second time it was enabled, it did the same thing, but now
track-mousewas already non-nil, makinglsp-ui-doc--mouse-tracked-by-usnil, even thoughlsp-ui-docwas in fact tracking the mouse. As a consequence,lsp-ui-doc--disable-mouse-on-prefixstopped functioning, causing a bug similar to #795, where if you typed a prefix key such asC-xand then moved the mouse (in a buffer where lsp-ui-doc-mode was enabled) it would abort the key sequence.You might not expect this sequence of events to come up commonly, but the default configuration of lsp-mode (or at least the one running in my config) apparently invokes
(lsp-ui-doc-mode 1)three separate times when setting up a new buffer. I don't know why. But this caused the prefix bug to trigger universally for me.I resolved the issue by adding a second mode variable for tracking whether or not
lsp-ui-doc--setup-mouseneeds to be run again. There may be additional idempotency issues, but this resolves one of them, at least.