"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EvaluatableExpressionAdapter = void 0;
const tslib_1 = require("tslib");
const ide_core_common_1 = require("@opensumi/ide-core-common");
const Converter = tslib_1.__importStar(require("../../../../common/vscode/converter"));
class EvaluatableExpressionAdapter {
    constructor(_documents, _provider) {
        this._documents = _documents;
        this._provider = _provider;
    }
    provideEvaluatableExpression(resource, position, token) {
        const doc = this._documents.getDocument(resource);
        const pos = Converter.toPosition(position);
        return (0, ide_core_common_1.asPromise)(() => this._provider.provideEvaluatableExpression(doc, pos, token)).then((value) => {
            if (value) {
                return Converter.EvaluatableExpression.from(value);
            }
            return undefined;
        });
    }
}
exports.EvaluatableExpressionAdapter = EvaluatableExpressionAdapter;
//# sourceMappingURL=evaluatableExpression.js.map