WIP - vscode webview comm problem
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
********************************************************************************/
|
||||
import {BeanNode, VSCodeWebViewDiagramServer} from "./model";
|
||||
import {BeanNode, ExampleWebsocketDiagramServer, VSCodeWebViewDiagramServer} from "./model";
|
||||
|
||||
console.log("Loading di.config");
|
||||
import "reflect-metadata"
|
||||
@@ -47,14 +47,26 @@ import {
|
||||
} from "sprotty";
|
||||
import {BeanNodeView, CircleNodeView, EdgeView, ExampleGraphView} from "./views";
|
||||
|
||||
export default (useWebsocket: boolean) => {
|
||||
export enum TransportMedium {
|
||||
None,
|
||||
Websocket,
|
||||
LSP
|
||||
}
|
||||
|
||||
export default (transport: TransportMedium, clientId: string) => {
|
||||
require("sprotty/css/sprotty.css");
|
||||
require("../css/diagram.css");
|
||||
const circlegraphModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||
if (useWebsocket)
|
||||
bind(TYPES.ModelSource).to(VSCodeWebViewDiagramServer).inSingletonScope();
|
||||
else
|
||||
bind(TYPES.ModelSource).to(LocalModelSource).inSingletonScope();
|
||||
switch (transport) {
|
||||
case TransportMedium.Websocket:
|
||||
bind(TYPES.ModelSource).to(ExampleWebsocketDiagramServer).inSingletonScope();
|
||||
break;
|
||||
case TransportMedium.LSP:
|
||||
bind(TYPES.ModelSource).to(VSCodeWebViewDiagramServer).inSingletonScope();
|
||||
break;
|
||||
default:
|
||||
bind(TYPES.ModelSource).to(LocalModelSource).inSingletonScope();
|
||||
}
|
||||
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
|
||||
rebind(TYPES.LogLevel).toConstantValue(LogLevel.log);
|
||||
const context = { bind, unbind, isBound, rebind };
|
||||
@@ -67,8 +79,9 @@ export default (useWebsocket: boolean) => {
|
||||
configureViewerOptions(context, {
|
||||
needsClientLayout: true,
|
||||
needsServerLayout: true,
|
||||
baseDiv: 'spring-boot'
|
||||
baseDiv: clientId,
|
||||
});
|
||||
console.log('di.config.ts : ' + clientId);
|
||||
});
|
||||
|
||||
const container = new Container();
|
||||
|
||||
Reference in New Issue
Block a user