foldsComputeAll function
Bracket-based fold ranges. Brackets inside strings and comments are not excluded, so replace this with tree-sitter/LSP folds when available.
Small documents are scanned on the calling isolate. Larger ones are scanned on a background isolate so the UI thread is not blocked.
Implementation
Future<List<RustFoldRange>> foldsComputeAll({required Rope rope}) async {
final text = rope.getText();
if (text.length < _isolateThreshold) return _foldsFromText(text);
return Isolate.run(() => _foldsFromText(text));
}