[issues/643] Fix R-F on images and other non-text editor tabs#651
Conversation
## Summary R-F (`Cmd+R Cmd+F` / `Ctrl+R Ctrl+F`, "paste current file path") showed `No active file. Open a file and try again.` whenever the active tab was an image, notebook, or diff view, because the paster only consulted `vscode.window.activeTextEditor`. The paster now resolves the URI from the active tab's input, covering every tab kind that maps to a file. ## Changes - Added `VscodeAdapter.getActiveTabUri()`: resolves a file URI from any tab input by checking `input.uri ?? input.modified`, with a `vscode.Uri` duck-type guard. Works for text editors, custom editors (images), notebooks, and diff views (returns `.modified`). Future VS Code tab types with a file URI work automatically. - Added `VscodeAdapter.getActiveTabViewColumn()` so self-paste detection still works when the active tab is non-text. - Switched `FilePathPaster.pasteCurrentFilePath` to the new tab-based adapter methods. `LinkGenerator` and `getEligibleFiles` keep `getActiveTextEditorUri`; they need real text-editor geometry. - Centralized integration-test file cleanup into a module-level registry in `fileHelpers.ts`. Every file-creation helper (`createFileAt`, `createWorkspaceFile`, `createPngFixture`) auto-registers for teardown. `trackFileUri` removed from the `SsContext` interface. - Refactored `filePicker.test.ts` subdirectory file creation to use `createFileAt` (which now supports subdirectory paths via `ensureParentDir`), dropping manual `fs.mkdirSync` / `fs.writeFileSync` / `ss.trackFileUri` boilerplate. - Documentation: CHANGELOG entry added under [Unreleased] → Fixed. README not updated (existing R-F documentation is still accurate). ## Test Plan - [x] Unit suite: 2067 / 2067 passing - [x] New integration tests `send-file-path-017` (image preview / custom editor) and `send-file-path-018` (text diff / asserts modified side is used): both passing - [x] Affected integration tests (sfp-004, sfp-005, sfp-006, sfp-009, sfp-015, ted-002, fp-003, fp-011, rvec-014) all passing - [x] QA YAML entries for 017 and 018 added; validate-qa-coverage passes ## Related - Closes #643
|
The PR introduces changes to the behavior of the R-F command, allowing it to work with various active tab types, which requires additional test cases for coverage. Suggested test cases:
Generated by QA Gap Check (GPT-4o-mini via GitHub Models) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ CI / Integration Tests (with overrides) — run summaryDuration: 1m 5s QA TC IDs: 2 exercised across 0 features Report: View run & artifacts Reproduce locally: Feature breakdown
|
|
Warning Review limit reached
More reviews will be available in 33 minutes and 2 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ CI / Integration Tests (automated) — run summaryDuration: 11m 20s QA TC IDs: 163 exercised across 0 features Report: View run & artifacts Reproduce locally: Feature breakdown
|
✅ CI / Integration Tests (with extensions) — run summaryDuration: 12m 57s Unit tests: Ran in separate Test & Validate job QA TC IDs: 195 exercised across 0 features Report: View run & artifacts Reproduce locally: Feature breakdown
|
Summary
R-F (
Cmd+R Cmd+F/Ctrl+R Ctrl+F, "paste current file path") showedNo active file. Open a file and try again.whenever the active tab was an image, notebook, or diff view, because the paster only consultedvscode.window.activeTextEditor. The paster now resolves the URI from the active tab's input, covering every tab kind that maps to a file.Changes
VscodeAdapter.getActiveTabUri(): resolves a file URI from any tab input by checkinginput.uri ?? input.modified, with avscode.Uriduck-type guard. Works for text editors, custom editors (images), notebooks, and diff views (returns.modified). Future VS Code tab types with a file URI work automatically.VscodeAdapter.getActiveTabViewColumn()so self-paste detection still works when the active tab is non-text.FilePathPaster.pasteCurrentFilePathto the new tab-based adapter methods.LinkGeneratorandgetEligibleFileskeepgetActiveTextEditorUri; they need real text-editor geometry.fileHelpers.ts. Every file-creation helper (createFileAt,createWorkspaceFile,createPngFixture) auto-registers for teardown.trackFileUriremoved from theSsContextinterface.filePicker.test.tssubdirectory file creation to usecreateFileAt(which now supports subdirectory paths viaensureParentDir), dropping manualfs.mkdirSync/fs.writeFileSync/ss.trackFileUriboilerplate.Test Plan
send-file-path-017(image preview / custom editor) andsend-file-path-018(text diff / asserts modified side is used): both passingRelated