Skip to content

Commit

Permalink
chore: Add experimental features to VS Code Kaoto
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Jan 8, 2025
1 parent e9f4cd6 commit 4694edf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Fix Kaoto Datamapper editor on Windows (issue when attaching an xsd)
- Upgrade to Kaoto 2.4.0-RC1
- Add the possibility to enable experimental features (drag & drop)

# 2.3.0

Expand Down
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@
"id"
],
"scope": "window"
},
"kaoto.nodeToolbarTrigger": {
"type": "string",
"default": "onHover",
"markdownDescription": "Choose when to open the Node toolbar. Can be either `onHover` or `onSelection`. If `onHover` is selected, the toolbar will be automatically open upon hoevring a node, otherwise, it will be open when selecting a node",
"enum": [
"onHover",
"onSelection"
]
},
"kaoto.enableDragAndDrop": {
"type": "boolean",
"default": false,
"markdownDescription": "Control whether to enable drag and drop feature",
"tags": ["experimental"]
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion src/webview/VSCodeKaotoEditorChannelApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { KaotoEditorChannelApi } from '@kaoto/kaoto';
import { ISettingsModel, NodeLabelType, SettingsModel } from '@kaoto/kaoto/models';
import { ISettingsModel, NodeLabelType, NodeToolbarTrigger, SettingsModel } from '@kaoto/kaoto/models';
import { BackendProxy } from '@kie-tools-core/backend/dist/api';
import { I18n } from '@kie-tools-core/i18n/dist/core';
import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api";
Expand Down Expand Up @@ -39,10 +39,16 @@ export class VSCodeKaotoEditorChannelApi extends DefaultVsCodeKieEditorChannelAp
async getVSCodeKaotoSettings(): Promise<ISettingsModel> {
const catalogUrl = await vscode.workspace.getConfiguration('kaoto').get<Promise<string | null>>('catalog.url');
const nodeLabel = await vscode.workspace.getConfiguration('kaoto').get<Promise<NodeLabelType | null>>('nodeLabel');
const nodeToolbarTrigger = await vscode.workspace.getConfiguration('kaoto').get<Promise<NodeToolbarTrigger | null>>('nodeToolbarTrigger');
const enableDragAndDrop = await vscode.workspace.getConfiguration('kaoto').get<Promise<ISettingsModel['experimentalFeatures']['enableDragAndDrop'] | null>>('enableDragAndDrop');

const settingsModel: Partial<ISettingsModel> = {
catalogUrl: catalogUrl ?? '',
nodeLabel: nodeLabel ?? NodeLabelType.Description,
nodeToolbarTrigger: nodeToolbarTrigger ?? NodeToolbarTrigger.onHover,
experimentalFeatures: {
enableDragAndDrop: enableDragAndDrop ?? false,
},
};

return new SettingsModel(settingsModel);
Expand Down

0 comments on commit 4694edf

Please sign in to comment.