From 362f321afed60a28be7ce767626fa56c5117e031 Mon Sep 17 00:00:00 2001 From: Jen-Tse Huang Date: Wed, 8 Apr 2026 10:42:30 +0200 Subject: [PATCH 1/3] Show discoverLayers errors in Problems --- src/solutions/solution-converter.test.ts | 20 ++++++++++++++++++++ src/solutions/solution-converter.ts | 14 +++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/solutions/solution-converter.test.ts b/src/solutions/solution-converter.test.ts index 8072c412..366de7e4 100644 --- a/src/solutions/solution-converter.test.ts +++ b/src/solutions/solution-converter.test.ts @@ -293,6 +293,26 @@ describe('SolutionConverter', () => { ); }); + it('reports discoverLayers failure through toolsOutputMessages', async () => { + mockCsolutionService.convertSolution.mockResolvedValue({ + success: false, + undefinedLayers: ['$Board-Layer'], + }); + mockCsolutionService.discoverLayers.mockResolvedValue({ + success: false, + message: 'No compatible software layer found.' + }); + await fireAndWaitForConversion(); + + expect(completedListener).toHaveBeenCalledWith( + expect.objectContaining({ + severity: 'error', + detection: false, + toolsOutputMessages: expect.arrayContaining(['error csolution: No compatible software layer found.']), + }) + ); + }); + it('run solution convert and check whether to update compile commands', async () => { const mockRunCbuildSetup = jest.spyOn(compileCommandsGenerator, 'runCbuildSetup').mockResolvedValue([true,[]]); mockCSolution.getContextDescriptors = jest.fn().mockReturnValue([{ displayName: 'context' }]); diff --git a/src/solutions/solution-converter.ts b/src/solutions/solution-converter.ts index c745aefa..bfe965e8 100644 --- a/src/solutions/solution-converter.ts +++ b/src/solutions/solution-converter.ts @@ -162,7 +162,12 @@ export class SolutionConverterImpl implements SolutionConverter { // compilers and variables detection handling: apply select-compiler and discover layer configurations if any csolution?.setSelectCompiler(convertResult.selectCompiler); - detection = (!!convertResult.undefinedLayers && await this.checkDiscoverLayers()) || !!convertResult.selectCompiler; + if (convertResult.undefinedLayers) { + const [discoverLayersDetected, discoverLayersOutput] = await this.checkDiscoverLayers(); + detection = discoverLayersDetected; + toolsOutputMessages = toolsOutputMessages.concat(discoverLayersOutput); + } + detection = detection || !!convertResult.selectCompiler; } let logResult = undefined; @@ -244,7 +249,7 @@ export class SolutionConverterImpl implements SolutionConverter { return formattedOutput; } - private async checkDiscoverLayers(): Promise { + private async checkDiscoverLayers(): Promise<[boolean, string[]]> { const outputChannel = this.outputChannelProvider.getOrCreate(manifest.CMSIS_SOLUTION_OUTPUT_CHANNEL); this.solutionManager.getCsolution()?.setVariablesConfigurations(undefined); // rpc method: DiscoverLayers @@ -257,7 +262,10 @@ export class SolutionConverterImpl implements SolutionConverter { } ) as rpc.DiscoverLayersInfo; this.solutionManager.getCsolution()?.setVariablesConfigurations(result.configurations); - return result.success; + + const formattedOutput = !result.success && result.message ? [`error csolution: ${result.message}`] : []; + + return [result.success, formattedOutput]; } private getSeverity(messages: rpc.LogMessages, lines?: string[]): Severity { From 370440cf5f871fb0bc53784241d5c43e805d8463 Mon Sep 17 00:00:00 2001 From: Jen-Tse Huang Date: Wed, 8 Apr 2026 11:01:31 +0200 Subject: [PATCH 2/3] Suggestions by Copilot --- src/solutions/solution-converter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solutions/solution-converter.ts b/src/solutions/solution-converter.ts index bfe965e8..caf0dd37 100644 --- a/src/solutions/solution-converter.ts +++ b/src/solutions/solution-converter.ts @@ -263,7 +263,7 @@ export class SolutionConverterImpl implements SolutionConverter { ) as rpc.DiscoverLayersInfo; this.solutionManager.getCsolution()?.setVariablesConfigurations(result.configurations); - const formattedOutput = !result.success && result.message ? [`error csolution: ${result.message}`] : []; + const formattedOutput = !result.success && result.message ? [`error csolution: ${result.message.trim()}`] : []; return [result.success, formattedOutput]; } From dc293f4126873ee2e96327e4e8b00e66796754bb Mon Sep 17 00:00:00 2001 From: Jen-Tse Huang Date: Wed, 8 Apr 2026 11:15:03 +0200 Subject: [PATCH 3/3] Remove new linces --- src/solutions/solution-converter.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/solutions/solution-converter.ts b/src/solutions/solution-converter.ts index caf0dd37..d935cef5 100644 --- a/src/solutions/solution-converter.ts +++ b/src/solutions/solution-converter.ts @@ -262,9 +262,7 @@ export class SolutionConverterImpl implements SolutionConverter { } ) as rpc.DiscoverLayersInfo; this.solutionManager.getCsolution()?.setVariablesConfigurations(result.configurations); - const formattedOutput = !result.success && result.message ? [`error csolution: ${result.message.trim()}`] : []; - return [result.success, formattedOutput]; }