Back to home@lrplrplrp

dsh-sidebar-gdhighlight

godot语法高亮,依赖dsh-better-sidebar

Stars
0
Language
TypeScript
Created
Aug 30, 2026
Updated
Aug 30, 2026
GitHub repo

Introduction

dsh-sidebar-gdhighlight

简体中文 | English

DSH plugin: GDScript & GDShader syntax highlighting for dsh-better-sidebar, using Godot 4.7 editor colors.

npm version License: MIT

✨ Features

  • GDScript 4.x full syntax highlighting (.gd files)
  • GDShader shader syntax highlighting (.gdshader / .shader files)
  • Godot 4.7 editor colors — colors extracted from editor_settings-4.7.tres
  • CodeMirror 6 integration with dsh-better-sidebar
  • Support for all GDScript keywords, control flow, types, built-in functions, and annotations
  • Function definition highlighting (func name() uses a dedicated definition color)
  • Multi-line strings ("""), string interpolation ($""), node paths ($Node, %Unique), string names (&"Name")
  • GDShader uniform/varying, built-in variables (ALBEDO, VERTEX, etc.), GLSL math functions

🎨 Godot Color Mapping

This plugin uses your actual Godot editor color scheme:

ElementGodot Setting KeySample Color
Keywordskeyword_color#FF7084
Control flowcontrol_flow_keyword_color#FF8CCC
Base typesbase_type_color#42FFC2
Engine typesengine_type_color#8FFFDB
Commentscomment_colorSemi-transparent white
Doc commentsdoc_comment_colorBlue-gray
Stringsstring_color#FFED9E
String placeholdersstring_placeholder_color#FFBF66
Numbersnumber_color#A0FFE0
Function callsfunction_color#57B3FF
Function definitionsfunction_definition_color#66E6FF
Global functionsglobal_function_color#A3A3F5
Member variablesmember_variable_color#BDE1FF
Annotationsannotation_color#FFB373
Node pathsnode_path_color#B8C47D
Node referencesnode_reference_color#63C25A

🚀 Installation

Prerequisites

Install

dsh plugin --profile web add dsh-sidebar-gdhighlight@latest

After installation, hard refresh your browser (Cmd/Ctrl+Shift+R).

Manual Installation

  1. Clone the repository:
git clone https://github.com/lrplrplrp/dsh-sidebar-gdhighlight.git
cd dsh-sidebar-gdhighlight
pnpm install
pnpm build
  1. Link to your DSH profile:
# Add to ~/.dsh/profiles/web/package.json dependencies:
# "dsh-sidebar-gdhighlight": "link:/path/to/dsh-sidebar-gdhighlight"

cd ~/.dsh/profiles/web
pnpm install
  1. Add to ~/.dsh/profiles/web/cordis.patch.yml:
- insert:
    - id: gdscript-highlight
      name: 'dsh-sidebar-gdhighlight'
  1. Hard refresh browser (Cmd/Ctrl+Shift+R).

🔧 Development

# Install dependencies
pnpm install

# Build
pnpm build

# Watch mode
pnpm watch

📝 Supported Syntax

GDScript (.gd)

ElementExamples
Keywordsfunc, class, extends, var, const, signal, enum, preload, load
Control flowif, elif, else, for, while, match, return, break, continue, pass
Base typesint, float, String, bool, Array, Dictionary, Vector2/3/4, Color, NodePath
Engine typesNode, Sprite2D, Button, Camera3D, AnimationPlayer, HTTPRequest, ...
Built-insprint, str, range, load, preload, get_tree, get_node, typeof, lerp, clamp
Annotations@export, @onready, @tool, @icon, @warning_ignore
CommentsSingle-line #, Multi-line #"""..."""#
Strings"...", '...', $"...", """...""", &"StringName"
Node paths$Node/Path, %UniqueNode
Numbers123, 0.5, 0xFF, 0b1010, 0o77

GDShader (.gdshader / .shader)

ElementExamples
Keywordsshader_type, render_mode, uniform, varying, const, in, out
Control flowif, else, for, while, switch, return, discard
Typesfloat, int, vec2/3/4, mat2/3/4, sampler2D, bool
Built-in varsVERTEX, ALBEDO, UV, COLOR, NORMAL, EMISSION, DIFFUSE_LIGHT, ...
Built-in funcssin, cos, texture, normalize, dot, cross, mix, smoothstep, ...
CommentsSingle-line //, Block /* ... */

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Related

🙏 Acknowledgments

  • Thanks to the dsh-better-sidebar team for the excellent plugin architecture
  • Thanks to the Godot Engine team for creating GDScript and Godot Shading Language
  • Thanks to the CodeMirror team for the code editor framework