@eclipse-glsp/protocol
Version:
The protocol definition for client-server communication in GLSP
107 lines • 3.75 kB
TypeScript
import { Action, RequestAction, ResponseAction } from './base-protocol';
/**
* Validation in GLSP is performed by using validation markers. A marker represents the validation result for a single model element
*/
export interface Marker {
/**
* Short label describing this marker message, e.g., short validation message
*/
readonly label: string;
/**
* Full description of this marker, e.g., full validation message
*/
readonly description: string;
/**
* Id of the model element this marker refers to
*/
readonly elementId: string;
/**
* Marker kind, e.g., info, warning, error or custom kind
*/
readonly kind: string;
}
/**
* The default marker kinds used in GLSP
*/
export declare namespace MarkerKind {
const INFO = "info";
const WARNING = "warning";
const ERROR = "error";
}
/**
* The default reasons for markers.
*/
export declare namespace MarkersReason {
/** Markers resulting from a batch validation */
const BATCH = "batch";
/** Markers resulting from a live validation */
const LIVE = "live";
}
/**
* Action to retrieve markers for the specified model elements. Sent from the client to the server.
* The corresponding namespace declares the action kind as constant and offers helper functions for type guard checks
* and creating new `RequestMarkersActions`.
*/
export interface RequestMarkersAction extends RequestAction<SetMarkersAction> {
kind: typeof RequestMarkersAction.KIND;
/**
* The elements for which markers are requested, may be just the root element.
*/
elementsIDs: string[];
/**
* The reason for this request, such as `batch` or `live` validation. `batch` by default.
*/
reason?: string;
}
export declare namespace RequestMarkersAction {
const KIND = "requestMarkers";
function is(object: unknown): object is RequestMarkersAction;
function create(elementsIDs: string[], options?: {
requestId?: string;
reason?: string;
}): RequestMarkersAction;
}
/**
* Instructs the client to add markers to the diagram.
* Typically, this is a response to the {@link RequestMarkersAction} containing all validation markers, but can be sent by the server at
* unknown time.
* The corresponding namespace declares the action kind as constant and offers helper functions for type guard checks
* and creating new `SetMarkersActions`.
*/
export interface SetMarkersAction extends ResponseAction {
kind: typeof SetMarkersAction.KIND;
/**
* The list of markers to be added to the diagram.
*/
readonly markers: Marker[];
/**
* The reason for message, such as `batch` or `live` validation.
*/
reason?: string;
}
export declare namespace SetMarkersAction {
const KIND = "setMarkers";
function is(object: unknown): object is SetMarkersAction;
function create(markers: Marker[], options?: {
responseId?: string;
reason?: string;
}): SetMarkersAction;
}
/**
* Action for clearing makers of a model
* The corresponding namespace declares the action kind as constant and offers helper functions for type guard checks
* and creating new `DeleteMarkersActions`. Can be sent by either the client or the server.
*/
export interface DeleteMarkersAction extends Action {
kind: typeof DeleteMarkersAction.KIND;
/**
* The list of markers that has been requested by the `RequestMarkersAction`.
*/
markers: Marker[];
}
export declare namespace DeleteMarkersAction {
const KIND = "deleteMarkers";
function is(object: unknown): object is DeleteMarkersAction;
function create(markers: Marker[]): DeleteMarkersAction;
}
//# sourceMappingURL=element-validation.d.ts.map