Skip to content

add: formatCode cmd back in codemirror 6#2063

Merged
UnschooledGamer merged 1 commit intoAcode-Foundation:mainfrom
UnschooledGamer:add/formatcode-cmd
Apr 27, 2026
Merged

add: formatCode cmd back in codemirror 6#2063
UnschooledGamer merged 1 commit intoAcode-Foundation:mainfrom
UnschooledGamer:add/formatcode-cmd

Conversation

@UnschooledGamer
Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added the enhancement New feature or request label Apr 27, 2026
@UnschooledGamer UnschooledGamer added the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Apr 27, 2026
@github-actions github-actions Bot removed the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Apr 27, 2026
@github-actions

This comment has been minimized.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR restores the formatCode keyboard command (Ctrl-Alt-F) that was lost during the migration to CodeMirror 6. The addition hooks into the existing acode.exec("format") action path — the same path used by the file menu and saveFile.js — so no other files need to change.

Confidence Score: 5/5

Safe to merge — single-entry addition with no logic changes and confirmed integration with existing action dispatch.

The change is a one-entry addition to a config array. The action: "format" string is validated by existing callers in saveFile.js and file-menu.hbs, readOnly: false correctly guards against mutations on read-only files, and editorOnly: true matches comparable commands. No new code paths, no security surface.

No files require special attention.

Important Files Changed

Filename Overview
src/lib/keyBindings.js Adds formatCode binding (Ctrl-Alt-F, action: "format") to APP_BINDING_CONFIG; action string is confirmed valid, readOnly/editorOnly flags are semantically correct, and no key conflicts were found.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["User presses Ctrl-Alt-F"] --> B["CodeMirror keymap intercepts"]
    B --> C["executeCommand('formatCode', view)"]
    C --> D{"commandRunsInReadOnly?"}
    D -- "readOnly:false → blocked when view is read-only" --> E["return false (no-op)"]
    D -- "editor is writable" --> F["command.run(view)"]
    F --> G["acode.exec('format')"]
    G --> H["Format handler runs"]
Loading

Reviews (1): Last reviewed commit: "add: formatCode cmd back in codemirror 6" | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown

Preview Release for this, has been built.

Click here to view that github actions build

@UnschooledGamer UnschooledGamer merged commit 9051211 into Acode-Foundation:main Apr 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant