Skip to content

Commit 1737f99

Browse files
committed
Address copilot suggestions
1 parent e7d082b commit 1737f99

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/solutions/solution-converter.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ export class SolutionConverterImpl implements SolutionConverter {
141141

142142
let detection = false;
143143
let convertResult: rpc.ConvertSolutionResult = { success: false };
144+
let availableCompilers: string[] = [];
145+
let availableConfigurations: rpc.VariablesConfiguration[] | undefined;
144146
if (!missingPacksResult || missingPacksResult.success) {
145147
// rpc method: ConvertSolution
146148
outputChannel.append('Convert solution... ');
@@ -158,20 +160,15 @@ export class SolutionConverterImpl implements SolutionConverter {
158160
}
159161

160162
// compilers and variables detection: gather locally and emit configure event
161-
const availableCompilers = convertResult.selectCompiler ?? [];
163+
availableCompilers = convertResult.selectCompiler ?? [];
162164
detection = availableCompilers.length > 0;
163-
let availableConfigurations: rpc.VariablesConfiguration[] | undefined;
164165
if (convertResult.undefinedLayers) {
165166
const result = await this.checkDiscoverLayers();
166167
const discoverLayersOutput = !result.success && result.message ? [`error csolution: ${result.message.trim()}`] : [];
167168
toolsOutputMessages = toolsOutputMessages.concat(discoverLayersOutput);
168169
availableConfigurations = result.configurations;
169170
detection = detection || result.success;
170171
}
171-
if (detection) {
172-
// compilers and variables detection handling: apply select-compiler and discover layer configurations if any
173-
this.eventHub.fireConfigureSolutionDataReady({ availableCompilers, availableConfigurations });
174-
}
175172
}
176173

177174
let logResult = undefined;
@@ -216,6 +213,10 @@ export class SolutionConverterImpl implements SolutionConverter {
216213
logMessages: logResult,
217214
toolsOutputMessages,
218215
});
216+
// compilers and variables detection handling:
217+
// apply select-compiler and discover layer configurations, reset state otherwise
218+
this.eventHub.fireConfigureSolutionDataReady({ availableCompilers, availableConfigurations });
219+
219220
}
220221

221222
private async printErrorsWarnings(messages?: rpc.LogMessages): Promise<void> {

src/views/manage-layers/manage-layers-webview-main.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ export class ManageLayersWebviewMain {
100100
this.webviewManager.sendMessage({ type: 'PLATFORM', data: { name: 'vscode' } });
101101
}
102102

103-
104103
private async applyOrChangeLayer(layer: TargetConfiguration) {
105104
const csolution = this.solutionManager.getCsolution();
106105

@@ -130,6 +129,7 @@ export class ManageLayersWebviewMain {
130129
}
131130
}
132131
});
132+
this.latestConfigureData = undefined;
133133
await copyLayerToProject(layer, csolution.solutionDir); // first copy layer files
134134
await csolution.csolutionYml.save(); // then save csolution.yml
135135
}
@@ -170,16 +170,19 @@ export class ManageLayersWebviewMain {
170170
}
171171

172172
private onConfigureSolutionDataReady(data: ConfigureSolutionData): void {
173-
this.latestConfigureData = data;
174-
this.getDataUserChoice();
173+
if (data.availableCompilers.length === 0 && !data.availableConfigurations) {
174+
this.latestConfigureData = undefined;
175+
} else {
176+
177+
this.latestConfigureData = data;
178+
this.getDataUserChoice();
179+
}
175180
}
176181

177182
private showPanel(show: boolean) {
178-
if (!show) {
179-
return;
183+
if (show) {
184+
this.webviewManager.createOrShowPanel();
180185
}
181-
182-
this.webviewManager.createOrShowPanel();
183186
}
184187

185188
private sendConfigurations(configurations: VariablesConfiguration[] | undefined, activeTarget: string, avComps: string[]) {

0 commit comments

Comments
 (0)