Skip to content

Commit

Permalink
#783 Fix navigation & update to latest glsp client nighly (#28)
Browse files Browse the repository at this point in the history
Upgrade yarn lock to consume latest glsp client version. (to consume eclipse-glsp/glsp-client@4a5a0ee)

Refactor server download script (analog to eclipse-glsp/glsp-client#194)
Use yarn resolutions to resolve sprotty version conflict (caused by upstream sprotty-vscode-webview)

Re-add missing registration of the editorSelectedElementsAmount context key
Fixes eclipse-glsp/glsp/issues/783
Fixes eclipse-glsp/glsp/issues/782
  • Loading branch information
tortmayr authored Nov 14, 2022
1 parent d4fccf3 commit 151c3c1
Show file tree
Hide file tree
Showing 8 changed files with 415 additions and 344 deletions.
2 changes: 1 addition & 1 deletion example/workflow/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"build": "tsc && yarn download:Server",
"publish": "vsce publish",
"download:Server": "ts-node ../scripts/download.ts"
"download:Server": "ts-node scripts/download.ts"
},
"workspaces": {
"nohoist": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@
import * as fs from 'fs';
import download from 'mvn-artifact-download';
import { join } from 'path';
import * as config from '../src/server-config.json';

const downloadDir = join(__dirname, '../extension/server');
const mavenRepository = 'https://repo1.maven.org/maven2/';
const groupId = 'org.eclipse.glsp.example';
const artifactId = 'org.eclipse.glsp.example.workflow';
const version = '1.0.0';
const classifier = 'glsp';
const downloadDir = join(__dirname, '../server');
const { groupId, artifactId, classifier, version, isSnapShot } = config;
const mavenRepository = isSnapShot ? config.snapshotRepository : config.releaseRepository;

const serverExecutable = `${__dirname}/../extension/server/${artifactId}-${version}-${classifier}-SNAPSHOT.jar`;
if (fs.existsSync(serverExecutable)) {
fs.unlinkSync(serverExecutable);
}
const isSnapShot = false;
console.log('Downloading latest version of the Workflow Example Java Server from the maven repository...');
download({ groupId, artifactId, version, classifier, isSnapShot }, downloadDir, mavenRepository)
.then(() =>
Expand Down
9 changes: 9 additions & 0 deletions example/workflow/extension/src/server-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"releaseRepository": "https://repo1.maven.org/maven2/",
"snapshotRepository": "https://oss.sonatype.org/content/repositories/snapshots/",
"groupId": "org.eclipse.glsp.example",
"artifactId": "org.eclipse.glsp.example.workflow",
"version": "1.1.0",
"isSnapShot": true,
"classifier": "glsp"
}
8 changes: 7 additions & 1 deletion example/workflow/extension/src/workflow-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ import * as path from 'path';
import * as process from 'process';
import 'reflect-metadata';
import * as vscode from 'vscode';
import * as config from './server-config.json';
import WorkflowEditorProvider from './workflow-editor-provider';

const DEFAULT_SERVER_PORT = '5007';
const { version, isSnapShot } = config;
const JAVA_EXECUTABLE = path.join(
__dirname,
`../server/org.eclipse.glsp.example.workflow-${version}${isSnapShot ? '-SNAPSHOT' : ''}-glsp.jar`
);

export async function activate(context: vscode.ExtensionContext): Promise<void> {
// Start server process using quickstart component
if (process.env.GLSP_SERVER_DEBUG !== 'true') {
const serverProcess = new GlspServerLauncher({
executable: path.join(__dirname, '../server/org.eclipse.glsp.example.workflow-1.0.0-glsp.jar'),
executable: JAVA_EXECUTABLE,
socketConnectionOptions: { port: JSON.parse(process.env.GLSP_SERVER_PORT || DEFAULT_SERVER_PORT) },
additionalArgs: ['--fileLog', 'true', '--logDir', path.join(__dirname, '../server')],
logging: true,
Expand Down
3 changes: 2 additions & 1 deletion example/workflow/extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "@eclipse-glsp/ts-config/tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
"outDir": "lib",
"resolveJsonModule": true
},
"include": ["src", "server", "pack"]
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"rimraf": "^2.6.3",
"typescript": "^4.4.5"
},
"resolutions": {
"**/sprotty": "0.13.0-next.1c4343c.328"
},
"workspaces": [
"packages/*/",
"example/workflow/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,11 @@ export function configureDefaultCommands(context: CommandContext): void {
connector.sendActionToActiveClient(RequestExportSvgAction.create());
})
);

extensionContext.subscriptions.push(
connector.onSelectionUpdate(n => {
selectedElements = n;
vscode.commands.executeCommand('setContext', `${diagramPrefix}.editorSelectedElementsAmount`, n.length);
})
);
}
716 changes: 382 additions & 334 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 151c3c1

Please sign in to comment.