feat(tmux): robust tmux exit and prevent layout change on AddCurrentFile#50
feat(tmux): robust tmux exit and prevent layout change on AddCurrentFile#50nekowasabi merged 4 commits intomainfrom
Conversation
…xit always clean up tmux pane - Skip prepare/reattach in split/vsplit when a tmux pane already exists to prevent join-pane resizing on AddCurrentFile - Make :AiderExit always invoke exit handler so tmux pane is cleaned up even without an open buffer - Add tests covering tmux prompt send, add-current-file behavior, and exit cleanup
…n test/mock paths
|
Caution Review failedThe pull request is closed. WalkthroughThe changes introduce existence checks before removing the global variable Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Vim
participant AiderPlugin
participant Tmux
User->>Vim: Issues Aider exit command
Vim->>AiderPlugin: Calls exit logic
AiderPlugin->>Vim: Check if g:aider_tmux_pane_id exists
alt Variable exists
AiderPlugin->>Vim: Remove g:aider_tmux_pane_id
else Variable does not exist
AiderPlugin-->>Vim: Skip removal
end
AiderPlugin->>Tmux: Kill pane (if needed)
Vim->>User: Command completes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/aider_tmux_test.ts (1)
67-82: Use an assertion helper instead of manual throwLines 78-81 manually check
exists()and throw. Prefer usingassertEquals(hasPane, 0)(orassert) for consistency with the rest of the suite.-if (hasPane === 1) { - throw new Error("tmux pane id should be cleared by AiderExit"); -} +assertEquals(hasPane, 0, "tmux pane id should be cleared by AiderExit");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
denops/aider/actualAiderCommand.ts(1 hunks)denops/aider/bufferOperation.ts(1 hunks)denops/aider/main.ts(2 hunks)tests/aider_tmux_test.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#28
File: .github/workflows/deno.yml:85-91
Timestamp: 2024-10-12T13:50:39.857Z
Learning: Tests in 'aider.vim' require the `-A` flag when running Deno tests because they use Deno APIs that need elevated permissions.
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#18
File: denops/aider/aiderCommand.ts:45-53
Timestamp: 2024-09-30T14:46:06.173Z
Learning: In the `sendPrompt` function in `denops/aider/aiderCommand.ts`, replacing `fn.feedkeys` with `fn.append` did not work.
Learnt from: nekowasabi
PR: nekowasabi/aider.vim#35
File: tests/aider_test.ts:51-59
Timestamp: 2024-10-24T10:59:24.483Z
Learning: tests/aider_test.ts では、仕様上 `await sleep(SLEEP_BEFORE_ASSERT);` が必要であり、これを削除すると正しく動作しません。
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#33
File: denops/aider/main.ts:104-104
Timestamp: 2024-10-22T04:24:37.284Z
Learning: In `denops/aider/main.ts`, when calling `buffer.sendPrompt`, it's permissible to omit the `opts` parameter since it has a default value.
📚 Learning: 2024-10-12T13:50:39.857Z
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#28
File: .github/workflows/deno.yml:85-91
Timestamp: 2024-10-12T13:50:39.857Z
Learning: Tests in 'aider.vim' require the `-A` flag when running Deno tests because they use Deno APIs that need elevated permissions.
Applied to files:
tests/aider_tmux_test.tsdenops/aider/actualAiderCommand.tsdenops/aider/main.tsdenops/aider/bufferOperation.ts
📚 Learning: 2024-10-24T10:59:24.483Z
Learnt from: nekowasabi
PR: nekowasabi/aider.vim#35
File: tests/aider_test.ts:51-59
Timestamp: 2024-10-24T10:59:24.483Z
Learning: tests/aider_test.ts では、仕様上 `await sleep(SLEEP_BEFORE_ASSERT);` が必要であり、これを削除すると正しく動作しません。
Applied to files:
tests/aider_tmux_test.tsdenops/aider/actualAiderCommand.tsdenops/aider/main.tsdenops/aider/bufferOperation.ts
📚 Learning: 2024-10-22T04:24:37.284Z
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#33
File: denops/aider/main.ts:104-104
Timestamp: 2024-10-22T04:24:37.284Z
Learning: In `denops/aider/main.ts`, when calling `buffer.sendPrompt`, it's permissible to omit the `opts` parameter since it has a default value.
Applied to files:
tests/aider_tmux_test.tsdenops/aider/actualAiderCommand.tsdenops/aider/main.tsdenops/aider/bufferOperation.ts
📚 Learning: 2024-09-30T14:46:06.173Z
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#18
File: denops/aider/aiderCommand.ts:45-53
Timestamp: 2024-09-30T14:46:06.173Z
Learning: In the `sendPrompt` function in `denops/aider/aiderCommand.ts`, replacing `fn.feedkeys` with `fn.append` did not work.
Applied to files:
tests/aider_tmux_test.tsdenops/aider/actualAiderCommand.tsdenops/aider/main.tsdenops/aider/bufferOperation.ts
📚 Learning: 2024-10-05T15:24:04.950Z
Learnt from: tsukimizake
PR: nekowasabi/aider.vim#23
File: denops/aider/actualAiderCommand.ts:76-79
Timestamp: 2024-10-05T15:24:04.950Z
Learning: `denops/aider/actualAiderCommand.ts` の `sendPrompt` 関数で直接 `chansend` を使用すると、入力が分割されてしまう可能性がある。
Applied to files:
tests/aider_tmux_test.tsdenops/aider/actualAiderCommand.tsdenops/aider/main.tsdenops/aider/bufferOperation.ts
🧬 Code Graph Analysis (1)
tests/aider_tmux_test.ts (3)
tests/testRunner.ts (1)
test(22-37)tests/assertions.ts (3)
sleep(6-7)assertAiderBufferAlive(46-52)assertAiderBufferString(60-75)tests/aider_test.ts (7)
denops(50-67)denops(19-24)denops(70-78)denops(37-44)denops(83-91)denops(26-32)denops(13-17)
🔇 Additional comments (3)
denops/aider/bufferOperation.ts (1)
61-65: Good defensive cleanupThe extra
exists()guard preventsunlet:E108when the variable is missing – nice touch.denops/aider/actualAiderCommand.ts (1)
146-149: Consistent variable-existence checkMirrors the safeguard added elsewhere, keeping the exit path robust in both code- and tmux-driven exits.
tests/aider_tmux_test.ts (1)
32-45: Assertion may be brittleWhen
g:aider_tmux_pane_idis set,sendPromptroutes the text to the tmux pane, not the Aider buffer.
assertAiderBufferStringwill only pass because of test stubs; in real usage the buffer won’t update.
Recommend assertingassertAiderBufferAlive(or inspecting the pane) instead of buffer contents to avoid false positives.
…ipping prepareAiderBuffer
Summary
Details
g:aider_tmux_pane_idonly if it exists.g:aider_tmux_pane_idexists, do not callprepareAiderBufferso layout stays unchanged.tests/aider_tmux_test.tsand ensured suite passes.Test plan
Summary by CodeRabbit
Bug Fixes
Tests