@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
45 lines • 2.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFeedbackRank = exports.FeedbackCommand = void 0;
/********************************************************************************
* Copyright (c) 2019-2024 EclipseSource 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
********************************************************************************/
/* eslint-disable deprecation/deprecation */
const sprotty_1 = require("@eclipse-glsp/sprotty");
const ranked_1 = require("../ranked");
class FeedbackCommand extends sprotty_1.Command {
constructor() {
super(...arguments);
/** @deprecated Use rank instead. Please note that a lower rank implies higher priority, so the order is reversed. */
this.priority = 0;
// backwards compatibility: convert any existing priority to an equivalent rank
this.rank = this.priority ? -this.priority : ranked_1.Ranked.DEFAULT_RANK;
}
undo(context) {
return context.root;
}
redo(context) {
return context.root;
}
}
exports.FeedbackCommand = FeedbackCommand;
/** Used for backwards compatibility, otherwise use Ranked.getRank or Ranked sort functions. */
function getFeedbackRank(command) {
var _a;
const feedbackCommand = command;
return (feedbackCommand === null || feedbackCommand === void 0 ? void 0 : feedbackCommand.priority) ? -feedbackCommand.priority : (_a = feedbackCommand.rank) !== null && _a !== void 0 ? _a : ranked_1.Ranked.DEFAULT_RANK;
}
exports.getFeedbackRank = getFeedbackRank;
//# sourceMappingURL=feedback-command.js.map