-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Problem description
There's this capability in LSP where a server can be a foldingRangeProvider
. An editor can ask the server to provide folding ranges.
It is at the moment not possible to bring those fold ranges to the gutter area.
Preferred solution
A new ST callback, much like on_query_completions, where a plugin must return a promise object to provide new fold regions. All fold regions from all plugins are merged in some way or another.
def FooListener(sublime_plugin.ViewEventListener):
def on_fold_regions(self) -> sublime.FoldRegions:
promise = sublime.FoldRegions()
sublime.set_timeout_async(lambda: self.compute_fold_regions(promise))
return promise
def compute_fold_regions(self, promise: sublime.FoldRegions) -> None:
promise.set_result([sublime.Region(0, 1), sublime.Region(10, 12)])
This way, ST can coordinate when to ask for new fold regions (perhaps after saving the view). And ST can also merge results.
Alternatives
None.
Additional Information (optional)
This is one possible solution for #101
AmjadHD, jwortmann, sylbru, themilkman, slowdownitsfine and 2 more
Metadata
Metadata
Assignees
Labels
No labels