Skip to content

refactor: improve Monaco language definitions#1832

Merged
pedrolamas merged 19 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/monarch-tokenizer
May 9, 2026
Merged

refactor: improve Monaco language definitions#1832
pedrolamas merged 19 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/monarch-tokenizer

Conversation

@pedrolamas
Copy link
Copy Markdown
Member

Improves the Gcode, Klipper config, and Moonraker config monarch language definitions, also adds behavior confirmation tests.

Updates the Monaco themes to match the new definitions.

Updates the Monaco folding provider to match the new definitions.

pedrolamas added 14 commits May 7, 2026 17:47
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas pedrolamas added this to the 1.37 milestone May 8, 2026
@pedrolamas pedrolamas requested a review from Copilot May 8, 2026 23:17
@pedrolamas pedrolamas added the FR - Enhancement New feature or request label May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Monaco Monarch language definitions for G-code, Klipper config, and Moonraker config, aligning folding + theming with the new token scopes and adding unit tests to pin tokenizer behavior.

Changes:

  • Refined Monarch tokenization rules for gcode, klipper-config, and moonraker-config (including new token categories used by themes).
  • Updated folding-range worker logic for region markers, comments, and SAVE_CONFIG handling.
  • Added Vitest tokenizer tests (plus jsdom polyfills) and updated documentation to reflect the new highlighting behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/setup.ts Adds jsdom polyfills required for loading Monaco in unit tests.
src/workers/monacoFoldingRangesWorker.ts Updates folding detection regexes to better match the new language definitions (regions/comments/SAVE_CONFIG).
src/monaco/language/gcode.monarch.ts Reworks G-code tokenization to use new command/param/macro/message token scopes.
src/monaco/language/klipper-config.monarch.ts Refactors config tokenization state flow (initial vs in-section) and SAVE_CONFIG token handling.
src/monaco/language/moonraker-config.monarch.ts Refactors config tokenization state flow (initial vs in-section) to match Moonraker parsing behavior.
src/monaco/language/tests/tokenize-helper.ts Adds shared helpers for registering languages and asserting token streams.
src/monaco/language/tests/gcode.monarch.spec.ts Adds behavior-confirmation tests for the new G-code tokenizer.
src/monaco/language/tests/klipper-config.monarch.spec.ts Adds behavior-confirmation tests for the Klipper config tokenizer.
src/monaco/language/tests/moonraker-config.monarch.spec.ts Adds behavior-confirmation tests for the Moonraker config tokenizer.
src/components/widgets/filesystem/setupMonaco.ts Extends Monaco theme rules to style the new token scopes.
public/editor.theme.json Removes the previously committed theme JSON asset.
docs/docs/features/file-editor.md Updates user-facing docs to reflect the new highlighted elements.
CLAUDE.md Documents the new tokenizer test location/helpers and the Monaco jsdom polyfills.

Comment thread src/components/widgets/filesystem/setupMonaco.ts
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread src/monaco/language/klipper-config.monarch.ts
Comment thread src/monaco/language/moonraker-config.monarch.ts
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/monaco/language/__tests__/tokenize-helper.ts Outdated
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread docs/docs/features/file-editor.md Outdated
pedrolamas added 2 commits May 9, 2026 12:25
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@pedrolamas pedrolamas merged commit eab2bbf into fluidd-core:develop May 9, 2026
10 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/monarch-tokenizer branch May 9, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FR - Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants