"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = void 0;
const vscode = require("vscode-languageserver-protocol");
const featureWorkers_1 = require("../utils/featureWorkers");
function register(context) {
    return (uri, position, signatureHelpContext = {
        triggerKind: vscode.SignatureHelpTriggerKind.Invoked,
        isRetrigger: false,
    }, 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;
            if (signatureHelpContext?.triggerKind === vscode.SignatureHelpTriggerKind.TriggerCharacter
                && signatureHelpContext.triggerCharacter
                && !(signatureHelpContext.isRetrigger
                    ? plugin.signatureHelpRetriggerCharacters
                    : plugin.signatureHelpTriggerCharacters)?.includes(signatureHelpContext.triggerCharacter)) {
                return;
            }
            return plugin.provideSignatureHelp?.(document, position, signatureHelpContext, token);
        }, (data) => data);
    };
}
exports.register = register;
//# sourceMappingURL=signatureHelp.js.map