Conversation
- New reasonix.addToChat command inserts workspace-relative @ mentions at the composer caret from explorer/editor context menus and Ctrl+L (Cmd+L on mac). - Webview accepts drag-and-drop of files/folders via VS Code synthesized text/uri-list and forwards them to the host (images become attachments). - insertAtCursor/insertApplied ack flow survives a not-yet-ready webview. - Workspace root (@./) mentions supported in resourceMentions. - package.json: drop redundant activationEvents, add view icon, register new menus and keybindings.
…te uris - VS Code synthesizes webview drops under the "resourceurls" / "codeeditors" DataTransfer types (not text/uri-list); parse both line-based and JSON payload formats. - Accept vscode-remote: URIs in fileDrop and addToChat for remote workspaces. - Composer hint mentions Shift+drag (VS Code 1.91+ requires holding Shift while dragging into webviews). - Tests for fileDrop and insertApplied message parsing.
… and VSIX - README (EN/ZH): new top section covering the Add to Chat command, Ctrl+L keybinding, Shift+drag drop, VSIX install steps, and the upstream-rebase update workflow. - update-reasonix-fork.ps1: one-click rebase+test+package script, works both from the repo root and from a sibling directory. - dist/reasonix-vscode.vsix: prebuilt package versioned 99.0.0 so Marketplace auto-updates never overwrite this build. - .gitignore: keep the VSIX/extension.js artifacts tracked, still ignore compiled test output.
- mentionTokenForPath moves to resourceMentions and encodes only whitespace, quotes, brackets, and "%" (byte-level percent encoding); CJK and other non-ASCII characters now display as-is in the composer instead of raw %E6%98%8E... sequences. - encodeURIComponent is not used for single chars: it leaves URI reserved characters like ' and ) unencoded even though they terminate the mention token grammar. - Tests cover readable CJK paths, token-breaking encoding, and a full round-trip (token -> resolveFileMentions -> original path/content).
Compiled extension.js/map change on every build and dirty the working tree, blocking the update script's rebase. Only the packaged VSIX is kept tracked for installation.
…poser - Explorer right-click, Ctrl+L, and drag & drop no longer insert raw @token text into the input; they add a mention chip to the attachment tray showing only the file name (and line range for selections). The full path and selected code stay in the chip tooltip and are attached to the outgoing prompt automatically. - New "mention" attachment kind: files/directories expand through the existing @ mention resolver, selections are sent as dedicated resource blocks, external files and images keep the legacy attachment path. - mentionsPicked/mentionsApplied ack flow replaces insertAtCursor (no more duplicate inserts); debounced flush retries when the webview becomes ready. - Chips can be removed with the × button or by focusing a chip and pressing Delete/Backspace; directory chips show a folder icon and a trailing slash name. - @ token parser now accepts quoted paths (@"a b.txt") so the resolver handles spaces/quotes without percent-encoding; percent encoding remains only a fallback.
…op point - The composer is now a contenteditable editor (Copilot-style) instead of a textarea: mention/attachment chips render inline in the text flow. - Ctrl+L / right-click additions insert the chip at the composer caret; drag & drop inserts the chip at the mouse drop position (caretRangeFromPoint), falling back to the caret when dropping outside the composer. - Chips are atomic (contenteditable=false): Backspace/Delete removes a whole chip, and the attachment order follows the text flow via DOM sync. - fileDrop now carries the drop offset through the host to mentionsPicked so the insertion point survives the round trip; offset is validated in the protocol parser. - The attachment tray is removed; all chips live inside the composer. - Composer hint updated: drag files in, then hold Shift to drop (VS Code 1.91+ webview requirement). - CSS: #prompt contenteditable + placeholder + .mention-chip styles replace the textarea rules.
…line - Reasoning (thought) blocks are now open by default with a ~15-line internally scrollable body; open state and scroll position survive streaming transcript patches. - Usage blocks collapse into a single narrow line showing total tokens and the cost converted from USD to CNY using the new reasonix.cnyPerUsd setting (default 7.2); the detailed grid and cache diagnostics expand on click. - cnyPerUsd is delivered through the chat snapshot so setting changes refresh the displayed costs automatically.
- Reasoning bodies follow the stream by default: when the body is at the bottom (or was just created) each streaming patch keeps it pinned to the newest content. - Scrolling up detaches the follow; scrolling back to the bottom re-attaches it on the next patch. Once streaming ends the scrollbar moves freely. - Height stays adaptive: it grows with the content and caps at ~15 lines with internal scrolling.
- On activation the extension fetches the USD→CNY rate from the free open.er-api.com endpoint (8s timeout, no key required) and stores it in globalState with the local date; subsequent startups on the same day reuse the cached rate without a new request. - The refreshed rate feeds the usage cost line automatically; failures log to the output channel and fall back to reasonix.cnyPerUsd. - New reasonix.cnyPerUsdAuto setting (default true) disables the network refresh when turned off. Tests never perform network requests.
- insertPromptFragments: after range.deleteContents() the original start container can be removed from the document (e.g. selecting all text and pressing Ctrl+L), which made the following insertNode throw. Reuse the collapsed range as the cursor instead. - Mention queue: successive queueMentions calls overwrote the previous unacknowledged batch, so rapid Ctrl+L/drag additions could drop chips. The queue is now an array flushed together (debounced) with per-batch acknowledgements, plus timer cleanup on dispose.
|
hi, since this repository doesn't seem to be maintained, can you reproduce the issue #17? if you can and consider to fix it, you could publish your forked extension while this one is not updated |
SivanCola
left a comment
There was a problem hiding this comment.
Thanks for this, and sorry for the wait — there's a lot in the branch and reviewing it properly took some time.
Short version: the core feature is something I want in the extension, and the mention/protocol layer is well built. But I can't merge the branch as it stands: it carries fork-specific artifacts that shouldn't exist upstream, one product decision that needs its own discussion, and two defects I found while reading. I'd like to take it in pieces.
Verified locally on 7d8eae1: npm run lint and npm test both pass (80 tests), and it merges cleanly onto current main — the "conflicting" state GitHub shows is stale.
What I want to keep
reasonix.addToChatwith the explorer/editor context menus andCtrl+L, plus drag & drop. This fits the product and the three entry points converging on one mention model is the right shape.- The
fileDropvalidation inwebviewProtocol.ts— scheme allowlist, URI count and length caps, offset bounds. Exactly the right level of paranoia for a message crossing the webview boundary. - The acknowledged
mentionsPicked/mentionsAppliedqueue with debounce and retry onstateSnapshot, so chips queued before the webview is ready aren't lost. - The quoted
@mention grammar inresourceMentions.ts. This is my favourite part of the PR: keeping CJK paths readable instead of%E6%98%8E…, the comment explaining whyencodeURIComponentisn't sufficient (it leaves'and)unencoded, and those still break the token grammar), and the round-trip tests.
Two defects
1. media/styles.css line 1395 — the bytes are E2 80 3F. The third byte of › (U+203A = E2 80 BA) was overwritten with ?:
content: "<invalid>;
That is invalid UTF-8, and it leaves the CSS string unterminated, so the whole content declaration is dropped and the composer's chevron disappears. Looks like a cp936 round-trip somewhere in the Windows packaging flow — worth checking whether anything else in the branch took the same damage.
2. syncAttachmentsFromDom() in src/webview.ts — the early-return guard is a tautology:
const indexes = chips.map((chip) => Number(chip.dataset.attachmentIndex)).filter(...);
if (indexes.length === chips.length && indexes.every((index, i) => chips[i].dataset.attachmentIndex === String(index))) {
return;
}indexes[i] is read from chips[i].dataset.attachmentIndex, so the comparison holds whenever every chip index is still in range — the function is a no-op in the normal case. Add chips A(0) and B(1), then delete A: chips = [B(dataset=1)], indexes = [1], lengths match, every passes, early return, and pendingAttachments stays [A, B]. The file the user removed is still sent with the next prompt, and the "attachment order follows the text flow" behaviour doesn't hold either. I think the check wants indexes.every((index, i) => index === i).
What can't go upstream
dist/reasonix-vscode.vsixtracked in git (125 KB binary) and the.gitignoreun-ignore that keeps it there.update-reasonix-fork.ps1— hardcodedD:\Geeksoft\Node.jsand the 99.0.0 version trick. Perfectly sensible in your fork, not something this repo can carry.- The "Custom build" sections in
README.mdandREADME.zh-CN.mdtelling readers to install the fork's VSIX. Same reason.
Needs a separate decision
The USD→CNY conversion, the reasonix.cnyPerUsd / reasonix.cnyPerUsdAuto settings, and the daily open.er-api.com fetch on activation. That adds an outbound network call to the extension and makes RMB the default cost display for every user. I'm not saying no, but it's a privacy and product decision that shouldn't ride along with a composer feature.
The contenteditable rewrite
This is the part I'm most hesitant about. It replaces a working <textarea> with ~200 lines of hand-written offset↔DOM position mapping, and IME composition, undo/redo, paste and multi-line editing are all in the blast radius. webview.ts can't be unit tested (it calls acquireVsCodeApi() at module scope), so CI covers none of it. I'd want this on its own branch with a manual QA pass before it goes in.
Suggested split
resourceMentionsquoted token grammar + tests — independent, self-tested, lowest risk. I'd merge this first.addToChat+ menus +Ctrl+L, with chips rendered in the existing attachment tray. Keeps the feature, avoids the rewrite.- Drag & drop + the
fileDropprotocol. - The contenteditable composer, separately.
- Usage card collapse — happy to discuss, but separately from the CNY conversion.
- Dropped: the VSIX, the ps1 script, the README fork sections, the
.gitignorechange.
Two notes. The reasoning-block commits (01cf997, bf509a3) are already covered — I fixed #17 in #18, including the transcript scroll lock that this branch doesn't touch, and credited you as co-author on the commit since that behaviour is adapted from your work. And CI on this branch currently fails at the npm audit step for reasons unrelated to your changes (new advisories on fast-uri / qs, both via @vscode/vsce); the lockfile fix is in #18, so rebasing once that lands will give you a real CI signal.
Happy to review each piece as it comes.
摘要(中文):核心功能(Add to Chat / Ctrl+L / 拖放)我是想要的,mention 与协议层写得也扎实——fileDrop 的入参校验、带 ack 的重发队列、以及 resourceMentions 里保持中文路径可读的引号 token 语法(含 round-trip 测试)都很好。但整个分支没法直接合:一是夹带了 fork 专属产物(tracked VSIX、update-reasonix-fork.ps1、README 的 Custom build 章节、.gitignore 反选);二是人民币换算 + 启动时请求汇率 API 属于需要单独讨论的产品/隐私决策;三是有两个实际缺陷(styles.css:1395 的 › 第三字节被 ? 覆盖,导致 CSS 字符串未闭合、声明被丢弃;syncAttachmentsFromDom() 的早退判断恒真,删掉 chip 后附件仍会被发送);四是 contenteditable 重写风险集中且 CI 完全覆盖不到,建议单独提。建议按上面 1–6 的顺序拆分,第 1 项可以先合。思考块那两个 commit 已在 #18 中处理,并已把你署为 co-author。
Reasonix for VS Code brings the local Reasonix coding agent into the editor. It implements the ACP v1 client surface used by Reasonix 1.0 (
main-v2) and keeps the extension focused on IDE integration: chat, native sessions, editor resources, tool review, approvals and questions, terminals, models, modes, and plans.This repository is the standalone VS Code extension package. It does not include the Reasonix CLI or upstream Reasonix source code.
The extension does not bundle a Reasonix binary. It uses
reasonix.binaryPathwhen configured, then falls back to resolvingreasonixfromPATH.Custom build: Add to Chat, Ctrl+L, and drag & drop
This fork adds three composer conveniences on top of the upstream extension:
@mention at the composer caret. Selected code in the editor is inserted together with its file reference.Cmd+Lon macOS) with text selected does the same from the keyboard.Shiftwhile dragging (a VS Code 1.91+ requirement for webviews). Images become attachments.