npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

monaco-editor-gdscript

v1.0.1

Published

GDScript (Godot 4.x) language support for Monaco Editor

Readme

monaco-editor-gdscript

GDScript (Godot 4.x) syntax highlighting for the Monaco Editor.

CI npm version license

Why? VSCode has gdscript syntax highlighting.

VScode uses the Monaco Editor internally but utilizes TextMate grammars to provide syntax highlighting whereas the standalone Monaco Editor uses the Monarch tokenizer system.

Installation

npm install monaco-editor-gdscript

This package requires monaco-editor as a peer dependency (>=0.30.0). If you do not already have it installed:

npm install monaco-editor

Usage

Side-effect import

The simplest way to register GDScript is a bare import. When the module loads, it detects the global monaco object and registers the language automatically.

import 'monaco-editor-gdscript';

const editor = monaco.editor.create(document.getElementById('container'), {
    value: 'func _ready():\n\tprint("Hello, Godot!")',
    language: 'gdscript',
});

Note: Auto-registration relies on a global monaco object, which is typically only available when using Monaco's AMD loader or a CDN build. Modern bundlers (webpack, Vite, esbuild) do not create a global monaco, so the side-effect import will silently do nothing. If you use a bundler, use the explicit register() pattern below instead.

Explicit registration

If you need more control over when registration happens, or if monaco is not available as a global, use the named register export and pass your Monaco instance directly.

import { register } from 'monaco-editor-gdscript';
import * as monaco from 'monaco-editor';

register(monaco);

const editor = monaco.editor.create(document.getElementById('container'), {
    value: 'func _ready():\n\tprint("Hello, Godot!")',
    language: 'gdscript',
});

Advanced usage

The underlying Monarch language definition and language configuration objects are also exported for consumers who want to customize or extend them. This is useful if you need to register GDScript under a different language ID, or if you want to extend the tokenizer rules before registering.

import { language, conf } from 'monaco-editor-gdscript';

What's included

  • Syntax highlighting via Monaco's Monarch tokenizer covering all GDScript 4.x syntax
  • Language configuration: bracket matching, auto-closing pairs, comment toggling (#), indentation rules, and folding

Highlighted elements

  • Keywords -- func, var, class, if, for, match, signal, enum, await, etc.
  • Built-in types -- Vector2, String, Array, Dictionary, PackedByteArray, etc.
  • Annotations -- @export, @onready, @tool, etc.
  • Built-in constants -- true, false, null, PI, TAU, INF, NAN
  • Built-in functions -- preload, print, len, range, clamp, lerp, etc.
  • Strings -- single-quoted, double-quoted, triple-quoted multiline, and StringName literals (&"...")
  • Comments (#) and doc comments (##)
  • Numbers -- integers, floats, hex (0xFF), binary (0b1010), with underscore separators
  • Node paths ($Node/Path) and unique nodes (%UniqueNode)
  • self / super -- highlighted as language variables
  • Operators -- ->, :=, and all standard operators

What's NOT included

  • Autocomplete / IntelliSense
  • Go-to-definition / hover info
  • Error checking / diagnostics
  • GDShader support
  • Godot scene file (.tscn) support

The scope of this package is intentionally limited to syntax highlighting and basic editor configuration. It does not provide language-server features or support for file formats other than .gd.

License

MIT

References