Skip to content

Feature/composer additions - #16

Open
VaterVato wants to merge 18 commits into
SivanCola:mainfrom
VaterVato:feature/composer-additions
Open

Feature/composer additions#16
VaterVato wants to merge 18 commits into
SivanCola:mainfrom
VaterVato:feature/composer-additions

Conversation

@VaterVato

Copy link
Copy Markdown

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.binaryPath when configured, then falls back to resolving reasonix from PATH.

Custom build: Add to Chat, Ctrl+L, and drag & drop

This fork adds three composer conveniences on top of the upstream extension:

  • Right-click → "Reasonix: Add to Chat" on a file/folder in the Explorer (or in the editor) inserts a workspace-relative @ mention at the composer caret. Selected code in the editor is inserted together with its file reference.
  • Ctrl+L (Cmd+L on macOS) with text selected does the same from the keyboard.
  • Drag & drop files or folders from the Explorer into the chat input. Hold Shift while dragging (a VS Code 1.91+ requirement for webviews). Images become attachments.

reasonix-custom added 18 commits August 13, 2026 19:59
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant