fix(neovim): relax CWD matching for instance discovery and fix active visual selection capture#63
Merged
aliou merged 1 commit intoaliou:mainfrom Mar 5, 2026
Merged
Conversation
… visual selection capture
Owner
|
LGTM! Thanks for taking the time, let me know if the demo works better this time! Auto review: https://pi.dev/session/#a1fb4f54914dc4a06c2b2e823826fbfa |
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.
The Neovim extension's instance discovery required an exact CWD match between Pi and Neovim, which meant opening Neovim in a project subdirectory (e.g.
./src) while Pi ran from the project root would silently fail to connect. Separately, querying the editor's visual selection while the user was still in visual mode returned stale data from the previous selection because the Lua plugin read'</'>marks that only update after exiting visual mode.This makes discovery a more flexible and resilient by falling back to child-directory CWD matching (with symlink resolution and proximity sorting), and it fixes the selection capture to use the live
v/.marks. It also hardens the lockfile handling that the broader scan now touches: filename-pattern filtering, schema validation before deletion, and correct EPERM handling in process-liveness checks.Summary of changes:
{8-hex}-{pid}.jsonnaming convention and validatesocket/cwd/pidschema before accepting or deleting filesfs.realpathSync.native()so symlinked project roots still matchEPERMfromprocess.kill(pid, 0)as "process exists" instead of deleting the lockfilegetpos("'<")/getpos("'>")togetpos("v")/getpos(".")for live visual-mode capture, with start/end normalization for backwards selectionsnvim.test.tscovering exact-vs-related discovery, lockfile safety, EPERM branch, and symlink matchingintegrations/**/*.test.tsin vitest config