@@ -12,6 +12,7 @@ import { DbModelingState, ModelingStore } from "../modeling-store";
12
12
import { AbstractWebviewViewProvider } from "../../common/vscode/abstract-webview-view-provider" ;
13
13
import { assertNever } from "../../common/helpers-pure" ;
14
14
import { ModelEditorViewTracker } from "../model-editor-view-tracker" ;
15
+ import { showMultipleModels } from "../../config" ;
15
16
16
17
export class MethodModelingViewProvider extends AbstractWebviewViewProvider <
17
18
ToMethodModelingMessage ,
@@ -29,11 +30,20 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
29
30
super ( app , "method-modeling" ) ;
30
31
}
31
32
32
- protected override onWebViewLoaded ( ) : void {
33
- this . setInitialState ( ) ;
33
+ protected override async onWebViewLoaded ( ) : Promise < void > {
34
+ await Promise . all ( [ this . setViewState ( ) , this . setInitialState ( ) ] ) ;
34
35
this . registerToModelingStoreEvents ( ) ;
35
36
}
36
37
38
+ private async setViewState ( ) : Promise < void > {
39
+ await this . postMessage ( {
40
+ t : "setMethodModelingPanelViewState" ,
41
+ viewState : {
42
+ showMultipleModels : showMultipleModels ( ) ,
43
+ } ,
44
+ } ) ;
45
+ }
46
+
37
47
public async setMethod ( method : Method ) : Promise < void > {
38
48
this . method = method ;
39
49
@@ -45,11 +55,11 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
45
55
}
46
56
}
47
57
48
- private setInitialState ( ) : void {
58
+ private async setInitialState ( ) : Promise < void > {
49
59
if ( this . modelingStore . hasStateForActiveDb ( ) ) {
50
60
const selectedMethod = this . modelingStore . getSelectedMethodDetails ( ) ;
51
61
if ( selectedMethod ) {
52
- void this . postMessage ( {
62
+ await this . postMessage ( {
53
63
t : "setSelectedMethod" ,
54
64
method : selectedMethod . method ,
55
65
modeledMethod : selectedMethod . modeledMethod ,
@@ -64,7 +74,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
64
74
) : Promise < void > {
65
75
switch ( msg . t ) {
66
76
case "viewLoaded" :
67
- this . onWebViewLoaded ( ) ;
77
+ await this . onWebViewLoaded ( ) ;
68
78
break ;
69
79
70
80
case "telemetry" :
0 commit comments