Namespace load-state indicator in the mode line#3973
Draft
bbatsov wants to merge 1 commit into
Draft
Conversation
Surface, right in the `cider-mode` lighter, whether the current buffer's namespace is actually loaded into the REPL and whether it's still in sync with what was loaded. The lighter shows ` not-loaded` for a namespace the runtime doesn't know about and ` stale` once you've edited the buffer since the last load - the common "why is my change not taking effect" trap. State is cached buffer-locally and never queried during redisplay, so the lighter stays cheap. It's refreshed when CIDER loads a file, on demand via `cider-ns-refresh-load-state`, and once per buffer when you focus it. We deliberately avoid querying at connection time.
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.
Make it obvious, without running anything, whether the buffer you're looking at is actually loaded into the REPL.
The
cider-modelighter grows a small marker:not-loaded- this namespace isn't loaded in the running REPL (operating on it will likely misbehave).stale- the buffer has been edited since it was last loaded via CIDER.How it works:
cider--ns-loadedplus abuffer-chars-modified-tickbaseline) and the lighter only reads that cache, so redisplay never touches the network.cider-file-loaded-hook), on demand viaM-x cider-ns-refresh-load-state, and once per buffer when you first focus it (window-selection-change-functions).cider/ns-listrequest fired during the connection dance breaks the mock-server tests, and focus-driven refresh is nicer UX anyway.cider-show-ns-load-state.Known limitations (intentional for now):
staleonly works for namespaces CIDER itself loaded - if a namespace was loaded outside CIDER (or before it attached) there's no reliable sync baseline, so it shows as loaded and never goes stale.Opening this as a draft to gather feedback - the markers, triggers and defaults are all up for discussion.