DSH emphasizes a plugin-based architecture. When the sidebar plugin dsh-better-sidebar processes code, the lack of syntax highlighting can significantly reduce readability. dsh-sidebar-gdhighlight is designed to address this issue by providing native highlighting support to dsh-better-sidebar, allowing developers to view and edit Godot code directly in the sidebar.
Core Features¶
This plugin is built on CodeMirror 6 and extracts the color configuration from the Godot 4.7 editor.
- GDScript 4.x Highlighting: Provides complete syntax highlighting for
.gdand.incfiles. - GDShader Highlighting: Provides shader syntax highlighting for
.gdshaderand.shaderfiles. - Godot 4.7 Color Scheme: Colors are taken directly from
editor_settings-4.7.tres, ensuring visual consistency. - Comprehensive Syntax Support: Covers all GDScript keywords, control flow, types, built-in functions, and annotations.
- Definition and Element Highlighting: Dedicated styles for function definitions, variables, signals, and enums.
- Complex Syntax Support: Supports multi-line strings, string interpolation (
$""), node paths ($Node), and string names (&"Name"). - Interactive Features: After selecting text, a floating button can insert the code snippet into the conversation as a fenced code block.
Installation and Enablement¶
Use the official command to install it. Before installation, ensure that DSH (dsh web) is running and dsh-better-sidebar is installed.
- Run the installation command:
dsh plugin --profile web add dsh-sidebar-gdhighlight@latest
- Apply the configuration: After installation, perform a hard refresh in the browser (Cmd/Ctrl+Shift+R) to load the new plugin.
Typical Usage¶
- View Code: Open a
.gdor.incfile in the sidebar to view syntax highlighting with the Godot 4.7 color scheme. - Edit Shaders: Open a
.gdshaderor.shaderfile in the sidebar to edit shader code. - Share Code: Select a code fragment in the sidebar, click the floating button that appears, and insert the selected content as a fenced code block into the conversation interface.
Use Cases and Notes¶
- Dependencies: This plugin depends on
dsh-better-sidebar, which must be installed first for it to work correctly. - Runtime Environment: The DSH environment must be running.
- Browser Refresh: A hard refresh is required after installation; otherwise, highlighting may not take effect.
Summary¶
dsh-sidebar-gdhighlight addresses readability issues when reading and editing Godot code in the DSH sidebar by integrating CodeMirror 6 and reusing the Godot 4.7 editor color scheme.
- GitHub Repository: https://github.com/lrplrplrp/dsh-sidebar-gdhighlight
- Plugin Directory: https://www.skillhub.cn/plugins/lrplrplrp/dsh-sidebar-gdhighlight