Skip to content

Commit 54bf446

Browse files
authored
Merge pull request #7658 from microsoft/1_4_1
1.4.1
2 parents 1ad52f9 + ecfe50b commit 54bf446

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

Extension/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# C/C++ for Visual Studio Code Change Log
22

3+
## Version 1.4.1: June 8, 2021
4+
* Fix the configuration UI sometimes not populating initially with VS Code 1.56 or later. [#7641](https://github.com/microsoft/vscode-cpptools/issues/7641)
5+
36
## Version 1.4.0: May 27, 2021
47
### New Features
58
* Add a C++ walkthrough to the "Getting Started" page. [#7273](https://github.com/microsoft/vscode-cpptools/issues/7273)

Extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cpptools",
33
"displayName": "C/C++",
44
"description": "C/C++ IntelliSense, debugging, and code browsing.",
5-
"version": "1.4.0-main",
5+
"version": "1.4.1-main",
66
"publisher": "ms-vscode",
77
"icon": "LanguageCCPP_color_128x.png",
88
"readme": "README.md",

Extension/src/LanguageServer/configurations.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,11 @@ export class CppProperties {
975975
const settings: CppSettings = new CppSettings(this.rootUri);
976976
this.settingsPanel = new SettingsPanel();
977977
this.settingsPanel.setKnownCompilers(this.knownCompilers, settings.preferredPathSeparator);
978-
this.settingsPanel.SettingsPanelActivated(() => this.onSettingsPanelActivated());
978+
this.settingsPanel.SettingsPanelActivated(() => {
979+
if (this.settingsPanel?.initialized) {
980+
this.onSettingsPanelActivated();
981+
}
982+
});
979983
this.settingsPanel.ConfigValuesChanged(() => this.saveConfigurationUI());
980984
this.settingsPanel.ConfigSelectionChanged(() => this.onConfigSelectionChanged());
981985
this.settingsPanel.AddConfigRequested((e) => this.onAddConfigRequested(e));
@@ -1025,14 +1029,9 @@ export class CppProperties {
10251029
if (this.settingsPanel.selectedConfigIndex >= this.configurationJson.configurations.length) {
10261030
this.settingsPanel.selectedConfigIndex = this.CurrentConfigurationIndex;
10271031
}
1028-
setTimeout(() => {
1029-
if (this.settingsPanel && this.configurationJson) {
1030-
this.settingsPanel.updateConfigUI(configNames,
1031-
this.configurationJson.configurations[this.settingsPanel.selectedConfigIndex],
1032-
this.getErrorsForConfigUI(this.settingsPanel.selectedConfigIndex));
1033-
}
1034-
},
1035-
500); // Need some delay or the UI can randomly be blank, particularly in the remote scenario.
1032+
this.settingsPanel.updateConfigUI(configNames,
1033+
this.configurationJson.configurations[this.settingsPanel.selectedConfigIndex],
1034+
this.getErrorsForConfigUI(this.settingsPanel.selectedConfigIndex));
10361035
} else {
10371036
// Parse failed, open json file
10381037
vscode.workspace.openTextDocument(this.propertiesFile);

Extension/src/LanguageServer/settingsPanel.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ 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 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;
81+
7682
constructor() {
7783
this.disposable = vscode.Disposable.from(
7884
this.settingsPanelActivated,
@@ -91,6 +97,8 @@ export class SettingsPanel {
9197
return;
9298
}
9399

100+
this.initialized = false;
101+
94102
// Create new panel
95103
this.panel = vscode.window.createWebviewPanel(
96104
SettingsPanel.viewType,
@@ -211,7 +219,7 @@ export class SettingsPanel {
211219
private updateWebview(configSelection: string[], configuration: config.Configuration, errors: config.ConfigurationErrors | null): void {
212220
this.configValues = {...configuration}; // Copy configuration values
213221
this.isIntelliSenseModeDefined = (this.configValues.intelliSenseMode !== undefined);
214-
if (this.panel) {
222+
if (this.panel && this.initialized) {
215223
this.panel.webview.postMessage({ command: 'setKnownCompilers', compilers: this.compilerPaths });
216224
this.panel.webview.postMessage({ command: 'updateConfigSelection', selections: configSelection, selectedIndex: this.configIndexSelected });
217225
this.panel.webview.postMessage({ command: 'updateConfig', config: this.configValues });
@@ -250,6 +258,10 @@ export class SettingsPanel {
250258
case 'knownCompilerSelect':
251259
this.knownCompilerSelect();
252260
break;
261+
case "initialized":
262+
this.initialized = true;
263+
this.settingsPanelActivated.fire();
264+
break;
253265
}
254266
}
255267

Extension/ui/settings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ class SettingsApp {
8181
document.getElementById(elementId.advancedSection).style.display = advancedShown ? "block" : "none";
8282
document.getElementById(elementId.showAdvanced).classList.toggle(advancedShown ? "collapse" : "expand", true);
8383
document.getElementById(elementId.showAdvanced).addEventListener("click", this.onShowAdvanced.bind(this));
84+
this.vsCodeApi.postMessage({
85+
command: "initialized"
86+
});
8487
}
8588

8689
private addEventsToInputValues(): void {

0 commit comments

Comments
 (0)