fix(highlight): respect auto_focus toggle in workspace edit handler#3
Merged
Conversation
The workspace/applyEdit handler always opened and scrolled to edited files regardless of the auto_focus setting. When the user toggled auto_focus off via :CrushFocusOff or the API, the handler ignored this because: 1. highlight.lua had its own config copy that was never updated when init.lua toggled auto_focus 2. ensure_buffer_visible always opened new windows for edited buffers Fix: pass a callback from init.lua to highlight.lua that reads the live config.auto_focus state. When auto_focus is off, edits are still applied and visible buffers still get flash highlights, but the handler no longer opens new windows or scrolls to the edit location.
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.
Problem
The
workspace/applyEdithandler always opened and scrolled to edited files regardless of theauto_focussetting. When the user toggled auto-focus off via:CrushFocusOffor the API, the handler ignored this because:highlight.luahad its ownconfigcopy set duringsetup()that was never updated wheninit.luatoggledauto_focusensure_buffer_visible()always opened new windows for off-screen buffersFix
Pass a callback from
init.luatohighlight.luathat reads the liveconfig.auto_focusstate. This ensures the handler always sees the current toggle state.When auto-focus is off:
When auto-focus is on (default): behavior is unchanged.
Changes
highlight.lua: Addedauto_focus_checkcallback,is_auto_focus_enabled()helper, gated window-opening and scroll logiclsp.lua: Passes callback options through tohighlight.setup()init.lua: Passes closure over liveconfig.auto_focuswhen setting up LSPAll 55 tests pass.