@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
86 lines • 4.14 kB
TypeScript
/********************************************************************************
* 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
********************************************************************************/
import { Action, CommandExecutionContext, CommandReturn, DeleteMarkersAction, IActionDispatcher, IActionHandler, ICommand, Marker, SetMarkersAction } from '@eclipse-glsp/sprotty';
import { EditorContextService } from '../../base/editor-context-service';
import { IFeedbackActionDispatcher, IFeedbackEmitter } from '../../base/feedback/feedback-action-dispatcher';
import { FeedbackCommand } from '../../base/feedback/feedback-command';
import { FeedbackEmitter } from '../../base/feedback/feedback-emitter';
/**
* Feedback emitter sending actions for visualizing model validation feedback and
* re-establishing this feedback visualization after the model has been updated.
*/
export declare class ValidationFeedbackEmitter implements IFeedbackEmitter {
protected feedbackActionDispatcher: IFeedbackActionDispatcher;
protected registeredFeedbackByReason: Map<string, FeedbackEmitter>;
/**
* Register the action that should be emitted for visualizing validation feedback.
* @param action the action that should be emitted when the model is updated and that will visualize the model validation feedback.
* @param reason the reason for this validation feedback.
*/
registerValidationFeedbackAction(action: ApplyMarkersAction, reason?: string): void;
}
/**
* Manages current markers for the outside of the GLSP.
*
* Typically this is rebound by the surrounding tool, e.g. Theia, to be aware of
* and propagate current markers.
*/
export declare abstract class ExternalMarkerManager {
languageLabel: string;
protected actionDispatcher?: IActionDispatcher;
connect(actionDispatcher: IActionDispatcher): void;
removeMarkers(markers: Marker[]): void;
abstract setMarkers(markers: Marker[], reason?: string, sourceUri?: string): void;
}
export declare class SetMarkersActionHandler implements IActionHandler {
protected validationFeedbackEmitter: ValidationFeedbackEmitter;
protected externalMarkerManager?: ExternalMarkerManager;
protected editorContextService: EditorContextService;
handle(action: SetMarkersAction): void | Action | ICommand;
setMarkers(markers: Marker[], reason: string | undefined): Promise<void>;
}
/**
* Action for applying makers to the graphical model.
*/
export interface ApplyMarkersAction extends Action {
kind: typeof ApplyMarkersAction.KIND;
markers: Marker[];
}
export declare namespace ApplyMarkersAction {
const KIND = "applyMarkers";
function is(object: any): object is ApplyMarkersAction;
function create(markers: Marker[]): ApplyMarkersAction;
}
/**
* Handles {@link ApplyMarkersAction}s by creating the corresponding {@link GIssueMarker}s and
* adding them to the graphical model.
*/
export declare class ApplyMarkersCommand extends FeedbackCommand {
protected action: ApplyMarkersAction;
static KIND: string;
constructor(action: ApplyMarkersAction);
execute(context: CommandExecutionContext): CommandReturn;
}
/**
* Command for handling `DeleteMarkersAction`
*/
export declare class DeleteMarkersCommand extends FeedbackCommand {
protected action: DeleteMarkersAction;
static KIND: string;
constructor(action: DeleteMarkersAction);
execute(context: CommandExecutionContext): CommandReturn;
}
//# sourceMappingURL=validate.d.ts.map