The sidebar file preview feature in DSH provides basic rendering capabilities. The dsh-sidebar-plus plugin extends this foundation by adding six specific capabilities to file preview: source editing, editing and saving, line numbers, global search, font-size adjustment, and a comparison-view toolbar. These features are designed to streamline the workflow for quickly viewing and fine-tuning text content locally.
Plugin Overview¶
- Name: dsh-sidebar-plus
- Maintainer: sailoumili
- License: MIT
- Core value: Adds six features to the DSH sidebar file preview: source editing, editing and saving, line numbers, search, font-size adjustment, and comparison view.
Core Features¶
Source Editing View¶
Applies only to .md / .markdown files. In the upper-right corner of the sidebar file preview, click “Open As” and choose “Source Edit”. This view supports Markdown syntax highlighting and includes line numbers.
Editing and Saving¶
- Editing: For Markdown files, clicking the “Edit” button switches to the “Source Edit” view; for other text formats (such as JSON, YAML, TXT, etc.), clicking “Edit” allows you to modify the content directly in the current view.
- Saving: Press
Ctrl+Sor click the “Save” button to leave edit mode. The plugin supports automatic backups of previous versions. If the file has been modified elsewhere, you will be prompted to choose “Force Save” or “Reload Latest”. - Limitation: The plugin does not handle binary formats (Office documents, PDFs, images, etc.) to avoid corrupting the original files.
Line Numbers and Search¶
- Line numbers: A line-number display toggle has been added to the official “Plain Text” view. It is disabled by default and can be turned on or off from the toolbar at any time.
- Search and font size: Search (with
Ctrl+Fsupport) and font-size adjustment have been added to all views. You can adjust the font size using theA−/A+buttons on the toolbar, or by holdingCtrland scrolling the mouse wheel.
Comparison View Toolbar¶
The official “Current Changes” side-by-side comparison page (Comparison View) has been enhanced with a toolbar, supporting:
- Search: Supports searching both sides or a single side; the search line can be scoped to a specific range.
- Font size: Adjusts the font size on both sides synchronously.
- Edit right side: Only the content on the right can be edited; the left side serves as the starting snapshot.
Backup Settings¶
A new “⋯” button has been added at the end of the toolbar. Clicking it opens the settings panel. You can customize the backup folder path. The default is ~/.dsh/sidebar-plus-backups. When the path is changed, existing backup files in the old path are moved to the new path automatically.
Installation and Activation¶
The plugin is published on npm.
Web Installation:
Run the following command in a DSH terminal:
dsh plugin --profile web add dsh-sidebar-plus
Desktop Installation:
Use the DSH interface:
1. Open “Settings” -> “Plugins”.
2. Click “Add Plugin”.
3. In “Package Name or URL”, enter dsh-sidebar-plus.
4. After installation, restart once as prompted by the interface.
Notes¶
- Version requirement: DSH version
0.1.7or later is required. - Operation: The plugin runs locally only and makes no external network requests.
- Hot-swapping mechanism: Changes to
hot-*.cjsfiles take effect automatically in about 2 seconds; changing the loader itself requires restarting DSH.