"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InlineValuesAdapter = 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 InlineValuesAdapter {
    constructor(_documents, _provider) {
        this._documents = _documents;
        this._provider = _provider;
    }
    provideInlineValues(resource, viewPort, context, token) {
        const doc = this._documents.getDocument(resource);
        return (0, ide_core_common_1.asPromise)(() => this._provider.provideInlineValues(doc, Converter.toRange(viewPort), Converter.InlineValueContext.to(context), token)).then((value) => {
            if (Array.isArray(value)) {
                return value.map((iv) => Converter.InlineValue.from(iv));
            }
            return undefined;
        });
    }
}
exports.InlineValuesAdapter = InlineValuesAdapter;
//# sourceMappingURL=inline-values.js.map