From e1cf0b0b6b3290df6619e4919b74ca0d5dec0ee2 Mon Sep 17 00:00:00 2001 From: Niklas Rentz Date: Sat, 28 Sep 2024 21:34:50 +0200 Subject: [PATCH 1/8] implement client-only layout. Hardcode to use it for now, switch between modes missing yet. --- packages/klighd-core/package.json | 2 + packages/klighd-core/src/di.config.ts | 21 ++++++++- packages/klighd-core/src/diagram-server.ts | 36 +++++++++++++++ packages/klighd-core/src/layout-config.ts | 41 +++++++++++++++++ packages/klighd-core/src/skgraph-models.ts | 5 ++- packages/klighd-core/src/views-common.ts | 51 ++++++++++++++-------- yarn.lock | 15 +++++++ 7 files changed, 151 insertions(+), 20 deletions(-) create mode 100644 packages/klighd-core/src/layout-config.ts diff --git a/packages/klighd-core/package.json b/packages/klighd-core/package.json index 6abb4798..8b420388 100644 --- a/packages/klighd-core/package.json +++ b/packages/klighd-core/package.json @@ -26,11 +26,13 @@ "dependencies": { "@kieler/klighd-interactive": "^0.5.0", "@types/file-saver": "^2.0.7", + "elkjs": "^0.8.2", "feather-icons": "^4.29.1", "file-saver": "^2.0.5", "inversify": "^6.0.2", "snabbdom": "^3.5.1", "sprotty": "^1.3.0", + "sprotty-elk": "^1.3.0", "sprotty-protocol": "^1.3.0" }, "devDependencies": { diff --git a/packages/klighd-core/src/di.config.ts b/packages/klighd-core/src/di.config.ts index f31ccb7e..1f62a620 100644 --- a/packages/klighd-core/src/di.config.ts +++ b/packages/klighd-core/src/di.config.ts @@ -16,8 +16,10 @@ */ import { interactiveModule } from '@kieler/klighd-interactive/lib/interactive-module' +import ElkConstructor from 'elkjs/lib/elk.bundled' import { Container, ContainerModule, interfaces } from 'inversify' import { + boundsModule, configureActionHandler, configureModelElement, ConsoleLogger, @@ -44,6 +46,7 @@ import { viewportModule, ViewRegistry, } from 'sprotty' +import { ElkFactory, ElkLayoutEngine, elkLayoutModule, ILayoutConfigurator } from 'sprotty-elk' import actionModule from './actions/actions-module' // import bookmarkModule from './bookmarks/bookmark-module'; import { DISymbol } from './di.symbols' @@ -53,6 +56,7 @@ import { KlighdHoverMouseListener } from './hover/hover' import { PopupModelProvider } from './hover/popup-provider' import { KlighdMouseTool } from './klighd-mouse-tool' import { KlighdSvgExporter } from './klighd-svg-exporter' +import { KielerLayoutConfigurator } from './layout-config' import { KlighdModelViewer } from './model-viewer' import { ResetPreferencesAction, SetPreferencesAction } from './options/actions' import { optionsModule } from './options/options-module' @@ -74,6 +78,16 @@ const kGraphDiagramModule = new ContainerModule( bind(TYPES.ModelSource).to(KlighdDiagramServer).inSingletonScope() rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope() rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn) + + // required binding for elkjs to work + bind(TYPES.IModelLayoutEngine).toService(ElkLayoutEngine) + + // Our own layout configurator that just copies the element's poperties as the layout options. + bind(KielerLayoutConfigurator).toSelf().inSingletonScope() + rebind(ILayoutConfigurator).to(KielerLayoutConfigurator).inSingletonScope() + const elkFactory: ElkFactory = () => new ElkConstructor({ algorithms: ['layered'] }) // See elkjs documentation + bind(ElkFactory).toConstantValue(elkFactory) + rebind(TYPES.CommandStackOptions).toConstantValue({ // Override the default animation speed to be 500 ms, as the default value is too quick. defaultDuration: 500, @@ -126,6 +140,8 @@ export default function createContainer(widgetId: string): Container { const container = new Container() container.load( defaultModule, + boundsModule, + elkLayoutModule, selectModule, interactiveModule, viewportModule, @@ -144,8 +160,9 @@ export default function createContainer(widgetId: string): Container { ) // FIXME: bookmarkModule is currently broken due to wrong usage of Sprotty commands. action handling needs to be reimplemented for this to work. overrideViewerOptions(container, { - needsClientLayout: false, - needsServerLayout: true, + // TODO: need some configuration switch to enable/disable client layout + needsClientLayout: true, // client layout = micro layout (Sprotty/Sprotty+KLighD) + needsServerLayout: false, // server layout = macro layout (ELK/elkjs). false here to not forward it to the Java server (the model source), but keep and handle it directly on the diagram server proxy manually baseDiv: widgetId, hiddenDiv: `${widgetId}_hidden`, // TODO: We should be able to completely deactivate Sprotty's zoom limits to not limit top down layout. diff --git a/packages/klighd-core/src/diagram-server.ts b/packages/klighd-core/src/diagram-server.ts index dbf682dd..4796f2a0 100644 --- a/packages/klighd-core/src/diagram-server.ts +++ b/packages/klighd-core/src/diagram-server.ts @@ -48,13 +48,18 @@ import { import { Action, ActionMessage, + ComputedBoundsAction, BringToFrontAction, findElement, generateRequestId, + IModelLayoutEngine, + RequestModelAction, GetViewportAction, RequestPopupModelAction, SelectAction, + SetModelAction, SetPopupModelAction, + SModelRoot, UpdateModelAction, ViewportResult, } from 'sprotty-protocol' @@ -106,6 +111,8 @@ export class KlighdDiagramServer extends DiagramServerProxy { @inject(DISymbol.BookmarkRegistry) @optional() private bookmarkRegistry: BookmarkRegistry + @inject(TYPES.IModelLayoutEngine) @optional() protected layoutEngine?: IModelLayoutEngine + constructor(@inject(ServiceTypes.Connection) connection: Connection) { super() this._connection = connection @@ -301,6 +308,35 @@ export class KlighdDiagramServer extends DiagramServerProxy { return false } + // Behavior adapted from the super class and modified to the behavior of the DiagramServer to allow this proxy to the Java diagram server to still be able to perform the layout locally. + handleComputedBounds(action: ComputedBoundsAction): boolean { + if (this.viewerOptions.needsServerLayout) { + return false + } + const root = this.currentRoot + this.computedBoundsApplicator.apply(root, action) + this.doSubmitModel(root, root.type === this.lastSubmittedModelType, action) + return false + } + + // Behavior taken from the DiagramServer to allow this proxy to the Java diagram server to still be able to perform the layout locally. + private async doSubmitModel(newRoot: SModelRoot, update: boolean, cause?: Action): Promise { + if (this.layoutEngine) { + newRoot = await this.layoutEngine.layout(newRoot) + } + const modelType = newRoot.type + if (cause && cause.kind === RequestModelAction.KIND) { + const { requestId } = cause as RequestModelAction + const response = SetModelAction.create(newRoot, requestId) + this.actionDispatcher.dispatch(response) + } else if (update && modelType === this.lastSubmittedModelType) { + this.actionDispatcher.dispatch(UpdateModelAction.create(newRoot)) + } else { + this.actionDispatcher.dispatch(SetModelAction.create(newRoot)) + } + this.lastSubmittedModelType = modelType + } + handleRequestDiagramPiece(action: RequestDiagramPieceAction): void { this.forwardToServer(action) } diff --git a/packages/klighd-core/src/layout-config.ts b/packages/klighd-core/src/layout-config.ts new file mode 100644 index 00000000..92b29dbb --- /dev/null +++ b/packages/klighd-core/src/layout-config.ts @@ -0,0 +1,41 @@ +/* + * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient + * + * http://rtsys.informatik.uni-kiel.de/kieler + * + * Copyright 2024 by + * + Kiel University + * + Department of Computer Science + * + Real-Time and Embedded Systems Group + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ + +import { LayoutOptions } from 'elkjs' +import { DefaultLayoutConfigurator } from 'sprotty-elk' +import { SModelElement, SModelIndex } from 'sprotty-protocol' + +/** + * This layout configurator copies all layout options from the KGraph element's properties. + */ +export class KielerLayoutConfigurator extends DefaultLayoutConfigurator { + override apply(element: SModelElement, _index: SModelIndex): LayoutOptions | undefined { + // Only apply to elements with properties. + if ((element as any).properties === undefined) { + return undefined + } + const properties = (element as any).properties as Record + + // map properties to layout options and stringify values + const layoutOptions: LayoutOptions = {} + Object.entries(properties).forEach(([key, value]) => { + layoutOptions[key] = JSON.stringify(value) + }) + + return layoutOptions + } +} diff --git a/packages/klighd-core/src/skgraph-models.ts b/packages/klighd-core/src/skgraph-models.ts index 91dfb0ff..4a52511a 100644 --- a/packages/klighd-core/src/skgraph-models.ts +++ b/packages/klighd-core/src/skgraph-models.ts @@ -18,6 +18,7 @@ import { KEdge, KGraphData, KNode, SKGraphElement } from '@kieler/klighd-interactive/lib/constraint-classes' import { boundsFeature, + layoutContainerFeature, moveFeature, popupFeature, RectangularPort, @@ -40,6 +41,8 @@ export class SKNode extends KNode { hasFeature(feature: symbol): boolean { return ( feature === selectFeature || + feature === boundsFeature || + feature === layoutContainerFeature || (feature === moveFeature && (this.parent as SKNode).properties && ((this.parent as SKNode).properties['org.eclipse.elk.interactiveLayout'] as boolean)) || @@ -61,7 +64,7 @@ export class SKPort extends RectangularPort implements SKGraphElement { areNonChildAreaChildrenRendered = false hasFeature(feature: symbol): boolean { - return feature === selectFeature || feature === popupFeature + return feature === selectFeature || feature === boundsFeature || feature === popupFeature } properties: Record diff --git a/packages/klighd-core/src/views-common.ts b/packages/klighd-core/src/views-common.ts index e03482aa..cebaf61b 100644 --- a/packages/klighd-core/src/views-common.ts +++ b/packages/klighd-core/src/views-common.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2019-2023 by + * Copyright 2019-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -420,14 +420,14 @@ export function findBoundsAndTransformationData( } } } - // Error check: If there are no bounds or decoration, at least try to fall back to possible size and position attributes in the parent element. + // Error check: If there are no bounds or decoration, at least try to fall back to possible position attributes in the parent element. // If the parent element has no bounds either, the object can not be rendered. - if (decoration === undefined && bounds === undefined && 'size' in parent && 'position' in parent) { + if (decoration === undefined && bounds === undefined && 'bounds' in parent) { bounds = { - x: (parent as any).position.x, - y: (parent as any).position.y, - width: (parent as any).size.width, - height: (parent as any).size.height, + x: 0, + y: 0, + width: (parent as any).bounds.width, + height: (parent as any).bounds.height, } } else if (decoration === undefined && bounds === undefined) { return undefined @@ -573,16 +573,33 @@ export function findTextBoundsAndTransformationData( bounds.height = decoration.bounds.height } } - // Error check: If there are no bounds or decoration, at least try to fall back to possible size and position attributes in the parent element. - // If the parent element has no bounds either, the object can not be rendered. - if (decoration === undefined && bounds.x === undefined && 'size' in parent && 'position' in parent) { - bounds.x = (parent as any).position.x - bounds.y = (parent as any).position.y - bounds.width = (parent as any).size.width - bounds.height = (parent as any).size.height - } else if (decoration === undefined && bounds.x === undefined) { - return undefined - } + } + // Error check: If there are no bounds or decoration, at least try to fall back to possible size attributes in the parent element. + // If the parent element has no bounds either, the object can not be rendered. + if (decoration === undefined && bounds.x === undefined && 'bounds' in parent) { + const parentBounds = { + x: 0, + y: 0, + width: (parent as any).bounds.width, + height: (parent as any).bounds.height, + } + + bounds.x = calculateX( + parentBounds.x, + parentBounds.width, + styles.kHorizontalAlignment ?? DEFAULT_K_HORIZONTAL_ALIGNMENT, + parentBounds.width + ) + bounds.y = calculateY( + parentBounds.y, + parentBounds.height, + styles.kVerticalAlignment ?? DEFAULT_K_VERTICAL_ALIGNMENT, + lines + ) + bounds.width = parent.bounds.width + bounds.height = parent.bounds.height + } else if (decoration === undefined && bounds.x === undefined) { + return undefined } // If still no bounds are found, set all by default to 0. diff --git a/yarn.lock b/yarn.lock index 9689aecb..2c00c992 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3827,6 +3827,11 @@ electron-to-chromium@^1.4.535: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.585.tgz#7b3cb6846bb5cc10a8d5904c351a9b8aaa76ea90" integrity sha512-B4yBlX0azdA3rVMxpYwLQfDpdwOgcnLCkpvSOd68iFmeedo+WYjaBJS3/W58LVD8CB2nf+o7C4K9xz1l09RkWg== +elkjs@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.8.2.tgz#c37763c5a3e24e042e318455e0147c912a7c248e" + integrity sha512-L6uRgvZTH+4OF5NE/MBbzQx/WYpru1xCBE9respNj6qznEewGUIfhzmm7horWWxbNO2M0WckQypGctR8lH79xQ== + elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" @@ -8685,6 +8690,16 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +sprotty-elk@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/sprotty-elk/-/sprotty-elk-1.3.0.tgz#2cffc8ff280f899ca791c011d67ccb4a0cd50e5e" + integrity sha512-P8AZxWj99RziRK+mA6D/J99PvpT4z+gAVbfvaHJHhYXW+1jDP5vJSNzhW305BykfFugN+2V0HVSLZKana+aUHg== + dependencies: + elkjs "^0.8.2" + sprotty-protocol "^1.3.0" + optionalDependencies: + inversify "~6.0.2" + sprotty-protocol@^1.0.0, sprotty-protocol@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/sprotty-protocol/-/sprotty-protocol-1.3.0.tgz#78a6a69cc5eb8b94b352882a83d0f339fd828a0d" From 660e9fa6cf65f9ff6092c4af89d5f7c8a988cbeb Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Tue, 8 Oct 2024 11:14:15 +0200 Subject: [PATCH 2/8] add schema for SKGraph structure --- schema/SKGraphSchema.json | 305 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 schema/SKGraphSchema.json diff --git a/schema/SKGraphSchema.json b/schema/SKGraphSchema.json new file mode 100644 index 00000000..4a4083ef --- /dev/null +++ b/schema/SKGraphSchema.json @@ -0,0 +1,305 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/SKGraphSchema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SKElement", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/KGraphData" + } + ], + "default": [] + }, + "properties": { + "type": "object", + "default": {} + }, + "type": { + "type": "string" + } + }, + "definitions": { + "SModelElement": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "children": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/SModelElement" + } + ], + "default": [] + }, + "trace": { + "type": "string" + } + } + }, + "SShapeElement": { + "allOf": [{"$ref": "#/definitions/SModelElement"}], + "properties": { + "size": { + "type": "object", + "properties": { + "width": { + "type": "number" + }, + "height": { + "type": "number" + } + }, + "default": { "width": 0.0, "height": 0.0 } + } + } + + }, + "SKGraph": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "properties": { + "type": { + "type": "string", + "default": "graph" + }, + "revision": { + "type": "number" + } + } + }, + "SKNode": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}], + "properties": { + "type": { + "type": "string", + "default": "node" + } + } + }, + "SKLabel": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "properties": { + "text": { + "type": "string" + }, + "type": { + "type": "string", + "default": "label" + } + } + }, + "SKEdge": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "properties": { + "sourceId": { + "type": "string" + }, + "targetId": { + "type": "string" + }, + "junctionPoints": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + } + } + ], + "default": [] + }, + "type": { + "type": "string", + "default": "edge" + } + } + }, + "SKPort": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}], + "properties": { + "type": { + "type": "string", + "default": "port" + } + } + }, + "KGraphData": { + "properties": { + "properties": { + "type": "object", + "default": {} + } + } + }, + "KRendering": { + "allOf": [{"$ref": "#/definitions/KGraphData"}], + "properties": { + "placementData": { + "$ref": "#/definitions/KPlacementData" + }, + "styles": { + "type": "array", + "default": [] + }, + "actions": { + "type": "array", + "default": [] + }, + "type": { + "type": "string", + "default": "KRenderingImpl" + } + } + }, + "KContainerRendering": { + "allOf": [{"$ref": "#/definitions/KRendering"}], + "properties": { + "children": { + "type": "array", + "items": [ + {"$ref": "#/definitions/KRendering"} + ], + "default": [] + + }, + "childPlacement": { + + }, + "type": { + "type": "string", + "default": "KContainerRenderingImpl" + } + } + }, + "KRectangle": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "type": { + "type": "string", + "default": "KRectangleImpl" + } + } + }, + "KRoundedRectangle": { + "allOf": [{"$ref": "#/definitions/KRectangle"}], + "properties": { + "cornerWidth": { + "type": "number" + }, + "cornerHeight": { + "type": "number" + }, + "type": { + "type": "string", + "default": "KRoundedRectangleImpl" + } + } + }, + "KPolyline": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "type": { + "type": "string", + "default": "KPolylineImpl" + }, + "junctionPointRendering": { + "$ref": "#/definitions/KRendering" + } + } + }, + "KPolygon": { + "allOf": [{"$ref": "#/definitions/KPolyline"}], + "properties": { + "type": { + "type": "string", + "default": "KPolygonImpl" + } + } + }, + "KSpline": { + "allOf": [{"$ref": "#/definitions/KPolyline"}], + "properties": { + "type": { + "type": "string", + "default": "KSplineImpl" + } + } + }, + "KImage": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "bundleName": { + "type": "string" + }, + "imagePath": { + "type": "string" + }, + "type": { + "type": "string", + "default": "KImageImpl" + } + } + }, + "KEllipse": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "type": { + "type": "string", + "default": "KEllipseImpl" + } + } + }, + "KArc": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "startAngle": { + "type": "number" + }, + "arcAngle": { + "type": "number" + }, + "type": { + "type": "string", + "default": "KArcImpl" + } + } + }, + "KText": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "text": { + "type": "string" + }, + "clip": { + "type": "boolean" + }, + "type": { + "type": "string", + "default": "KTextImpl" + } + } + }, + "KPlacementData": { + "type": "object", + "properties": { + "stub": { + "type": "string" + } + } + } + } +} \ No newline at end of file From e186312f3e5b110e092427f1c956350b98d8c0bc Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Wed, 9 Oct 2024 15:10:46 +0200 Subject: [PATCH 3/8] add json schemas for messages and actions used to speak with a language server --- schema/{ => klighd}/SKGraphSchema.json | 2 +- schema/klighd/actions/setSyntheses.json | 32 +++++ schema/klighd/actions/updateOptions.json | 158 +++++++++++++++++++++ schema/klighd/messages/setPreferences.json | 29 ++++ schema/lsp/initialize.json | 61 ++++++++ schema/sprotty/actions/requestBounds.json | 34 +++++ schema/sprotty/messages/diagramAccept.json | 67 +++++++++ 7 files changed, 382 insertions(+), 1 deletion(-) rename schema/{ => klighd}/SKGraphSchema.json (99%) create mode 100644 schema/klighd/actions/setSyntheses.json create mode 100644 schema/klighd/actions/updateOptions.json create mode 100644 schema/klighd/messages/setPreferences.json create mode 100644 schema/lsp/initialize.json create mode 100644 schema/sprotty/actions/requestBounds.json create mode 100644 schema/sprotty/messages/diagramAccept.json diff --git a/schema/SKGraphSchema.json b/schema/klighd/SKGraphSchema.json similarity index 99% rename from schema/SKGraphSchema.json rename to schema/klighd/SKGraphSchema.json index 4a4083ef..5305f351 100644 --- a/schema/SKGraphSchema.json +++ b/schema/klighd/SKGraphSchema.json @@ -1,5 +1,5 @@ { - "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/SKGraphSchema.json", + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "SKElement", "type": "object", diff --git a/schema/klighd/actions/setSyntheses.json b/schema/klighd/actions/setSyntheses.json new file mode 100644 index 00000000..79398e2e --- /dev/null +++ b/schema/klighd/actions/setSyntheses.json @@ -0,0 +1,32 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/setSyntheses.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setSyntheses", + "type": "object", + "allOf": [{"$ref": "../../sprotty/messages/diagramAccept.json#/definitions/action"}], + "properties": { + "kind": { + "type": "string", + "enum": ["setSyntheses"] + }, + "syntheses": { + "type": "array", + "items": { + "$ref": "#/definitions/synthesis" + } + } + }, + "definitions": { + "synthesis": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/updateOptions.json b/schema/klighd/actions/updateOptions.json new file mode 100644 index 00000000..4294ed71 --- /dev/null +++ b/schema/klighd/actions/updateOptions.json @@ -0,0 +1,158 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/updateOptions.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "updateOptions", + "type": "object", + "allOf": [{"$ref": "../../sprotty/messsages/diagramAccept.json#/definitions/action"}], + "properties": { + "kind": { + "type": "string", + "enum": ["updateOptions"] + }, + "valuedSynthesisOptions": { + "type": "array", + "items": { + "$ref": "#/definitions/SynthesisOption" + } + }, + "layoutOptions": { + "type": "array" + }, + "actions": { + "type": "array" + }, + "modelUri": { + "type": "string" + } + }, + "definitions": { + "SynthesisOption": { + "type": "object", + "properties": { + "synthesisOption": { + "anyOf": [ + {"$ref": "#/definitions/checkSynthesisOption"}, + {"$ref": "#/definitions/choiceSynthesisOption"}, + {"$ref": "#/definitions/rangeSynthesisOption"}, + {"$ref": "#/definitions/textSynthesisOption"}, + {"$ref": "#/definitions/separatorSynthesisOption"} + ] + }, + "currentValue": { + "type": ["string", "number", "boolean"] + } + } + }, + "generalSynthesisOption": { + "type": "object", + "properties": { + + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "number" + }, + "updateAction": { + "type": "string" + }, + "category": { + "$ref": "#/definitions/SynthesisCategory" + }, + "sourceHash": { + "type": "string" + }, + "initialValue": {} + } + }, + "checkSynthesisOption": { + "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [0] + }, + "initialValue": { + "type": "boolean" + } + } + }, + "choiceSynthesisOption": { + "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [1] + }, + "initialValue": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "rangeSynthesisOption": { + "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [2] + }, + "initialValue": { + "type": "number" + }, + "range": { + "type": "object", + "properties": { + "first": { + "type": "number" + }, + "second": { + "type": "number" + } + } + }, + "stepSize": { + "type": "number" + } + } + }, + "textSynthesisOption": { + "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [3] + }, + "initialValue": { + "type": "string" + } + } + }, + "separatorSynthesisOption": { + "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [4] + } + } + }, + "categorySynthesisOption": { + "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [5] + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/setPreferences.json b/schema/klighd/messages/setPreferences.json new file mode 100644 index 00000000..75a37b7a --- /dev/null +++ b/schema/klighd/messages/setPreferences.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/setPreferences.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/preferences/setPreferences", + "type": "object", + "properties": { + "jsonrpc": { + "type": "string" + }, + "method": { + "type": "string", + "enum": ["keith/preferences/setPreferences"] + }, + "params": { + "type": "object", + "properties": { + "diagram.shouldSelectDiagram": { + "type": "boolean" + }, + "diagram.shouldSelectText": { + "type": "boolean" + }, + "diagram.incrementalDiagramGenerator": { + "type": "boolean" + } + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/initialize.json b/schema/lsp/initialize.json new file mode 100644 index 00000000..8d9f2e8d --- /dev/null +++ b/schema/lsp/initialize.json @@ -0,0 +1,61 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/initialize.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "initialize", + "type": "object", + "properties": { + "jsonrpc": { + "type": "string" + }, + "id": { + "type": "number" + }, + "method": { + "type": "string", + "enum": ["initialize"] + }, + "params": { + "type": "object", + "properties": { + "processId": {}, + "workspaceFolders": {}, + "rootUri": {}, + "clientInfo": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + }, + "capabilities": { + "type": "object" + }, + "initializationOptions": { + "type": "object", + "properties": { + "clientDiagramOptions": { + "$ref": "#/definitions/ClientDiagramOptions" + } + } + } + } + } + }, + "definitions": { + "ClientDiagramOptions": { + "type": "object", + "properties": { + "preference": { + "type": "object" + }, + "render": { + "type": "object" + }, + "synthesis": { + "type": "object" + } + } + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/requestBounds.json b/schema/sprotty/actions/requestBounds.json new file mode 100644 index 00000000..d65e8c52 --- /dev/null +++ b/schema/sprotty/actions/requestBounds.json @@ -0,0 +1,34 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/requestBounds.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "requestBounds", + "type": "object", + "allOf": [{"$ref": "../../sprotty/messages/diagramAccept.json#/definitions/action"}], + "properties": { + "kind": { + "type": "string", + "enum": ["requestBounds"] + }, + "newRoot": { + "type": "object", + "properties": { + "properties": {}, + "revision": { + "type": "number" + }, + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "../../klighd/SKGraphSchema#/definitions/SKGraph" + } + } + } + } + } +} \ No newline at end of file diff --git a/schema/sprotty/messages/diagramAccept.json b/schema/sprotty/messages/diagramAccept.json new file mode 100644 index 00000000..b8fb5b86 --- /dev/null +++ b/schema/sprotty/messages/diagramAccept.json @@ -0,0 +1,67 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramAccept.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "diagram/accept", + "type": "object", + "properties": { + "jsonrpc": { + "type": "string" + }, + "method": { + "type": "string", + "enum": ["diagram/accept"] + }, + "params": { + "type": "object", + "properties": { + "clientId": { + "type": "string", + "enum": ["sprotty"] + }, + "action": { + "$ref": "#/definitions/action" + } + } + } + }, + "definitions": { + "action": { + "type": "object", + "properties": { + "kind": { + "type": "string" + } + } + }, + "requestModelAction": { + "allOf": [{"$ref": "#/definitions/action"}], + "properties": { + "kind": { + "type": "string", + "enum": ["requestModel"] + }, + "options": { + "type": "object", + "properties": { + "needsClientLayout": { + "type": "boolean" + }, + "needsServerLayout": { + "type": "boolean" + }, + "sourceUri": { + "type": "string" + }, + "diagramType": { + "type": "string", + "enum": ["keith-diagram"] + } + } + }, + "requestId": { + "type": "string" + } + } + } + } +} \ No newline at end of file From df3cd18441b6bb5dbd03892e1565e62dcd0f1205 Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Wed, 9 Oct 2024 15:48:26 +0200 Subject: [PATCH 4/8] update schema structure --- schema/klighd/actions/setSyntheses.json | 2 +- schema/klighd/actions/updateOptions.json | 28 +++++---- schema/sprotty/actions/action.json | 11 ++++ schema/sprotty/actions/requestBounds.json | 6 +- schema/sprotty/actions/requestModel.json | 34 +++++++++++ schema/sprotty/diagramAccept.json | 27 +++++++++ schema/sprotty/messages/diagramAccept.json | 67 ---------------------- 7 files changed, 92 insertions(+), 83 deletions(-) create mode 100644 schema/sprotty/actions/action.json create mode 100644 schema/sprotty/actions/requestModel.json create mode 100644 schema/sprotty/diagramAccept.json delete mode 100644 schema/sprotty/messages/diagramAccept.json diff --git a/schema/klighd/actions/setSyntheses.json b/schema/klighd/actions/setSyntheses.json index 79398e2e..021faf00 100644 --- a/schema/klighd/actions/setSyntheses.json +++ b/schema/klighd/actions/setSyntheses.json @@ -3,7 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "setSyntheses", "type": "object", - "allOf": [{"$ref": "../../sprotty/messages/diagramAccept.json#/definitions/action"}], + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], "properties": { "kind": { "type": "string", diff --git a/schema/klighd/actions/updateOptions.json b/schema/klighd/actions/updateOptions.json index 4294ed71..3a2b6f39 100644 --- a/schema/klighd/actions/updateOptions.json +++ b/schema/klighd/actions/updateOptions.json @@ -3,7 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "updateOptions", "type": "object", - "allOf": [{"$ref": "../../sprotty/messsages/diagramAccept.json#/definitions/action"}], + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], "properties": { "kind": { "type": "string", @@ -12,7 +12,7 @@ "valuedSynthesisOptions": { "type": "array", "items": { - "$ref": "#/definitions/SynthesisOption" + "$ref": "#/definitions/ValuedSynthesisOption" } }, "layoutOptions": { @@ -26,7 +26,7 @@ } }, "definitions": { - "SynthesisOption": { + "ValuedSynthesisOption": { "type": "object", "properties": { "synthesisOption": { @@ -35,7 +35,8 @@ {"$ref": "#/definitions/choiceSynthesisOption"}, {"$ref": "#/definitions/rangeSynthesisOption"}, {"$ref": "#/definitions/textSynthesisOption"}, - {"$ref": "#/definitions/separatorSynthesisOption"} + {"$ref": "#/definitions/separatorSynthesisOption"}, + {"$ref": "#/definitions/categorySynthesisOption"} ] }, "currentValue": { @@ -43,7 +44,7 @@ } } }, - "generalSynthesisOption": { + "SynthesisOption": { "type": "object", "properties": { @@ -60,7 +61,7 @@ "type": "string" }, "category": { - "$ref": "#/definitions/SynthesisCategory" + "$ref": "#/definitions/categorySynthesisOption" }, "sourceHash": { "type": "string" @@ -69,7 +70,7 @@ } }, "checkSynthesisOption": { - "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], "properties": { "type": { "type": "number", @@ -81,7 +82,7 @@ } }, "choiceSynthesisOption": { - "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], "properties": { "type": { "type": "number", @@ -99,7 +100,7 @@ } }, "rangeSynthesisOption": { - "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], "properties": { "type": { "type": "number", @@ -125,7 +126,7 @@ } }, "textSynthesisOption": { - "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], "properties": { "type": { "type": "number", @@ -137,7 +138,7 @@ } }, "separatorSynthesisOption": { - "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], "properties": { "type": { "type": "number", @@ -146,11 +147,14 @@ } }, "categorySynthesisOption": { - "allOf": [{"$ref": "#/definitions/generalSynthesisOption"}], + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], "properties": { "type": { "type": "number", "enum": [5] + }, + "initialValue": { + "type": "boolean" } } } diff --git a/schema/sprotty/actions/action.json b/schema/sprotty/actions/action.json new file mode 100644 index 00000000..48f6c51b --- /dev/null +++ b/schema/sprotty/actions/action.json @@ -0,0 +1,11 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "action", + "type": "object", + "properties": { + "kind": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/requestBounds.json b/schema/sprotty/actions/requestBounds.json index d65e8c52..8eb97ad9 100644 --- a/schema/sprotty/actions/requestBounds.json +++ b/schema/sprotty/actions/requestBounds.json @@ -1,9 +1,9 @@ { - "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/requestBounds.json", + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/requestBounds.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "requestBounds", "type": "object", - "allOf": [{"$ref": "../../sprotty/messages/diagramAccept.json#/definitions/action"}], + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], "properties": { "kind": { "type": "string", @@ -25,7 +25,7 @@ "children": { "type": "array", "items": { - "$ref": "../../klighd/SKGraphSchema#/definitions/SKGraph" + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" } } } diff --git a/schema/sprotty/actions/requestModel.json b/schema/sprotty/actions/requestModel.json new file mode 100644 index 00000000..f9e1564f --- /dev/null +++ b/schema/sprotty/actions/requestModel.json @@ -0,0 +1,34 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/requestModel.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "requestBounds", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "properties": { + "kind": { + "type": "string", + "enum": ["requestModel"] + }, + "options": { + "type": "object", + "properties": { + "needsClientLayout": { + "type": "boolean" + }, + "needsServerLayout": { + "type": "boolean" + }, + "sourceUri": { + "type": "string" + }, + "diagramType": { + "type": "string", + "enum": ["keith-diagram"] + } + } + }, + "requestId": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/diagramAccept.json b/schema/sprotty/diagramAccept.json new file mode 100644 index 00000000..22a7b106 --- /dev/null +++ b/schema/sprotty/diagramAccept.json @@ -0,0 +1,27 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramAccept.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "diagram/accept", + "type": "object", + "properties": { + "jsonrpc": { + "type": "string" + }, + "method": { + "type": "string", + "enum": ["diagram/accept"] + }, + "params": { + "type": "object", + "properties": { + "clientId": { + "type": "string", + "enum": ["sprotty"] + }, + "action": { + "$ref": "./actions/action.json#action" + } + } + } + } +} \ No newline at end of file diff --git a/schema/sprotty/messages/diagramAccept.json b/schema/sprotty/messages/diagramAccept.json deleted file mode 100644 index b8fb5b86..00000000 --- a/schema/sprotty/messages/diagramAccept.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramAccept.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "diagram/accept", - "type": "object", - "properties": { - "jsonrpc": { - "type": "string" - }, - "method": { - "type": "string", - "enum": ["diagram/accept"] - }, - "params": { - "type": "object", - "properties": { - "clientId": { - "type": "string", - "enum": ["sprotty"] - }, - "action": { - "$ref": "#/definitions/action" - } - } - } - }, - "definitions": { - "action": { - "type": "object", - "properties": { - "kind": { - "type": "string" - } - } - }, - "requestModelAction": { - "allOf": [{"$ref": "#/definitions/action"}], - "properties": { - "kind": { - "type": "string", - "enum": ["requestModel"] - }, - "options": { - "type": "object", - "properties": { - "needsClientLayout": { - "type": "boolean" - }, - "needsServerLayout": { - "type": "boolean" - }, - "sourceUri": { - "type": "string" - }, - "diagramType": { - "type": "string", - "enum": ["keith-diagram"] - } - } - }, - "requestId": { - "type": "string" - } - } - } - } -} \ No newline at end of file From 19dd1f1f8a8dc0801dfb7b5da217b504fbda8f38 Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Wed, 9 Oct 2024 15:52:38 +0200 Subject: [PATCH 5/8] update schema structure --- schema/sprotty/diagramAccept.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/sprotty/diagramAccept.json b/schema/sprotty/diagramAccept.json index 22a7b106..8af36a81 100644 --- a/schema/sprotty/diagramAccept.json +++ b/schema/sprotty/diagramAccept.json @@ -19,7 +19,7 @@ "enum": ["sprotty"] }, "action": { - "$ref": "./actions/action.json#action" + "$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json" } } } From 48c49dbd76a506b2fc648a8318841e747659df48 Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Thu, 10 Oct 2024 10:02:41 +0200 Subject: [PATCH 6/8] update schemas with required fields and add lsp message types --- schema/klighd/SKGraphSchema.json | 7 ++++ schema/klighd/actions/setSyntheses.json | 2 + schema/klighd/actions/updateOptions.json | 9 +++- schema/klighd/messages/setPreferences.json | 7 ++-- schema/lsp/initialize.json | 9 +--- schema/lsp/message.json | 13 ++++++ schema/lsp/requestMessage.json | 19 +++++++++ schema/lsp/responseMessage.json | 15 +++++++ schema/sprotty/actions/action.json | 1 + schema/sprotty/actions/requestBounds.json | 21 +--------- schema/sprotty/actions/requestModel.json | 49 +++++++++++----------- schema/sprotty/diagramAccept.json | 7 ++-- 12 files changed, 99 insertions(+), 60 deletions(-) create mode 100644 schema/lsp/message.json create mode 100644 schema/lsp/requestMessage.json create mode 100644 schema/lsp/responseMessage.json diff --git a/schema/klighd/SKGraphSchema.json b/schema/klighd/SKGraphSchema.json index 5305f351..8e38b258 100644 --- a/schema/klighd/SKGraphSchema.json +++ b/schema/klighd/SKGraphSchema.json @@ -3,6 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "SKElement", "type": "object", + "required": ["data", "properties", "type"], "properties": { "data": { "type": "array", @@ -24,6 +25,7 @@ "definitions": { "SModelElement": { "type": "object", + "required": ["type", "id", "children"], "properties": { "type": { "type": "string" @@ -47,6 +49,7 @@ }, "SShapeElement": { "allOf": [{"$ref": "#/definitions/SModelElement"}], + "required": ["size"], "properties": { "size": { "type": "object", @@ -65,6 +68,7 @@ }, "SKGraph": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "revision"], "properties": { "type": { "type": "string", @@ -77,6 +81,7 @@ }, "SKNode": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}], + "required": ["type"], "properties": { "type": { "type": "string", @@ -86,6 +91,7 @@ }, "SKLabel": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "text"], "properties": { "text": { "type": "string" @@ -98,6 +104,7 @@ }, "SKEdge": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "sourceId", "targetId"], "properties": { "sourceId": { "type": "string" diff --git a/schema/klighd/actions/setSyntheses.json b/schema/klighd/actions/setSyntheses.json index 021faf00..37aae4a3 100644 --- a/schema/klighd/actions/setSyntheses.json +++ b/schema/klighd/actions/setSyntheses.json @@ -4,6 +4,7 @@ "title": "setSyntheses", "type": "object", "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "syntheses"], "properties": { "kind": { "type": "string", @@ -19,6 +20,7 @@ "definitions": { "synthesis": { "type": "object", + "required": ["id", "displayName"], "properties": { "id": { "type": "string" diff --git a/schema/klighd/actions/updateOptions.json b/schema/klighd/actions/updateOptions.json index 3a2b6f39..b570d319 100644 --- a/schema/klighd/actions/updateOptions.json +++ b/schema/klighd/actions/updateOptions.json @@ -4,6 +4,7 @@ "title": "updateOptions", "type": "object", "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "valuedSynthesisOptions", "layoutOptions", "actions", "modelUri"], "properties": { "kind": { "type": "string", @@ -28,6 +29,7 @@ "definitions": { "ValuedSynthesisOption": { "type": "object", + "required": ["synthesisOption", "currentValue"], "properties": { "synthesisOption": { "anyOf": [ @@ -46,8 +48,8 @@ }, "SynthesisOption": { "type": "object", + "required": ["id", "name", "type", "sourceHash", "initialValue"], "properties": { - "id": { "type": "string" }, @@ -55,7 +57,8 @@ "type": "string" }, "type": { - "type": "number" + "type": "number", + "enum": [0, 1, 2, 3, 4, 5] }, "updateAction": { "type": "string" @@ -83,6 +86,7 @@ }, "choiceSynthesisOption": { "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["values"], "properties": { "type": { "type": "number", @@ -101,6 +105,7 @@ }, "rangeSynthesisOption": { "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["range", "stepSize"], "properties": { "type": { "type": "number", diff --git a/schema/klighd/messages/setPreferences.json b/schema/klighd/messages/setPreferences.json index 75a37b7a..75c6b943 100644 --- a/schema/klighd/messages/setPreferences.json +++ b/schema/klighd/messages/setPreferences.json @@ -2,17 +2,16 @@ "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/setPreferences.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "keith/preferences/setPreferences", - "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], "properties": { - "jsonrpc": { - "type": "string" - }, "method": { "type": "string", "enum": ["keith/preferences/setPreferences"] }, "params": { "type": "object", + "required": ["diagram.shouldSelectDiagram", "diagram.shouldSelectText", "diagram.incrementalDiagramGenerator"], "properties": { "diagram.shouldSelectDiagram": { "type": "boolean" diff --git a/schema/lsp/initialize.json b/schema/lsp/initialize.json index 8d9f2e8d..ae7b5766 100644 --- a/schema/lsp/initialize.json +++ b/schema/lsp/initialize.json @@ -2,14 +2,9 @@ "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/initialize.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "initialize", - "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}], + "required": ["method", "params"], "properties": { - "jsonrpc": { - "type": "string" - }, - "id": { - "type": "number" - }, "method": { "type": "string", "enum": ["initialize"] diff --git a/schema/lsp/message.json b/schema/lsp/message.json new file mode 100644 index 00000000..ef38af37 --- /dev/null +++ b/schema/lsp/message.json @@ -0,0 +1,13 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/message.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "message", + "type": "object", + "required": ["jsonrpc"], + "properties": { + "jsonrpc": { + "type": "string", + "enum": ["2.0"] + } + } +} \ No newline at end of file diff --git a/schema/lsp/requestMessage.json b/schema/lsp/requestMessage.json new file mode 100644 index 00000000..1fa41a01 --- /dev/null +++ b/schema/lsp/requestMessage.json @@ -0,0 +1,19 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/requestmessage.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "message", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}], + "required": ["id", "method"], + "properties": { + "id": { + "type": ["number", "string"] + }, + "method": { + "type": "string", + "enum": ["requestMessage"] + }, + "params": { + "type": ["array", "object"] + } + } +} \ No newline at end of file diff --git a/schema/lsp/responseMessage.json b/schema/lsp/responseMessage.json new file mode 100644 index 00000000..48db567e --- /dev/null +++ b/schema/lsp/responseMessage.json @@ -0,0 +1,15 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/requestmessage.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "message", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}], + "required": ["id"], + "oneOf": [{"required": ["result"]}, {"required": ["error"]}], + "properties": { + "id": { + "type": ["number", "string", "null"] + }, + "result": {}, + "error": {} + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/action.json b/schema/sprotty/actions/action.json index 48f6c51b..067295b0 100644 --- a/schema/sprotty/actions/action.json +++ b/schema/sprotty/actions/action.json @@ -3,6 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "action", "type": "object", + "required": ["kind"], "properties": { "kind": { "type": "string" diff --git a/schema/sprotty/actions/requestBounds.json b/schema/sprotty/actions/requestBounds.json index 8eb97ad9..9ad3dd50 100644 --- a/schema/sprotty/actions/requestBounds.json +++ b/schema/sprotty/actions/requestBounds.json @@ -4,31 +4,14 @@ "title": "requestBounds", "type": "object", "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "newRoot"], "properties": { "kind": { "type": "string", "enum": ["requestBounds"] }, "newRoot": { - "type": "object", - "properties": { - "properties": {}, - "revision": { - "type": "number" - }, - "type": { - "type": "string" - }, - "id": { - "type": "string" - }, - "children": { - "type": "array", - "items": { - "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" - } - } - } + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" } } } \ No newline at end of file diff --git a/schema/sprotty/actions/requestModel.json b/schema/sprotty/actions/requestModel.json index f9e1564f..1aebcb5b 100644 --- a/schema/sprotty/actions/requestModel.json +++ b/schema/sprotty/actions/requestModel.json @@ -4,31 +4,32 @@ "title": "requestBounds", "type": "object", "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], - "properties": { - "kind": { - "type": "string", - "enum": ["requestModel"] - }, - "options": { - "type": "object", - "properties": { - "needsClientLayout": { - "type": "boolean" - }, - "needsServerLayout": { - "type": "boolean" - }, - "sourceUri": { - "type": "string" - }, - "diagramType": { - "type": "string", - "enum": ["keith-diagram"] - } + "required": ["kind", "options", "requestId"], + "properties": { + "kind": { + "type": "string", + "enum": ["requestModel"] + }, + "options": { + "type": "object", + "properties": { + "needsClientLayout": { + "type": "boolean" + }, + "needsServerLayout": { + "type": "boolean" + }, + "sourceUri": { + "type": "string" + }, + "diagramType": { + "type": "string", + "enum": ["keith-diagram"] } - }, - "requestId": { - "type": "string" } + }, + "requestId": { + "type": "string" } + } } \ No newline at end of file diff --git a/schema/sprotty/diagramAccept.json b/schema/sprotty/diagramAccept.json index 8af36a81..531bb740 100644 --- a/schema/sprotty/diagramAccept.json +++ b/schema/sprotty/diagramAccept.json @@ -2,17 +2,16 @@ "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramAccept.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "diagram/accept", - "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], "properties": { - "jsonrpc": { - "type": "string" - }, "method": { "type": "string", "enum": ["diagram/accept"] }, "params": { "type": "object", + "required": ["clientId", "action"], "properties": { "clientId": { "type": "string", From 402df1a50d04a4e91b02855979a9f239c9884a8a Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Thu, 10 Oct 2024 11:36:24 +0200 Subject: [PATCH 7/8] additional actions and messages --- schema/klighd/SKGraphSchema.json | 24 +++ schema/klighd/ValuedSynthesisOption.json | 141 +++++++++++++++++ schema/klighd/actions/checkImages.json | 34 +++++ schema/klighd/actions/checkedImages.json | 37 +++++ schema/klighd/actions/performAction.json | 26 ++++ schema/klighd/actions/refreshDiagram.json | 14 ++ schema/klighd/actions/refreshLayout.json | 14 ++ .../klighd/actions/requestDiagramPiece.json | 17 +++ schema/klighd/actions/setDiagramPiece.json | 17 +++ schema/klighd/actions/setSynthesis.json | 17 +++ schema/klighd/actions/storeImages.json | 27 ++++ schema/klighd/actions/updateOptions.json | 142 +----------------- .../messages/diagramOptionsPerformAction.json | 25 +++ .../diagramOptionsSetLayoutOptions.json | 35 +++++ .../diagramOptionsSetSynthesisOptions.json | 28 ++++ ...es.json => preferencesSetPreferences.json} | 2 +- schema/lsp/generalSendMessage.json | 19 +++ schema/lsp/range.json | 29 ++++ schema/lsp/requestMessage.json | 2 +- schema/lsp/textDocumentDocumentHighlight.json | 29 ++++ schema/sprotty/actions/action.json | 3 + schema/sprotty/actions/allSelected.json | 17 +++ schema/sprotty/actions/elementSelected.json | 29 ++++ schema/sprotty/actions/fit.json | 26 ++++ schema/sprotty/actions/setModel.json | 17 +++ schema/sprotty/actions/updateModel.json | 17 +++ schema/sprotty/diagramOpenInTextEditor.json | 39 +++++ 27 files changed, 685 insertions(+), 142 deletions(-) create mode 100644 schema/klighd/ValuedSynthesisOption.json create mode 100644 schema/klighd/actions/checkImages.json create mode 100644 schema/klighd/actions/checkedImages.json create mode 100644 schema/klighd/actions/performAction.json create mode 100644 schema/klighd/actions/refreshDiagram.json create mode 100644 schema/klighd/actions/refreshLayout.json create mode 100644 schema/klighd/actions/requestDiagramPiece.json create mode 100644 schema/klighd/actions/setDiagramPiece.json create mode 100644 schema/klighd/actions/setSynthesis.json create mode 100644 schema/klighd/actions/storeImages.json create mode 100644 schema/klighd/messages/diagramOptionsPerformAction.json create mode 100644 schema/klighd/messages/diagramOptionsSetLayoutOptions.json create mode 100644 schema/klighd/messages/diagramOptionsSetSynthesisOptions.json rename schema/klighd/messages/{setPreferences.json => preferencesSetPreferences.json} (94%) create mode 100644 schema/lsp/generalSendMessage.json create mode 100644 schema/lsp/range.json create mode 100644 schema/lsp/textDocumentDocumentHighlight.json create mode 100644 schema/sprotty/actions/allSelected.json create mode 100644 schema/sprotty/actions/elementSelected.json create mode 100644 schema/sprotty/actions/fit.json create mode 100644 schema/sprotty/actions/setModel.json create mode 100644 schema/sprotty/actions/updateModel.json create mode 100644 schema/sprotty/diagramOpenInTextEditor.json diff --git a/schema/klighd/SKGraphSchema.json b/schema/klighd/SKGraphSchema.json index 8e38b258..fb86effc 100644 --- a/schema/klighd/SKGraphSchema.json +++ b/schema/klighd/SKGraphSchema.json @@ -62,6 +62,18 @@ } }, "default": { "width": 0.0, "height": 0.0 } + }, + "position": { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "default": { "x": 0.0, "y": 0.0 } } } @@ -76,6 +88,18 @@ }, "revision": { "type": "number" + }, + "children": { + "type": "array", + "required": ["items"], + "items": [ + { + "$ref": "#/definitions/SModelElement" + } + ], + "default": [], + "minItems": 1, + "maxItems": 1 } } }, diff --git a/schema/klighd/ValuedSynthesisOption.json b/schema/klighd/ValuedSynthesisOption.json new file mode 100644 index 00000000..b5705837 --- /dev/null +++ b/schema/klighd/ValuedSynthesisOption.json @@ -0,0 +1,141 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/ValuedSynthesisOption.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ValuedSynthesisOption", + "type": "object", + "required": ["synthesisOption", "currentValue"], + "properties": { + "synthesisOption": { + "anyOf": [ + {"$ref": "#/definitions/checkSynthesisOption"}, + {"$ref": "#/definitions/choiceSynthesisOption"}, + {"$ref": "#/definitions/rangeSynthesisOption"}, + {"$ref": "#/definitions/textSynthesisOption"}, + {"$ref": "#/definitions/separatorSynthesisOption"}, + {"$ref": "#/definitions/categorySynthesisOption"} + ] + }, + "currentValue": { + "type": ["string", "number", "boolean"] + } + }, + "definitions": { + "SynthesisOption": { + "type": "object", + "required": ["id", "name", "type", "sourceHash", "initialValue"], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "number", + "enum": [0, 1, 2, 3, 4, 5] + }, + "updateAction": { + "type": "string" + }, + "category": { + "$ref": "#/definitions/categorySynthesisOption" + }, + "sourceHash": { + "type": "string" + }, + "initialValue": {} + } + }, + "checkSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [0] + }, + "initialValue": { + "type": "boolean" + } + } + }, + "choiceSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["values"], + "properties": { + "type": { + "type": "number", + "enum": [1] + }, + "initialValue": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "rangeSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["range", "stepSize"], + "properties": { + "type": { + "type": "number", + "enum": [2] + }, + "initialValue": { + "type": "number" + }, + "range": { + "type": "object", + "properties": { + "first": { + "type": "number" + }, + "second": { + "type": "number" + } + } + }, + "stepSize": { + "type": "number" + } + } + }, + "textSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [3] + }, + "initialValue": { + "type": "string" + } + } + }, + "separatorSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [4] + } + } + }, + "categorySynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [5] + }, + "initialValue": { + "type": "boolean" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/checkImages.json b/schema/klighd/actions/checkImages.json new file mode 100644 index 00000000..c5c7006a --- /dev/null +++ b/schema/klighd/actions/checkImages.json @@ -0,0 +1,34 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/checkImages.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "checkImages", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "images"], + "properties": { + "kind": { + "type": "string", + "enum": ["checkImages"] + }, + "images": { + "type": "array", + "items": { + "$ref": "#/definitions/image" + } + } + }, + "definitions": { + "image": { + "type": "object", + "required": ["bundleName", "imagePath"], + "properties": { + "bundleName": { + "type": "string" + }, + "imagePath": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/checkedImages.json b/schema/klighd/actions/checkedImages.json new file mode 100644 index 00000000..6e5445cc --- /dev/null +++ b/schema/klighd/actions/checkedImages.json @@ -0,0 +1,37 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/checkedImages.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "checkedImages", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "notCached", "responseId"], + "properties": { + "kind": { + "type": "string", + "enum": ["checkedImages"] + }, + "notCached": { + "type": "array", + "items": { + "$ref": "#/definitions/notCachedImage" + } + }, + "responseId": { + "type": "string" + } + }, + "definitions": { + "notCachedImage": { + "type": "object", + "required": ["k", "v"], + "properties": { + "k": { + "type": "string" + }, + "v": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/performAction.json b/schema/klighd/actions/performAction.json new file mode 100644 index 00000000..0dfe923d --- /dev/null +++ b/schema/klighd/actions/performAction.json @@ -0,0 +1,26 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/performAction.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "performAction", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "actionId", "kGraphElementId", "kRenderingId", "revision"], + "properties": { + "kind": { + "type": "string", + "enum": ["performAction"] + }, + "actionId": { + "type": "string" + }, + "kGraphElementId": { + "type": "string" + }, + "kRenderingId": { + "type": "string" + }, + "revision": { + "type": "number" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/refreshDiagram.json b/schema/klighd/actions/refreshDiagram.json new file mode 100644 index 00000000..56fc6379 --- /dev/null +++ b/schema/klighd/actions/refreshDiagram.json @@ -0,0 +1,14 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/refreshDiagram.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "refreshDiagram", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind"], + "properties": { + "kind": { + "type": "string", + "enum": ["refreshDiagram"] + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/refreshLayout.json b/schema/klighd/actions/refreshLayout.json new file mode 100644 index 00000000..0f322b89 --- /dev/null +++ b/schema/klighd/actions/refreshLayout.json @@ -0,0 +1,14 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/refreshLayout.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "refreshLayout", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind"], + "properties": { + "kind": { + "type": "string", + "enum": ["refreshLayout"] + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/requestDiagramPiece.json b/schema/klighd/actions/requestDiagramPiece.json new file mode 100644 index 00000000..9d92c8eb --- /dev/null +++ b/schema/klighd/actions/requestDiagramPiece.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/requestDiagramPiece.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "requestDiagramPiece", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "modelElementId"], + "properties": { + "kind": { + "type": "string", + "enum": ["requestDiagramPiece"] + }, + "modelElementId": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/setDiagramPiece.json b/schema/klighd/actions/setDiagramPiece.json new file mode 100644 index 00000000..b538bb30 --- /dev/null +++ b/schema/klighd/actions/setDiagramPiece.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/setDiagramPiece.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setDiagramPiece", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "diagramPiece"], + "properties": { + "kind": { + "type": "string", + "enum": ["setDiagramPiece"] + }, + "diagramPiece": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema.json#/definitions/SKNode" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/setSynthesis.json b/schema/klighd/actions/setSynthesis.json new file mode 100644 index 00000000..1cdc4d50 --- /dev/null +++ b/schema/klighd/actions/setSynthesis.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/setSynthesis.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setSynthesis", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "id"], + "properties": { + "kind": { + "type": "string", + "enum": ["setSynthesis"] + }, + "id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/storeImages.json b/schema/klighd/actions/storeImages.json new file mode 100644 index 00000000..c58f4c66 --- /dev/null +++ b/schema/klighd/actions/storeImages.json @@ -0,0 +1,27 @@ + +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/storeImages.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "storeImages", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "images"], + "properties": { + "kind": { + "type": "string", + "enum": ["storeImages"] + }, + "images": { + "type": "object", + "required": ["k", "v"], + "properties": { + "k": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/actions/checkedImages.json#/definitions/notCachedImage" + }, + "v": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/updateOptions.json b/schema/klighd/actions/updateOptions.json index b570d319..8084bf9a 100644 --- a/schema/klighd/actions/updateOptions.json +++ b/schema/klighd/actions/updateOptions.json @@ -13,7 +13,7 @@ "valuedSynthesisOptions": { "type": "array", "items": { - "$ref": "#/definitions/ValuedSynthesisOption" + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/valuedSynthesisOption.json" } }, "layoutOptions": { @@ -25,143 +25,5 @@ "modelUri": { "type": "string" } - }, - "definitions": { - "ValuedSynthesisOption": { - "type": "object", - "required": ["synthesisOption", "currentValue"], - "properties": { - "synthesisOption": { - "anyOf": [ - {"$ref": "#/definitions/checkSynthesisOption"}, - {"$ref": "#/definitions/choiceSynthesisOption"}, - {"$ref": "#/definitions/rangeSynthesisOption"}, - {"$ref": "#/definitions/textSynthesisOption"}, - {"$ref": "#/definitions/separatorSynthesisOption"}, - {"$ref": "#/definitions/categorySynthesisOption"} - ] - }, - "currentValue": { - "type": ["string", "number", "boolean"] - } - } - }, - "SynthesisOption": { - "type": "object", - "required": ["id", "name", "type", "sourceHash", "initialValue"], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "number", - "enum": [0, 1, 2, 3, 4, 5] - }, - "updateAction": { - "type": "string" - }, - "category": { - "$ref": "#/definitions/categorySynthesisOption" - }, - "sourceHash": { - "type": "string" - }, - "initialValue": {} - } - }, - "checkSynthesisOption": { - "allOf": [{"$ref": "#/definitions/SynthesisOption"}], - "properties": { - "type": { - "type": "number", - "enum": [0] - }, - "initialValue": { - "type": "boolean" - } - } - }, - "choiceSynthesisOption": { - "allOf": [{"$ref": "#/definitions/SynthesisOption"}], - "required": ["values"], - "properties": { - "type": { - "type": "number", - "enum": [1] - }, - "initialValue": { - "type": "string" - }, - "values": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "rangeSynthesisOption": { - "allOf": [{"$ref": "#/definitions/SynthesisOption"}], - "required": ["range", "stepSize"], - "properties": { - "type": { - "type": "number", - "enum": [2] - }, - "initialValue": { - "type": "number" - }, - "range": { - "type": "object", - "properties": { - "first": { - "type": "number" - }, - "second": { - "type": "number" - } - } - }, - "stepSize": { - "type": "number" - } - } - }, - "textSynthesisOption": { - "allOf": [{"$ref": "#/definitions/SynthesisOption"}], - "properties": { - "type": { - "type": "number", - "enum": [3] - }, - "initialValue": { - "type": "string" - } - } - }, - "separatorSynthesisOption": { - "allOf": [{"$ref": "#/definitions/SynthesisOption"}], - "properties": { - "type": { - "type": "number", - "enum": [4] - } - } - }, - "categorySynthesisOption": { - "allOf": [{"$ref": "#/definitions/SynthesisOption"}], - "properties": { - "type": { - "type": "number", - "enum": [5] - }, - "initialValue": { - "type": "boolean" - } - } - } - } + } } \ No newline at end of file diff --git a/schema/klighd/messages/diagramOptionsPerformAction.json b/schema/klighd/messages/diagramOptionsPerformAction.json new file mode 100644 index 00000000..48628e22 --- /dev/null +++ b/schema/klighd/messages/diagramOptionsPerformAction.json @@ -0,0 +1,25 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/diagramOptionsPerformAction.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/diagramOptions/performAction", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/diagramOptions/performAction"] + }, + "params": { + "type": "object", + "required": ["actionId", "uri"], + "properties": { + "actionId": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/diagramOptionsSetLayoutOptions.json b/schema/klighd/messages/diagramOptionsSetLayoutOptions.json new file mode 100644 index 00000000..cacc7e8e --- /dev/null +++ b/schema/klighd/messages/diagramOptionsSetLayoutOptions.json @@ -0,0 +1,35 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/diagramOptionsSetLayoutOptions.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/diagramOptions/setLayoutOptions", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/diagramOptions/setLayoutOptions"] + }, + "params": { + "type": "object", + "required": ["layoutOptions", "uri"], + "properties": { + "layoutOptions": { + "type": "array", + "items": { + "type": "object", + "required": ["optionId", "value"], + "properties": { + "optionId": { + "type": "string" + }, + "value": {} + } + } + }, + "uri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json b/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json new file mode 100644 index 00000000..6d60dae1 --- /dev/null +++ b/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json @@ -0,0 +1,28 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/diagramOptions/setSynthesisOptions", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/diagramOptions/setSynthesisOptions"] + }, + "params": { + "type": "object", + "required": ["synthesisOptions"], + "properties": { + "synthesisOptions": { + "type": "array", + "items": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/valuedSynthesisOption.json" + } + }, + "uri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/setPreferences.json b/schema/klighd/messages/preferencesSetPreferences.json similarity index 94% rename from schema/klighd/messages/setPreferences.json rename to schema/klighd/messages/preferencesSetPreferences.json index 75c6b943..227f8265 100644 --- a/schema/klighd/messages/setPreferences.json +++ b/schema/klighd/messages/preferencesSetPreferences.json @@ -1,5 +1,5 @@ { - "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/setPreferences.json", + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/preferencesSetPreferences.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "keith/preferences/setPreferences", "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], diff --git a/schema/lsp/generalSendMessage.json b/schema/lsp/generalSendMessage.json new file mode 100644 index 00000000..6da08838 --- /dev/null +++ b/schema/lsp/generalSendMessage.json @@ -0,0 +1,19 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/generalSendMessage.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "general/sendMessage", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["general/sendMessage"] + }, + "params": { + "type": "array", + "items": { + "type": "string" + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/range.json b/schema/lsp/range.json new file mode 100644 index 00000000..47f7a90a --- /dev/null +++ b/schema/lsp/range.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/range.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "range", + "type": "object", + "required": ["start", "end"], + "properties": { + "start": { + "$ref": "#/definitions/editorPosition.json" + }, + "end": { + "$ref": "#/definitions/editorPosition.json" + } + }, + "definitions": { + "editorPosition.json": { + "type": "object", + "required": ["line", "character"], + "properties": { + "line": { + "type": "integer" + }, + "character": { + "type": "integer" + } + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/requestMessage.json b/schema/lsp/requestMessage.json index 1fa41a01..03924db3 100644 --- a/schema/lsp/requestMessage.json +++ b/schema/lsp/requestMessage.json @@ -3,7 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "message", "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}], - "required": ["id", "method"], + "required": ["method"], "properties": { "id": { "type": ["number", "string"] diff --git a/schema/lsp/textDocumentDocumentHighlight.json b/schema/lsp/textDocumentDocumentHighlight.json new file mode 100644 index 00000000..998e3fbe --- /dev/null +++ b/schema/lsp/textDocumentDocumentHighlight.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/textDocumentDocumentHighlight.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "textDocument/documentHighlight", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["textDocument/documentHighlight"] + }, + "params": { + "type": "object", + "properties": { + "textDocument": { + "type":"object", + "properties": { + "uri": { + "type": "string" + } + } + }, + "position": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/position.json" + } + } + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/action.json b/schema/sprotty/actions/action.json index 067295b0..2cb2fa92 100644 --- a/schema/sprotty/actions/action.json +++ b/schema/sprotty/actions/action.json @@ -7,6 +7,9 @@ "properties": { "kind": { "type": "string" + }, + "requestId": { + "type": "string" } } } \ No newline at end of file diff --git a/schema/sprotty/actions/allSelected.json b/schema/sprotty/actions/allSelected.json new file mode 100644 index 00000000..1214c45a --- /dev/null +++ b/schema/sprotty/actions/allSelected.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/allSelected.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "allSelected", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "select"], + "properties": { + "kind": { + "type": "string", + "enum": ["allSelected"] + }, + "select": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/elementSelected.json b/schema/sprotty/actions/elementSelected.json new file mode 100644 index 00000000..f19c3619 --- /dev/null +++ b/schema/sprotty/actions/elementSelected.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/elementSelected.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "elementSelected", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "selectedElementsIDs", "deselectedElementsIDs", "preventOpenSelection"], + "properties": { + "kind": { + "type": "string", + "enum": ["elementSelected"] + }, + "selectedElementsIDs": { + "type": "array", + "items": { + "type": "string" + } + }, + "deselectedElementsIDs": { + "type": "array", + "items": { + "type": "string" + } + }, + "preventOpenSelection": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/fit.json b/schema/sprotty/actions/fit.json new file mode 100644 index 00000000..9a82a5cf --- /dev/null +++ b/schema/sprotty/actions/fit.json @@ -0,0 +1,26 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/fit.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "fit", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "elementIds", "maxZoom", "animate"], + "properties": { + "kind": { + "type": "string", + "enum": ["fit"] + }, + "elementIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "maxZoom": { + "type": "number" + }, + "animate": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/setModel.json b/schema/sprotty/actions/setModel.json new file mode 100644 index 00000000..ff8d309d --- /dev/null +++ b/schema/sprotty/actions/setModel.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/setModel.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setModel", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "newRoot"], + "properties": { + "kind": { + "type": "string", + "enum": ["setModel"] + }, + "newRoot": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/updateModel.json b/schema/sprotty/actions/updateModel.json new file mode 100644 index 00000000..a6c1a1b8 --- /dev/null +++ b/schema/sprotty/actions/updateModel.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/updateModel.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "updateModel", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "newRoot"], + "properties": { + "kind": { + "type": "string", + "enum": ["updateModel"] + }, + "newRoot": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/diagramOpenInTextEditor.json b/schema/sprotty/diagramOpenInTextEditor.json new file mode 100644 index 00000000..0be1cbd9 --- /dev/null +++ b/schema/sprotty/diagramOpenInTextEditor.json @@ -0,0 +1,39 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramOpenInTextEditor.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "diagram/openInTextEditor", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["diagram/openInTextEditor"] + }, + "params": { + "type": "object", + "required": ["location", "forceOpen"], + "properties": { + "location": { + "$ref": "#/definitions/location" + }, + "forceOpen": { + "type": "boolean" + } + } + } + }, + "definitions": { + "location": { + "type": "object", + "required": ["uri", "range"], + "properties": { + "uri": { + "type": "string" + }, + "range": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/range.json" + } + } + } + } +} \ No newline at end of file From c848768e04714c97fd8a14daa3c4a360b98c7048 Mon Sep 17 00:00:00 2001 From: Niklas Rentz Date: Tue, 5 Nov 2024 14:55:14 +0100 Subject: [PATCH 8/8] implement new preference to change between client and server layout --- packages/klighd-core/src/di.config.ts | 6 ++-- packages/klighd-core/src/diagram-server.ts | 22 ++++++++++++-- .../klighd-core/src/options/general-panel.tsx | 20 +++++++++++++ .../src/options/render-options-registry.ts | 4 +-- .../klighd-core/src/preferences-registry.ts | 29 ++++++++++++++++++- packages/klighd-interactive/src/actions.ts | 8 +++-- schema/klighd/actions/refreshDiagram.json | 15 ++++++++-- .../messages/preferencesSetPreferences.json | 3 ++ schema/sprotty/actions/requestModel.json | 6 ++-- 9 files changed, 96 insertions(+), 17 deletions(-) diff --git a/packages/klighd-core/src/di.config.ts b/packages/klighd-core/src/di.config.ts index 1f62a620..3de3d0d7 100644 --- a/packages/klighd-core/src/di.config.ts +++ b/packages/klighd-core/src/di.config.ts @@ -160,9 +160,9 @@ export default function createContainer(widgetId: string): Container { ) // FIXME: bookmarkModule is currently broken due to wrong usage of Sprotty commands. action handling needs to be reimplemented for this to work. overrideViewerOptions(container, { - // TODO: need some configuration switch to enable/disable client layout - needsClientLayout: true, // client layout = micro layout (Sprotty/Sprotty+KLighD) - needsServerLayout: false, // server layout = macro layout (ELK/elkjs). false here to not forward it to the Java server (the model source), but keep and handle it directly on the diagram server proxy manually + // These are ignored ignored and overwritten by the current needsClientLayout preference during model request. + needsClientLayout: false, // client layout = micro layout (Sprotty/Sprotty+KLighD) + needsServerLayout: true, // server layout = macro layout (ELK/elkjs). false here to not forward it to the Java server (the model source), but keep and handle it directly on the diagram server proxy manually baseDiv: widgetId, hiddenDiv: `${widgetId}_hidden`, // TODO: We should be able to completely deactivate Sprotty's zoom limits to not limit top down layout. diff --git a/packages/klighd-core/src/diagram-server.ts b/packages/klighd-core/src/diagram-server.ts index 4796f2a0..78c6325f 100644 --- a/packages/klighd-core/src/diagram-server.ts +++ b/packages/klighd-core/src/diagram-server.ts @@ -84,7 +84,7 @@ import { import { RequestKlighdPopupModelAction } from './hover/hover' import { PopupModelProvider } from './hover/popup-provider' import { RenderOptionsRegistry, ResizeToFit } from './options/render-options-registry' -import { IncrementalDiagramGeneratorOption, PreferencesRegistry } from './preferences-registry' +import { ClientLayoutOption, IncrementalDiagramGeneratorOption, PreferencesRegistry } from './preferences-registry' import { Connection, ServiceTypes, SessionStorage } from './services' import { SetSynthesisAction } from './syntheses/actions' import { UpdateDepthMapModelAction } from './update/update-depthmap-model' @@ -308,9 +308,27 @@ export class KlighdDiagramServer extends DiagramServerProxy { return false } + // Super class behavior, except taking the needsClientLayout preference into account instead of the client option. + override handleRequestModel(action: RequestModelAction): boolean { + const needsClientLayout = !!this.preferencesRegistry.getValue(ClientLayoutOption) + const needsServerLayout = !needsClientLayout + + const newOptions = { + needsClientLayout, + needsServerLayout, + ...action.options, + } + const newAction = { + ...action, + options: newOptions, + } + this.forwardToServer(newAction) + return false + } + // Behavior adapted from the super class and modified to the behavior of the DiagramServer to allow this proxy to the Java diagram server to still be able to perform the layout locally. handleComputedBounds(action: ComputedBoundsAction): boolean { - if (this.viewerOptions.needsServerLayout) { + if (!this.preferencesRegistry.getValue(ClientLayoutOption)) { return false } const root = this.currentRoot diff --git a/packages/klighd-core/src/options/general-panel.tsx b/packages/klighd-core/src/options/general-panel.tsx index 6372dbea..89112042 100644 --- a/packages/klighd-core/src/options/general-panel.tsx +++ b/packages/klighd-core/src/options/general-panel.tsx @@ -19,9 +19,11 @@ import { inject, injectable, postConstruct } from 'inversify' import { VNode } from 'snabbdom' import { html } from 'sprotty' // eslint-disable-line @typescript-eslint/no-unused-vars +import { RefreshDiagramAction } from '@kieler/klighd-interactive/lib/actions' import { DISymbol } from '../di.symbols' import { FeatherIcon } from '../feather-icons-snabbdom/feather-icons-snabbdom' import { + ClientLayoutOption, IncrementalDiagramGeneratorOption, PreferencesRegistry, ShouldSelectDiagramOption, @@ -123,6 +125,16 @@ export class GeneralPanel extends SidebarPanel { ) : ( '' )} + {(this.renderOptionsRegistry.getValue(DebugOptions) as boolean) ? ( + + ) : ( + '' + )} ) @@ -134,6 +146,14 @@ export class GeneralPanel extends SidebarPanel { private handlePreferenceChange(key: string, newValue: any) { this.actionDispatcher.dispatch(SetPreferencesAction.create([{ id: key, value: newValue }])) + if (key === ClientLayoutOption.ID) { + this.actionDispatcher.dispatch( + RefreshDiagramAction.create({ + needsClientLayout: newValue, + needsServerLayout: !newValue, + }) + ) + } } get icon(): VNode { diff --git a/packages/klighd-core/src/options/render-options-registry.ts b/packages/klighd-core/src/options/render-options-registry.ts index 07d7fdc9..77c6f3d2 100644 --- a/packages/klighd-core/src/options/render-options-registry.ts +++ b/packages/klighd-core/src/options/render-options-registry.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2021-2022 by + * Copyright 2021-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -509,8 +509,6 @@ export class DebugOptions implements RenderOption { readonly description = 'Whether debug options should be shown.' currentValue = false - - debug = true } export interface RenderOptionType { diff --git a/packages/klighd-core/src/preferences-registry.ts b/packages/klighd-core/src/preferences-registry.ts index 280681b2..fdb446a1 100644 --- a/packages/klighd-core/src/preferences-registry.ts +++ b/packages/klighd-core/src/preferences-registry.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2021 by + * Copyright 2021-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -87,6 +87,31 @@ export class IncrementalDiagramGeneratorOption implements Preference { debug = true } +/** + * Switch between client-only and server-only layout. + */ +export class ClientLayoutOption implements Preference { + static readonly ID: string = 'diagram.clientLayout' + + static readonly NAME: string = 'Client Layout' + + readonly description: string | undefined = 'Switch between client-only and server-only layout.' + + readonly id: string = ClientLayoutOption.ID + + readonly name: string = ClientLayoutOption.NAME + + readonly type: TransformationOptionType = TransformationOptionType.CHECK + + readonly initialValue: boolean = false + + currentValue = false + + notifyServer = true + + debug = true +} + export interface PreferenceType { readonly ID: string readonly NAME: string @@ -116,6 +141,7 @@ export class PreferencesRegistry extends Registry { this.register(ShouldSelectDiagramOption) this.register(ShouldSelectTextOption) this.register(IncrementalDiagramGeneratorOption) + this.register(ClientLayoutOption) } @postConstruct() @@ -184,6 +210,7 @@ export class PreferencesRegistry extends Registry { 'diagram.shouldSelectDiagram': this.getValue(ShouldSelectDiagramOption), 'diagram.shouldSelectText': this.getValue(ShouldSelectTextOption), 'diagram.incrementalDiagramGenerator': this.getValue(IncrementalDiagramGeneratorOption), + 'diagram.clientLayout': this.getValue(ClientLayoutOption), } this.connection.sendNotification(NotificationType.SetPreferences, obj) }) diff --git a/packages/klighd-interactive/src/actions.ts b/packages/klighd-interactive/src/actions.ts index c482d346..f3c1c48f 100644 --- a/packages/klighd-interactive/src/actions.ts +++ b/packages/klighd-interactive/src/actions.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2020-2021 by + * Copyright 2020-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -17,7 +17,7 @@ // We follow Sprotty's way of redeclaring the interface and its create function, so disable this lint check for this file. /* eslint-disable no-redeclare */ -import { Action } from 'sprotty-protocol' +import { Action, JsonMap } from 'sprotty-protocol' import { DeleteConstraint } from './layered/constraint-types' /** @@ -25,14 +25,16 @@ import { DeleteConstraint } from './layered/constraint-types' */ export interface RefreshDiagramAction extends Action { kind: typeof RefreshDiagramAction.KIND + options?: JsonMap } export namespace RefreshDiagramAction { export const KIND = 'refreshDiagram' - export function create(): RefreshDiagramAction { + export function create(options?: JsonMap): RefreshDiagramAction { return { kind: KIND, + options, } } } diff --git a/schema/klighd/actions/refreshDiagram.json b/schema/klighd/actions/refreshDiagram.json index 56fc6379..bda306d8 100644 --- a/schema/klighd/actions/refreshDiagram.json +++ b/schema/klighd/actions/refreshDiagram.json @@ -3,12 +3,23 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "refreshDiagram", "type": "object", - "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "allOf": [{ "$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json" }], "required": ["kind"], "properties": { "kind": { "type": "string", "enum": ["refreshDiagram"] + }, + "options": { + "type": "object", + "properties": { + "needsClientLayout": { + "type": "boolean" + }, + "needsServerLayout": { + "type": "boolean" + } + } } } -} \ No newline at end of file +} diff --git a/schema/klighd/messages/preferencesSetPreferences.json b/schema/klighd/messages/preferencesSetPreferences.json index 227f8265..e5019394 100644 --- a/schema/klighd/messages/preferencesSetPreferences.json +++ b/schema/klighd/messages/preferencesSetPreferences.json @@ -21,6 +21,9 @@ }, "diagram.incrementalDiagramGenerator": { "type": "boolean" + }, + "diagram.clientLayout": { + "type": "boolean" } } } diff --git a/schema/sprotty/actions/requestModel.json b/schema/sprotty/actions/requestModel.json index 1aebcb5b..9f837ac4 100644 --- a/schema/sprotty/actions/requestModel.json +++ b/schema/sprotty/actions/requestModel.json @@ -1,9 +1,9 @@ { "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/requestModel.json", "$schema": "http://json-schema.org/draft-07/schema#", - "title": "requestBounds", + "title": "requestModel", "type": "object", - "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "allOf": [{ "$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json" }], "required": ["kind", "options", "requestId"], "properties": { "kind": { @@ -32,4 +32,4 @@ "type": "string" } } -} \ No newline at end of file +}