Skip to content

feat(modes): let plugin modes reuse another mode's formatter - #2976

Merged
bajrangCoder merged 3 commits into
mainfrom
feat/mode-format-as
Oct 18, 2026
Merged

bajrangCoder merged 3 commits into
mainfrom
feat/mode-format-as

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member
  • Plugin modes can pass formatAs to editorLanguages.register to use an existing mode's formatter and Prettier parser, e.g. json-bedrock formats as json (formatting part of Formatting (prettier) API #2972).
  • editorLanguages.register now forwards its options argument (aliases, filenameMatchers, formatAs) to the mode.
  • Formatter settings show the inherited formatter for such modes, e.g. "Prettier (JSON)", and list the base mode's formatters in the picker.

Add a formatAs option to editorLanguages.register so a plugin mode
(e.g. json-bedrock) formats with the formatter and Prettier parser of an
existing mode (e.g. json) when the user hasn't picked one for it.

editorLanguages.register now forwards its options to addMode, and Mode
ignores malformed options instead of throwing.
@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous stale-label issue is fixed.

Summary

Plugin modes can use formatAs to reuse another mode's formatter and Prettier parser.

  • Plugin modes can reuse another mode’s formatter and Prettier parser.
  • Formatter settings show the formatter inherited by plugin modes.

No new actionable issues were found.

Reviews (3) · Last reviewed commit: "fix(settings): refresh inherited formatt..." · Reviewed by Greptile

Comment thread src/lib/acode.js Outdated
Comment thread src/settings/formatterSettings.js
Resolve formatAs through the mode list so an alias (e.g. json5) finds
the base mode's saved formatter and Prettier parser.

For modes with formatAs, the picker's unset option now names the
inherited formatter (e.g. "Prettier (JSON)") instead of "None".
@bajrangCoder

This comment was marked as outdated.

Comment thread src/settings/formatterSettings.js Outdated
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder
bajrangCoder added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 5323b58 Oct 18, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Oct 18, 2026
@bajrangCoder
bajrangCoder deleted the feat/mode-format-as branch October 18, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants