Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Add programmatic API to fold and unfold all code regions #12

Description

@jpdup

Currently, CodeCrafterController supports code folding through callbacks like setFoldAtCallback, but there is no public API to programmatically trigger folding or unfolding of all foldable regions.

This limitation makes it difficult to:

  • Implement "Collapse All" / "Expand All" buttons in an IDE-style UI.
  • Restore user fold states after reopening a file.
  • Provide shortcuts or automated folding behavior.


Feature Request
Please add public methods (or similar) to CodeCrafterController, e.g.:
dart
controller.collapseAll();
controller.expandAll();
controller.toggleFoldAtLine(int lineIndex);

Or a method such as setFoldStateForAll(bool folded).
These should update internal folding state and call refresh() to re-render.

Motivation / Use Case
I’m building a custom Flutter code editor and need UI buttons or keyboard shortcuts for “Collapse All / Expand All.”

Current Workaround
Limitation: only workaround is to redefine foldAt callback and call controller.refresh(), which isn’t ergonomic for UI actions.


Suggested Implementation
• Add collapseAll()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions