fix(vscode): allow editor mentions for files outside the working directory - #1836
Conversation
|
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45669b2ea7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const filePath = relativeWorkspacePath(workDirUri, documentUri) ?? documentUri.fsPath; | ||
|
|
||
| if (selection.isEmpty) return `@${relativePath}`; | ||
| if (selection.isEmpty) return `@${filePath}`; |
There was a problem hiding this comment.
Quote editor mentions whose absolute paths contain spaces
When an outside file is under a directory containing spaces, this produces text such as @/tmp/Other Root/App.java, so the whitespace separates the mention instead of identifying the complete path. The CLI/TUI convention explicitly emits @"..." when a path contains spaces (apps/kimi-code/src/tui/components/editor/file-mention-provider.ts:417-420, also packages/pi-tui/src/autocomplete.ts:107-120); apply the same quoting here, placing any line-range suffix after the closing quote.
Useful? React with 👍 / 👎.
|
Addressed the spaced-path mention review in 6d30f85: mentions whose path contains a space are now emitted as @"..." with any line range after the closing quote, matching the CLI/TUI convention in pi-tui's autocomplete. Added tests for a spaced absolute path and a quoted relative path with a line range. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…ctory (MoonshotAI#1836) * fix(vscode): allow editor mentions for files outside the working directory * fix(vscode): quote editor mentions whose paths contain spaces
…ctory (MoonshotAI#1836) * fix(vscode): allow editor mentions for files outside the working directory * fix(vscode): quote editor mentions whose paths contain spaces
Related Issue
No linked issue — this comes from a user report; the problem is explained below.
Problem
In a multi-root workspace, the session working directory is the first workspace folder. Using Kimi Code: Insert Current File (Alt+K) on any file from another root always fails with "The active file is outside the selected working directory." Configuring
workspace.additional_dirin.kimi-code/local.tomlmakes the session able to read/write those files, but the mention still refuses, because the extension gated mentions on the session working directory only and never consulted the session's additionalDirs. The same false rejection happened for any file outside a custom selected working directory, even inside a single-root workspace. The CLI/TUI has no such gate:@completion covers the working directory plus additionalDirs, and any typed@pathis passed through with readability decided by the session's tool layer.What changed
No changeset: the VS Code extension is a private package released manually via
chore(vscode): releasecommits, and no extension change has ever carried a changeset in this repo.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.