gleam-lang/gleam

LSP: Allow for folding documentation in code editors

已关闭

#5,813 创建于 2026年6月5日

 (2 条评论) (0 个反应) (0 位负责人)Rust (960 个派生)batch import
help wanted

仓库指标

星标
 (21,417 个星标)
PR 合并指标
 (平均合并 10天 19小时) (30 天内合并 69 个 PR)

描述

Similar to the feature that allows for code editors to collapse the contents of a function.

Telling the code editor about which sections of the code can be folded and which can't is the LSP's job, and so the issue is made here.

Implementation idea

Note: I'm not at all familiar with the inner workings of the LSP protocol, so take everything I say here with a healthy pinch of salt

Make the LSP keep track of the beginning and end of code documentation (module-level documentation marked by ////, and type and function documentation marked by ///), and communicate this information to the code editor through textDocument/foldingRange.

Since documentation is already kept track of by the LSP (since it can communicate this to the user through hovering over function calls and type constructions), it should be quite simple to implement.

贡献者指南