gleam-lang/gleam

LSP: Allow for folding documentation in code editors

Geschlossen

#5.813 geöffnet am 05.06.2026

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (960 Forks)batch import
help wanted

Repository-Metriken

Stars
 (21.417 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 10T 19h) (69 gemergte PRs in 30 T)

Beschreibung

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.

Contributor Guide