Skip to content

dsh-vscode-selection

Verified

dsh-vscode-selection · v0.1.1 · MIT · Web UI

DeepSeek Harness 插件:接收 VS Code 扩展发送的代码选中内容,并插入到对话输入框(适配 dsh 0.2.0-rc.2)。

Install

dsh plugin add dsh-vscode-selection

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Readme

dsh-vscode-selection

A DeepSeek Harness plugin that receives the code selection sent by a VS Code extension and inserts it into the conversation composer as a Markdown code block.

Behaviour

The VS Code extension posts a message to the dsh web page:

window.postMessage({
  type: 'insert-selection',
  filePath: 'src/app.py',
  startLine: 12,
  endLine: 18,
  language: 'python',
  content: '…',
}, '*')

The plugin turns it into:

src/app.py:12-18
```python
…
```

and appends it to the draft of the currently selected session, then reloads the composer so the text is visible before you press Send.

Compatibility

Built for dsh 0.2.0-rc.2. Declared peers: @deepseek-ai/dsh-api-session-controller, @deepseek-ai/dsh-client-ui-session and @deepseek-ai/dsh-client-ui-conversation at ^0.2.0-rc.2.

Version 0.1.0 targeted dsh 0.1.x and is both gate-blocked and non-functional on 0.2.0-rc.2:

  • it declared @deepseek-ai/dsh-client-runtime@^0.1.0-rc, and that package was removed in 0.2.0 (its role split into dsh-client-ui-slots / dsh-client-store). dsh 0.2.0's peerDependency gate silently skips a plugin whose @deepseek-ai/dsh* peer ranges do not satisfy dsh --version.
  • it resolved the current session through ISessions.active() and inserted text by emitting slash/input-insert-text from a ctx.get('input') handle. Both are gone in 0.2.0-rc.2.

0.1.1 is ported to the public 0.2.0-rc.2 surface only:

purpose API used
current session ctx.uiSession.adapter.current.getSnapshot().key, falling back to scanning ctx.sessions.list for a row with retainedBy.mainView > 0 (the same rule ui-session uses)
session context ctx.sessions.scope(sessionId)
composer write ctx.conversation.input.for(actx) → SessionInput.setDraft(...), reading the live draft from SessionInput.state

Because the old caret/draftRev API no longer exists, the insertion point is the end of the draft (with a separating newline when the draft is non-empty) instead of the caret position.

0.1.1 also fixes a bug present since 0.1.0: the Markdown fence was built with '\\n', which inserts a literal backslash-n instead of a line break, so the code block never actually formed.

Install

dsh plugin --profile web add dsh-vscode-selection
# restart dsh web to activate

Structure

lib/index.js      host half — marker row (all logic is browser-side)
lib/client.js     browser half — window message listener + composer write
cordis.patch.yml  dsh.bundle.patch — inserts the vscode-selection row

License

MIT