Skip to content

Fix documentation info panel updates and timer lifecycle - #23

Open
dalugm wants to merge 2 commits into
bbatsov:mainfrom
dalugm:fix/info-panel-timer-lifecycle
Open

dalugm wants to merge 2 commits into
bbatsov:mainfrom
dalugm:fix/info-panel-timer-lifecycle

Conversation

@dalugm

@dalugm dalugm commented Nov 6, 2026 •

Copy link
Copy Markdown

The documentation info panel has two problems: enabling its buffer-local mode repeatedly leaks global idle timers, and real FsAutoComplete documentation responses never reach the renderer because their JSON content envelope is not decoded.

This PR fixes them in separate commits:

  • Share one timer across enabled buffers. Unregister buffers on disable, major-mode changes, and buffer deletion; stop the timer when the last buffer unregisters. Update only the selected buffer with info mode enabled and release cached positions when their buffer unregisters.
  • Decode the :content JSON string returned by fsharp/documentation and render its Data object for formattedDocumentation responses. Ignore empty, invalid, and non-documentation responses.

Adds lifecycle and response-parsing regression tests, plus changelog entries.

Validation on GNU Emacs 31.1 / macOS:

  • 50 Buttercup specs passed across info, lens, and Eglot tests.
  • fsharp-ts-info.el byte-compiles with warnings treated as errors; checkdoc and git diff --check pass.
  • Real FsAutoComplete 0.86.1 with .NET SDK 10.0.403 and the project's F# grammars: Eglot manages two source buffers, documentation appears in the panel buffer, and invoking the update callback after selecting the other source buffer displays its documentation. Shared-timer identity, repeated enabling, and cleanup after disabling/changing major mode were also checked.
  • Before the response-parsing fix, the same live server returned valid documentation in :content, but the package's fetch function returned nil.

The live test ran in batch Emacs; GUI redisplay and the full grammar-dependent test suite were not exercised locally. The existing CI matrix covers Emacs 29.4, 30.1, and snapshot.

Fixes #22.

Share one idle timer across buffers with info mode enabled, and unregister
buffers when disabling the mode, changing major mode, or killing them.
Restrict automatic updates to the selected buffer with info mode enabled
and clear cached positions when their buffer is unregistered.

Add regression coverage for multiple buffers, repeated enables, cleanup,
and selected-buffer updates.

Fixes bbatsov#22
The fsharp/documentation response contains a JSON string in its content
property. Decode that payload before passing its Data object to the info
renderer, and ignore non-documentation responses.

Cover the actual response envelope, null and malformed payloads, request
failures, and the absence of a server. Verify documentation display and
selected-buffer updates against FsAutoComplete 0.86.1 through Eglot.
@dalugm dalugm changed the title Fix documentation info panel timer lifecycle Fix documentation info panel updates and timer lifecycle Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Info panel leaks idle timers across buffers and mode changes

1 participant