Skip to content

feat: Load command shortcuts from project settings (minecraft-debugger.json) - #407

Open
Fabrimat wants to merge 2 commits into
Mojang:mainfrom
Fabrimat:feat/project-settings
Open

Fabrimat wants to merge 2 commits into
Mojang:mainfrom
Fabrimat:feat/project-settings

Conversation

@Fabrimat

@Fabrimat Fabrimat commented Oct 1, 2026

Copy link
Copy Markdown

I've added the possibility of creating a minecraft-debugger.json containing per-project command shortcuts. The same file could be used for something else in the future.
It also allows to load mcfunctions, where every command get loaded separately.

image

Github Copilot summary if useful:

This pull request introduces support for project-specific Minecraft command shortcuts by allowing projects to define shortcuts in a minecraft-debugger.json file. These shortcuts are displayed in the extension's UI, can be loaded from additional files, and are only enabled in trusted workspaces. The changes include backend logic for loading and watching these files, frontend updates to display project shortcuts, schema validation, and tests for the new functionality.

Project command shortcuts support:

  • Added support for defining command shortcuts in a minecraft-debugger.json file at the workspace root; these can be simple strings or objects with command and optional label fields. Additional shortcuts can be loaded from other files via the commandShortcutFiles property, supporting both JSON and line-based formats. Only loaded in trusted workspaces. (README.md, src/project-settings.ts, schemas/minecraft-debugger.schema.json, [1] [2] [3]
  • Implemented a ProjectSettingsLoader class to watch for changes to project settings and shortcut files, parse their contents, and emit updates. (src/project-settings.ts, src/project-settings.tsR1-R164)
  • Updated the extension activation and home panel logic to load, watch, and send project command shortcuts to the webview UI. (src/extension.ts, src/panels/home-view-provider.ts, [1] [2] [3] [4]

Frontend integration:

  • Modified the webview UI to receive and display project command shortcuts in a dedicated section above user-defined shortcuts, including support for labels and the "Run" button. (webview-ui/src/home_panel/App.tsx, webview-ui/src/home_panel/controls/CommandSection.tsx, [1] [2] [3] [4] [5] [6] [7]

Validation and workspace trust:

  • Registered a JSON schema for minecraft-debugger.json to provide validation in editors, and declared that project settings are only loaded in trusted workspaces via the extension manifest. (schemas/minecraft-debugger.schema.json, package.json, [1] [2]

Testing:

  • Added unit tests for parsing of project settings, shortcut files, and command text to ensure robustness of the new features. (src/project-settings.test.ts, src/project-settings.test.tsR1-R74)

Projects can now ship a minecraft-debugger.json at the workspace root.
The first supported setting is commandShortcuts, which are shown in the
home panel above the user's own command shortcuts. The file is watched
for changes and is only loaded in trusted workspaces.
minecraft-debugger.json can now list paths or globs in commandShortcutFiles.
JSON files use the same shortcut format and other files are read as one
command per line, skipping blank lines and # comments. Referenced files
are watched and reloads no longer race each other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant