"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = void 0;
const featureWorkers_1 = require("../utils/featureWorkers");
const transformer = require("../transformer");
const vscode = require("vscode-languageserver-protocol");
function register(context) {
    return (uri, token = vscode.CancellationToken.None) => {
        return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.foldingRange, (plugin, document) => {
            if (token.isCancellationRequested)
                return;
            return plugin.provideFoldingRanges?.(document, token);
        }, (data, map) => map ? transformer.asFoldingRanges(data, range => map.toSourceRange(range)) : data, arr => arr.flat());
    };
}
exports.register = register;
//# sourceMappingURL=foldingRanges.js.map