"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigurationTarget = void 0;
exports.reviveWorkspaceEditDto = reviveWorkspaceEditDto;
const ide_core_common_1 = require("@opensumi/ide-core-common");
/**
 * The configuration target
 */
var ConfigurationTarget;
(function (ConfigurationTarget) {
    /**
     * Global configuration
     */
    ConfigurationTarget[ConfigurationTarget["Global"] = 1] = "Global";
    /**
     * Workspace configuration
     */
    ConfigurationTarget[ConfigurationTarget["Workspace"] = 2] = "Workspace";
    /**
     * Workspace folder configuration
     */
    ConfigurationTarget[ConfigurationTarget["WorkspaceFolder"] = 3] = "WorkspaceFolder";
})(ConfigurationTarget || (exports.ConfigurationTarget = ConfigurationTarget = {}));
function reviveWorkspaceEditDto(data) {
    if (data && data.edits) {
        for (const edit of data.edits) {
            if (typeof edit.resource === 'object') {
                edit.resource = ide_core_common_1.URI.from(edit.resource);
                edit.options = { openDirtyInEditor: true };
                edit.textEdit = edit.textEdit;
                edit.versionId = edit.versionId;
            }
            else {
                const resourceFileEdit = edit;
                resourceFileEdit.newResource = edit.newResource
                    ? ide_core_common_1.URI.from(edit.newResource)
                    : undefined;
                resourceFileEdit.oldResource = edit.oldResource
                    ? ide_core_common_1.URI.from(edit.oldResource)
                    : undefined;
                // 似乎 vscode 的行为默认不会 showInEditor，参考来自 codeMe 插件
                resourceFileEdit.options = {
                    ...resourceFileEdit.options,
                    showInEditor: false,
                };
            }
        }
    }
    return data;
}
//# sourceMappingURL=workspace.js.map