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.

貢獻者指南