Remote session#67
Merged
Merged
Conversation
Prevent files from opening in terminal picker/terminal windows by validating cached window IDs before reuse. Added is_file_window_suitable() helper that checks for valid window type, excludes floating windows, and explicitly excludes terminal infrastructure windows. The cached file_win_id is now revalidated on every use to ensure it remains suitable for opening files, fixing the issue where terminals opened in a previously cached window would incorrectly receive file buffers. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request introduces a comprehensive remote session management system that unifies file browsing, terminal management, and workspace state persistence. The changes enable users to work with multiple remote connections simultaneously, minimize/restore entire working sessions with their window layouts, and persist session state across Neovim restarts.
Changes:
- Enhanced window and buffer management to properly exclude floating windows, terminal infrastructure windows, and special buffers when opening remote files
- Added session association tracking between terminals and remote sessions with filtering in the picker UI
- Introduced a complete remote-session module with session lifecycle management, persistence, UI picker, statusline integration, and user commands
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/remote-terminal/window_manager.lua | Added safe window hiding logic to handle last-window edge case |
| lua/remote-terminal/terminal_session.lua | Improved terminal creation using nvim_buf_call and enhanced close logic to prevent layout corruption |
| lua/remote-terminal/terminal_manager.lua | Added session association tracking and management functions |
| lua/remote-terminal/picker.lua | Implemented session-based terminal filtering |
| lua/remote-terminal/init.lua | Added WinClosed autocmd for detecting externally closed windows |
| lua/remote-ssh.lua | Integrated remote-session setup |
| lua/remote-session/window_layout.lua | New module for capturing and restoring window layouts |
| lua/remote-session/statusline.lua | New module providing statusline components for session display |
| lua/remote-session/session_manager.lua | New core state management module for active/minimized sessions |
| lua/remote-session/session.lua | New module handling session lifecycle operations (create, minimize, restore, close) |
| lua/remote-session/picker.lua | New floating window UI for session selection and management |
| lua/remote-session/persistence.lua | New module for JSON-based session persistence |
| lua/remote-session/naming.lua | New module for auto-generating and validating session names |
| lua/remote-session/init.lua | New public API for the remote-session module |
| lua/remote-session/config.lua | New configuration system with defaults for session behavior |
| lua/remote-session/commands.lua | New user commands for session operations |
| lua/async-remote-write/tree_browser.lua | Enhanced window suitability checks and added session state API functions |
| lua/async-remote-write/operations.lua | Improved window exclusion logic, position normalization, and buffer-session registration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove unused `original_state` variable, deduplicate regex match for host parsing, remove dead legacy `restore_buffer_states` function, and document `session_buffers` field in RemoteSession class annotation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the complete remote-session feature introduced in PR #67: quick start step, features bullet, configuration block, dedicated usage section with picker keybinds and statusline integration, and all 7 commands in the commands table. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
This pull request introduces significant improvements to window and buffer management for remote file operations and adds a new user command interface for remote session control. The changes enhance robustness by properly handling floating and terminal windows, normalizing buffer positions, and integrating session management for buffers and tree browser state. Additionally, the new commands provide a comprehensive CLI for managing remote sessions.
Window and buffer suitability improvements:
simple_open_remote_fileand tree browser file opening, ensuring files are only opened in appropriate windows. [1] [2] [3] [4]Session management integration:
Remote session command interface:
lua/remote-session/commands.luawith user commands for session operations: open, close, minimize, rename, list, picker, and restore, including completion and error handling for improved user experience.