Skip to content

feat: improved config file handling in monaco#1827

Merged
pedrolamas merged 6 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/monaco-improvements
May 1, 2026
Merged

feat: improved config file handling in monaco#1827
pedrolamas merged 6 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/monaco-improvements

Conversation

@pedrolamas

Copy link
Copy Markdown
Member

Improves the monaco editor light and dark themes, the monarch language definition for Klipper and Moonraker config files, removes obsolete textmate related files.

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas pedrolamas added this to the 1.37 milestone May 1, 2026
@pedrolamas pedrolamas requested a review from Copilot May 1, 2026 12:09
@pedrolamas pedrolamas added the FR - Enhancement New feature or request label May 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates Fluidd’s Monaco integration for Klipper/Moonraker configuration files by switching to dedicated Monarch tokenizers (with parser-aligned comment handling), extending Monaco language workers to support Moonraker configs, and removing obsolete TextMate/theme-conversion assets.

Changes:

  • Add a new moonraker-config Monarch language and refactor the klipper-config Monarch language to better match each parser’s comment rules.
  • Extend folding ranges, document symbols, and code lens workers/providers to handle both klipper-config and moonraker-config.
  • Remove TextMate/theme conversion tooling and generated theme JSONs; define Monaco themes inline.

Reviewed changes

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

Show a summary per file
File Description
tools/convertTheme.mjs Removed the VSCode→TextMate→Monaco theme conversion script.
src/workers/monacoFoldingRangesWorker.ts Improves config folding detection (whitespace-tolerant headers/regions + SAVE_CONFIG folding) and adds Moonraker support.
src/workers/monacoDocumentSymbolsWorker.ts Makes section/property detection whitespace-tolerant and enables Moonraker support.
src/workers/monacoCodeLensWorker.ts Makes section detection whitespace-tolerant and enables Moonraker support.
src/monaco/theme/editor.theme.json Removed generated theme JSON.
src/monaco/theme/editor.light.theme.json Removed generated light theme JSON.
src/monaco/theme/editor.dark.theme.json Removed generated dark theme JSON.
src/monaco/theme/base.theme.light.json Removed base VSCode light theme source JSON.
src/monaco/theme/base.theme.dark.json Removed base VSCode dark theme source JSON.
src/monaco/language/tmLanguage.json Removed TextMate schema JSON.
src/monaco/language/moonraker-config.monarch.ts Adds Monarch tokenizer/config for Moonraker configs.
src/monaco/language/klipper-config.monarch.ts Replaces previous highly-specialized tokenizer with parser-aligned config handling (comments/sections/keys/values).
src/monaco/README.md Removed Monaco TextMate/theme conversion credits doc.
src/components/widgets/filesystem/setupMonaco.ts Registers Moonraker language, registers providers for both config languages, and defines themes inline.
src/components/widgets/filesystem/monacoProviders.ts Passes model language id through to workers so providers work for both config languages.
package.json Removes the theme converter dev dependency.
package-lock.json Removes the theme converter and its transitive deps from the lockfile.

Comment thread package.json
Comment thread src/monaco/language/moonraker-config.monarch.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 16 out of 17 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/workers/monacoDocumentSymbolsWorker.ts:26

  • The updated section regex allows leading whitespace, but state.current.name is set to section[0], which will now include that indentation (e.g. ' [printer]'). This will surface in the document symbol list. Consider capturing just the bracketed header (or trimming leading whitespace) when setting the symbol name.
      const section = /^\s*\[[^\]]+\]/.exec(lineContent)

      if (section) {
        state.result.push(state.current = {
          name: section[0],
          range: {

Comment thread src/components/widgets/filesystem/monacoProviders.ts
pedrolamas added 2 commits May 1, 2026 15:00
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 18 out of 19 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

src/workers/monacoFoldingRangesWorker.ts:224

  • In commentBlocks, blank lines currently don't clear state.current, so comment folding can bridge across empty lines even though the docs describe folding “consecutive comment lines”. Consider setting state.current = undefined when lineContent.length === 0 to ensure blank lines break comment blocks.
      lineContent = lineContent.trim()

      if (lineContent.length > 0) {
        const isComment = /^\s*(?:;|#(?!region\b|endregion\b|\*#))/.test(lineContent)

        if (isComment) {
          if (state.current) {
            state.current.end = index + 1
          } else {
            state.result.push(state.current = {
              kind: 'comment',
              start: index + 1,
              end: index + 1
            })
          }
        } else {
          state.current = undefined
        }
      }

src/workers/monacoDocumentSymbolsWorker.ts:26

  • section now matches leading whitespace, but name: section[0] will include that indentation in the outline (e.g. " [printer]"). Consider trimming the matched header (or building the name from the bracket contents) so document symbol names are stable regardless of indentation.
      const section = /^\s*\[[^\]]+\]/.exec(lineContent)

      if (section) {
        state.result.push(state.current = {
          name: section[0],
          range: {

Comment thread src/workers/monacoFoldingRangesWorker.ts
Comment thread docs/docs/features/file-editor.md Outdated
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 18 out of 19 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/workers/monacoDocumentSymbolsWorker.ts:26

  • The section regex now includes leading whitespace ("^\s*[") and the symbol name uses section[0], so indented section headers will show up in the outline with leading spaces (e.g. " [foo]"). Consider capturing just the bracketed header (or trimming the match) when setting name so symbols render consistently.
      const section = /^\s*\[[^\]]+\]/.exec(lineContent)

      if (section) {
        state.result.push(state.current = {
          name: section[0],
          range: {

@pedrolamas pedrolamas merged commit 68e6a21 into fluidd-core:develop May 1, 2026
8 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/monaco-improvements branch May 1, 2026 15:19
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