Preface¶
When reading long documents or code in DSH, frequently switching windows to copy and paste can disrupt your flow of thought. This plugin provides a way to get translations and in-depth analysis without leaving the current context.
What is this¶
yfwu2020/dsh-selection-explain.
When you select text, a floating button appears; clicking it shows, in a pop-up, a streaming professional Chinese–English translation plus a detailed explanation of what that text means in the current context.
Maintainer: yfwu2020
License: MIT
Core Features¶
- Translation & Contextual Explanation
Select text and click Explain to see the translation first; click “Expand details” to view the context-aware meaning. Supports code comments. - Voice Follow-ups
After selecting text, use your input method’s voice input to auto-finalize and send the question; or tap the microphone in the pop-up for real-time transcription. - Quoting & Attachments
Highlight other content and click “Quote” to add it to the pop-up. Supports dragging in images or files (up to 10 items, 20 MB per item). - Context Management
Long conversations show the most recent 40 messages. Follow-up questions in the pop-up organize the model context by a capacity budget (default 32,768 tokens). - Elevate
Bring the explanation and attachments into the formal conversation.
Installation & Activation¶
Install command:
dsh plugin --profile web add @yfwu2020/dsh-selection-explain
After installation, refresh the DSH page to start using it.
Typical Usage¶
- Basic Explanation: Select a piece of text, click the “Explain” button, and view the translation and detailed explanation.
- Voice Follow-up: Select a sentence, ask by voice, “What does it mean here?”, and the question will automatically appear in the pop-up.
- Quote & Discuss: Highlight new content in the main interface or sidebar, click “Quote,” and continue asking questions with the new material.
- Chart Understanding: Switch the output preference to Web; the model can generate an HTML page to present charts.
Use Cases & Caveats¶
- Use Cases: Code reading, professional document translation, quick context analysis.
- Caveats:
- Input method voice requires macOS 14.4+ and a supported input method (e.g., Doubao).
- The pop-up microphone requires DSH to have a speech recognition service enabled.
- If voice is not configured, text explanations and keyboard-based follow-ups are still available.
- The plugin supports the DSH UI and injectable sidebar HTML previews.
- Input boxes, source code views, external site browser tabs, and some third-party previews do not trigger selection.
- The plugin does not save recordings as audio files, nor attach audio to conversations.
- Follow-up questions in the pop-up organize the model context by a capacity budget, not by fixed slices of the last 20 messages.
Closing¶
By enabling “select-to-explain,” the plugin reduces context-switching costs and suits developers who need quick translation and in-depth analysis in DSH. Source code and documentation are available on GitHub.