Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glsp collaboration #59

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
{
"name": "Workflow GLSP Example Extension (External GLSP Server)",
"name": "Workflow GLSP Example Extension (External GLSP Server) 5007",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
Expand All @@ -53,6 +53,25 @@
"GLSP_SERVER_PORT": "5007"
}
},
{
"name": "Workflow GLSP Example Extension (External GLSP Server) 5017",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/example/workflow/workspace",
"--extensionDevelopmentPath=${workspaceFolder}/example/workflow/extension"
],
"outFiles": [
"${workspaceFolder}/example/workflow/extension/lib/*.js",
"${workspaceFolder}/vscode-integration/lib/**/*.js"
],
"sourceMaps": true,
"env": {
"GLSP_SERVER_DEBUG": "true",
"GLSP_SERVER_PORT": "5017"
}
},
{
"name": "Workflow GLSP Example Extension (Integrated Node GLSP Server)",
"type": "extensionHost",
Expand Down
17 changes: 16 additions & 1 deletion example/workflow/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"watch": "tsc -w"
},
"contributes": {
"liveshare.spaces": [
"workflow-vscode-example"
],
"commands": [
{
"command": "workflow.fit",
Expand Down Expand Up @@ -82,6 +85,11 @@
"title": "Export as SVG",
"category": "Workflow Diagram",
"enablement": "activeCustomEditorId == 'workflow.glspDiagram'"
},
{
"command": "workflow.liveshare.init",
"title": "Initialize Liveshare for Workflow",
"category": "Workflow Diagram"
}
],
"customEditors": [
Expand Down Expand Up @@ -191,8 +199,12 @@
]
},
"activationEvents": [
"onStartupFinished"
"onStartupFinished",
"onCommand:bigUML.liveshare.init"
],
"dependencies": {
"vsls": "^1.0.4753"
},
"devDependencies": {
"@eclipse-glsp-examples/workflow-server": "next",
"@eclipse-glsp-examples/workflow-server-bundled": "next",
Expand All @@ -205,6 +217,9 @@
"webpack-merge": "^5.9.0",
"workflow-glsp-webview": "2.2.0-next"
},
"extensionDependencies": [
"ms-vsliveshare.vsliveshare"
],
"engines": {
"vscode": "^1.54.0"
}
Expand Down
17 changes: 16 additions & 1 deletion example/workflow/extension/src/workflow-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import 'reflect-metadata';
import { WorkflowDiagramModule, WorkflowLayoutConfigurator, WorkflowServerModule } from '@eclipse-glsp-examples/workflow-server/node';
import { configureELKLayoutModule } from '@eclipse-glsp/layout-elk';
import { GModelStorage, LogLevel, createAppModule } from '@eclipse-glsp/server/node';
import { configureCollaborationCommands } from '@eclipse-glsp/vscode-integration/lib/collaboration';
import { LiveshareGlspClientProvider, writeExtensionPermissionsForLiveshare } from '@eclipse-glsp/vscode-integration/lib/liveshare';
import {
GlspSocketServerLauncher,
GlspVscodeConnector,
Expand Down Expand Up @@ -58,20 +60,27 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
context.subscriptions.push(serverProcess);
await serverProcess.start();
}

writeExtensionPermissionsForLiveshare('Eclipse-GLSP');

const liveshareGlspClientProvider = new LiveshareGlspClientProvider();

// Wrap server with quickstart component
const workflowServer = useIntegratedServer
? new NodeGlspVscodeServer({
clientId: 'glsp.workflow',
clientName: 'workflow',
serverModules: createServerModules()
// collaboration: liveshareGlspClientProvider TODO implement collaboration for Node-Server
})
: new SocketGlspVscodeServer({
clientId: 'glsp.workflow',
clientName: 'workflow',
connectionOptions: {
port: serverProcess?.getPort() || JSON.parse(process.env.GLSP_SERVER_PORT || DEFAULT_SERVER_PORT),
path: process.env.GLSP_WEBSOCKET_PATH
}
},
collaboration: liveshareGlspClientProvider
});
// Initialize GLSP-VSCode connector with server wrapper
const glspVscodeConnector = new GlspVscodeConnector({
Expand All @@ -89,10 +98,13 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
);

context.subscriptions.push(workflowServer, glspVscodeConnector, customEditorProvider);

workflowServer.start();

configureDefaultCommands({ extensionContext: context, connector: glspVscodeConnector, diagramPrefix: 'workflow' });

configureCollaborationCommands({ extensionContext: context, connector: glspVscodeConnector });

context.subscriptions.push(
vscode.commands.registerCommand('workflow.goToNextNode', () => {
glspVscodeConnector.dispatchAction(NavigateAction.create('next'));
Expand All @@ -102,6 +114,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}),
vscode.commands.registerCommand('workflow.showDocumentation', () => {
glspVscodeConnector.dispatchAction(NavigateAction.create('documentation'));
}),
vscode.commands.registerCommand('workflow.liveshare.init', () => {
writeExtensionPermissionsForLiveshare('Eclipse-GLSP', true);
})
);
}
Expand Down
Loading