"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = void 0;
const featureWorkers_1 = require("../utils/featureWorkers");
const vscode = require("vscode-languageserver-protocol");
const common_1 = require("../utils/common");
function register(context) {
    return (uri, position, token = vscode.CancellationToken.None) => {
        return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position, data => !!data.completion), (plugin, document, position) => {
            if (token.isCancellationRequested)
                return;
            return plugin.provideLinkedEditingRanges?.(document, position, token);
        }, (data, map) => map ? ({
            wordPattern: data.wordPattern,
            ranges: data.ranges.map(range => map.toSourceRange(range)).filter(common_1.notEmpty),
        }) : data);
    };
}
exports.register = register;
//# sourceMappingURL=linkedEditingRanges.js.map