@eclipse-glsp/protocol
Version:
The protocol definition for client-server communication in GLSP
102 lines • 4.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EndProgressAction = exports.UpdateProgressAction = exports.StartProgressAction = exports.MessageAction = exports.StatusAction = void 0;
/********************************************************************************
* Copyright (c) 2021-2023 STMicroelectronics and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
const type_util_1 = require("../utils/type-util");
const base_protocol_1 = require("./base-protocol");
var StatusAction;
(function (StatusAction) {
StatusAction.KIND = 'status';
function is(object) {
return base_protocol_1.Action.hasKind(object, StatusAction.KIND) && (0, type_util_1.hasStringProp)(object, 'severity') && (0, type_util_1.hasStringProp)(object, 'message');
}
StatusAction.is = is;
function create(message, options = {}) {
return {
kind: StatusAction.KIND,
severity: 'INFO',
message,
...options
};
}
StatusAction.create = create;
})(StatusAction || (exports.StatusAction = StatusAction = {}));
var MessageAction;
(function (MessageAction) {
MessageAction.KIND = 'message';
function is(object) {
return base_protocol_1.Action.hasKind(object, MessageAction.KIND) && (0, type_util_1.hasStringProp)(object, 'message') && (0, type_util_1.hasStringProp)(object, 'severity');
}
MessageAction.is = is;
function create(message, options = {}) {
return {
kind: MessageAction.KIND,
message,
severity: 'INFO',
...options
};
}
MessageAction.create = create;
})(MessageAction || (exports.MessageAction = MessageAction = {}));
var StartProgressAction;
(function (StartProgressAction) {
StartProgressAction.KIND = 'startProgress';
function is(object) {
return base_protocol_1.Action.hasKind(object, StartProgressAction.KIND) && (0, type_util_1.hasStringProp)(object, 'progressId') && (0, type_util_1.hasStringProp)(object, 'title');
}
StartProgressAction.is = is;
function create(options) {
return {
kind: StartProgressAction.KIND,
...options
};
}
StartProgressAction.create = create;
})(StartProgressAction || (exports.StartProgressAction = StartProgressAction = {}));
var UpdateProgressAction;
(function (UpdateProgressAction) {
UpdateProgressAction.KIND = 'updateProgress';
function is(object) {
return base_protocol_1.Action.hasKind(object, UpdateProgressAction.KIND) && (0, type_util_1.hasStringProp)(object, 'progressId');
}
UpdateProgressAction.is = is;
function create(progressId, options = {}) {
return {
kind: UpdateProgressAction.KIND,
progressId,
...options
};
}
UpdateProgressAction.create = create;
})(UpdateProgressAction || (exports.UpdateProgressAction = UpdateProgressAction = {}));
var EndProgressAction;
(function (EndProgressAction) {
EndProgressAction.KIND = 'endProgress';
function is(object) {
return base_protocol_1.Action.hasKind(object, EndProgressAction.KIND) && (0, type_util_1.hasStringProp)(object, 'progressId');
}
EndProgressAction.is = is;
function create(progressId, message) {
return {
kind: EndProgressAction.KIND,
progressId,
message
};
}
EndProgressAction.create = create;
})(EndProgressAction || (exports.EndProgressAction = EndProgressAction = {}));
//# sourceMappingURL=client-notification.js.map