✨ Code Folding
@thecoolwinter 已经在做这个了。
开始于 2025年4月25日。
评估
这个 Issue 还没有评估数据。
描述
Description
Code folding allows developers to collapse and expand sections of code (such as functions, classes, conditionals, and comments) to reduce visual clutter and focus on the parts they’re working on. This feature is particularly useful when navigating large files or deeply nested structures.
Proposed Behavior
- Enable folding for code blocks such as:
- Functions and methods
- Classes and structs
- Loops and conditionals
- Multi-line comments and regions
- Display a vertical folding ribbon in the gutter next to line numbers, where users can click to collapse or expand blocks.
- Collapsed blocks should show an inline indicator with an expand toggle.
- Optionally, include editor commands for fold all / unfold all.
Implementation Notes
- Can be powered by the existing Tree-sitter syntax trees to determine foldable ranges based on code structure.
- Should maintain fold state across file/tab switches and ideally across sessions.
- Folding ribbon interactions should be smooth and intuitive, with hover states and visual cues.
- Should add animation for folding and unfolding to make transitions feel natural and responsive.
Benefits
- Reduces visual noise and helps maintain focus while editing.
- Makes it easier to navigate and manage large files.
- Provides a cleaner overview of structural code layout.
Additional Context
The folding ribbon provides a familiar and discoverable UI for interacting with folded sections and complements keyboard or menu-based folding commands.
Screenshots
Additional Screenshots
Hover:

Clicked (folded code):

dark and light mode:

In Progress TODOs
- Fold Ribbon
- Draw nested folds
- Draw adjacent folds with a horizontal line (instead of overlapping rounded edges)
- Draw folded ranges
- Fold Model
- Generate folds from a provider for a document
- Update folds as a document is edited
- Fold Providers
- Line indent provider
- TreeSitter provider
- Perform Folding
- Draw text attachment for fold range
- Animate folded text
- 主要语言
- Swift
- 星标
- 720
- 派生
- 162
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodeEditApp/CodeEditSourceEditor 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
CodeEditApp/CodeEditSourceEditor#377 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
CodeEditApp/CodeEditSourceEditor#376 · 1 条评论 ·
-
难度 1/5 1-3 小时 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 68/100
CodeEditApp/CodeEditSourceEditor#378 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 32/100
查看 CodeEditApp/CodeEditSourceEditor 的全部 Issue
相似的 Issue
-
area:dictation documentation P2
难度 2/5 1-3 小时 新手友好度 78/100
uttrflow/uttrflow-swift#1180 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
type: docs
难度 1/5 1 小时以内 新手友好度 95/100
googleapis/google-cloud-swift#971 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
mozilla-mobile/firefox-ios#35743 ·