@eclipse-glsp/client
Advanced tools
@@ -17,3 +17,3 @@ /// <reference types="node" /> | ||
********************************************************************************/ | ||
import { Action, ActionDispatcher, ActionHandlerRegistry, GModelRoot, IActionDispatcher, RequestAction, ResponseAction } from '@eclipse-glsp/sprotty'; | ||
import { Action, ActionDispatcher, ActionHandlerRegistry, Deferred, GModelRoot, IActionDispatcher, RequestAction, ResponseAction } from '@eclipse-glsp/sprotty'; | ||
import { IGModelRootListener } from './editor-context-service'; | ||
@@ -29,2 +29,3 @@ import { ModelInitializationConstraint } from './model/model-initialization-constraint'; | ||
protected postUpdateQueue: Action[]; | ||
protected initializeDeferred: Deferred<void>; | ||
initialize(): Promise<void>; | ||
@@ -31,0 +32,0 @@ protected doInitialize(): Promise<void>; |
@@ -39,6 +39,8 @@ "use strict"; | ||
this.postUpdateQueue = []; | ||
this.initializeDeferred = new sprotty_1.Deferred(); | ||
} | ||
initialize() { | ||
if (!this.initialized) { | ||
this.initialized = this.doInitialize(); | ||
this.initialized = this.initializeDeferred.promise; | ||
this.doInitialize(); | ||
} | ||
@@ -48,9 +50,15 @@ return this.initialized; | ||
async doInitialize() { | ||
if (this.actionHandlerRegistry instanceof action_handler_registry_1.GLSPActionHandlerRegistry) { | ||
this.actionHandlerRegistry.initialize(); | ||
try { | ||
if (this.actionHandlerRegistry instanceof action_handler_registry_1.GLSPActionHandlerRegistry) { | ||
this.actionHandlerRegistry.initialize(); | ||
} | ||
this.handleAction(sprotty_1.SetModelAction.create(sprotty_1.EMPTY_ROOT)).catch(() => { | ||
/* Logged in handleAction method */ | ||
}); | ||
this.startModelInitialization(); | ||
this.initializeDeferred.resolve(); | ||
} | ||
this.handleAction(sprotty_1.SetModelAction.create(sprotty_1.EMPTY_ROOT)).catch(() => { | ||
/* Logged in handleAction method */ | ||
}); | ||
this.startModelInitialization(); | ||
catch (error) { | ||
this.initializeDeferred.reject(error); | ||
} | ||
} | ||
@@ -57,0 +65,0 @@ startModelInitialization() { |
{ | ||
"name": "@eclipse-glsp/client", | ||
"version": "2.3.0-next.395+8de5d13", | ||
"version": "2.3.0-next.396+7aec575", | ||
"description": "A sprotty-based client for GLSP", | ||
@@ -49,3 +49,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@eclipse-glsp/sprotty": "2.3.0-next.395+8de5d13", | ||
"@eclipse-glsp/sprotty": "2.3.0-next.396+7aec575", | ||
"autocompleter": "^9.1.2", | ||
@@ -67,3 +67,3 @@ "file-saver": "^2.0.5", | ||
}, | ||
"gitHead": "8de5d139f94af875d6c073bf8d89107020f7a64d" | ||
"gitHead": "7aec57568c54311d022bf3c53dbd00a16e356c1c" | ||
} |
@@ -20,2 +20,3 @@ /******************************************************************************** | ||
ActionHandlerRegistry, | ||
Deferred, | ||
EMPTY_ROOT, | ||
@@ -51,5 +52,8 @@ GModelRoot, | ||
protected initializeDeferred = new Deferred<void>(); | ||
override initialize(): Promise<void> { | ||
if (!this.initialized) { | ||
this.initialized = this.doInitialize(); | ||
this.initialized = this.initializeDeferred.promise; | ||
this.doInitialize(); | ||
} | ||
@@ -60,9 +64,14 @@ return this.initialized; | ||
protected async doInitialize(): Promise<void> { | ||
if (this.actionHandlerRegistry instanceof GLSPActionHandlerRegistry) { | ||
this.actionHandlerRegistry.initialize(); | ||
try { | ||
if (this.actionHandlerRegistry instanceof GLSPActionHandlerRegistry) { | ||
this.actionHandlerRegistry.initialize(); | ||
} | ||
this.handleAction(SetModelAction.create(EMPTY_ROOT)).catch(() => { | ||
/* Logged in handleAction method */ | ||
}); | ||
this.startModelInitialization(); | ||
this.initializeDeferred.resolve(); | ||
} catch (error) { | ||
this.initializeDeferred.reject(error); | ||
} | ||
this.handleAction(SetModelAction.create(EMPTY_ROOT)).catch(() => { | ||
/* Logged in handleAction method */ | ||
}); | ||
this.startModelInitialization(); | ||
} | ||
@@ -69,0 +78,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
3664755
0.03%56820
0.03%