@@ -73,8 +73,11 @@ export class SettingsPanel {
7373 private static readonly viewType : string = 'settingsPanel' ;
7474 private static readonly title : string = 'C/C++ Configurations' ;
7575
76- // Used to workaround a VS Code bug in which webviewPanel.postMessage calls sometimes get dropped.
77- public firstUpdateReceived : boolean = false ;
76+ // Used to workaround a VS Code 1.56 regression in which webViewPanel.onDidChangeViewState
77+ // gets called before the SettingsApp constructor is finished running.
78+ // It repros with a higher probability in cases that cause a slower load,
79+ // such as after switching to a Chinese language pack or in the remote scenario.
80+ public initialized : boolean = false ;
7881
7982 constructor ( ) {
8083 this . disposable = vscode . Disposable . from (
@@ -94,6 +97,8 @@ export class SettingsPanel {
9497 return ;
9598 }
9699
100+ this . initialized = false ;
101+
97102 // Create new panel
98103 this . panel = vscode . window . createWebviewPanel (
99104 SettingsPanel . viewType ,
@@ -111,8 +116,6 @@ export class SettingsPanel {
111116 }
112117 ) ;
113118
114- this . firstUpdateReceived = false ;
115-
116119 this . panel . iconPath = vscode . Uri . file ( util . getExtensionFilePath ( "LanguageCCPP_color_128x.png" ) ) ;
117120
118121 this . disposablesPanel = vscode . Disposable . from (
@@ -216,7 +219,7 @@ export class SettingsPanel {
216219 private updateWebview ( configSelection : string [ ] , configuration : config . Configuration , errors : config . ConfigurationErrors | null ) : void {
217220 this . configValues = { ...configuration } ; // Copy configuration values
218221 this . isIntelliSenseModeDefined = ( this . configValues . intelliSenseMode !== undefined ) ;
219- if ( this . panel ) {
222+ if ( this . panel && this . initialized ) {
220223 this . panel . webview . postMessage ( { command : 'setKnownCompilers' , compilers : this . compilerPaths } ) ;
221224 this . panel . webview . postMessage ( { command : 'updateConfigSelection' , selections : configSelection , selectedIndex : this . configIndexSelected } ) ;
222225 this . panel . webview . postMessage ( { command : 'updateConfig' , config : this . configValues } ) ;
@@ -255,8 +258,9 @@ export class SettingsPanel {
255258 case 'knownCompilerSelect' :
256259 this . knownCompilerSelect ( ) ;
257260 break ;
258- case 'firstUpdateReceived' :
259- this . firstUpdateReceived = true ;
261+ case "initialized" :
262+ this . initialized = true ;
263+ this . settingsPanelActivated . fire ( ) ;
260264 break ;
261265 }
262266 }
0 commit comments