Skip to content

Commit 35c20bb

Browse files
committed
support csolution new merge messages accross path formats
1 parent b7df24b commit 35c20bb

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/solutions/solution-problems.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ describe('SolutionProblems', () => {
301301
});
302302
});
303303

304+
it('treats Windows-style merge paths as absolute', () => {
305+
expect(solutionProblems['isAbsoluteFilePath']('C:/CubeMX/CubeMX/RTE/CMSIS/RTX_Config.c')).toBe(true);
306+
expect(solutionProblems['isAbsoluteFilePath']('relative-config.c')).toBe(false);
307+
});
308+
304309
it('returns undefined merge diagnostic action for non-merge messages', () => {
305310
const result = solutionProblems['createMergeDiagnosticAction'](
306311
"component 'Arm::Device@2.3.4' is missing",

src/solutions/solution-problems.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,18 @@ export class SolutionProblemsImpl implements SolutionProblems {
355355
return vscode.Uri.parse(`command:${MERGE_FILE_COMMAND_ID}?${args}`);
356356
}
357357

358+
private isAbsoluteFilePath(filePath: string): boolean {
359+
return path.isAbsolute(filePath) || path.win32.isAbsolute(filePath);
360+
}
361+
358362
private createMergeDiagnosticAction(message: string, diagnosticFilePath: string): { message: string; code: NonNullable<vscode.Diagnostic['code']> } | undefined {
359363
const merge = this.parseMergeMessage(message);
360364
if (!merge) {
361365
return undefined;
362366
}
363367

364368
const componentId = mergeComponentRegex.exec(message)?.[1];
365-
const localPath = path.isAbsolute(merge.localPath) ? merge.localPath : diagnosticFilePath;
369+
const localPath = this.isAbsoluteFilePath(merge.localPath) ? merge.localPath : diagnosticFilePath;
366370
const formattedMessage = this.createMergeDiagnosticMessage(localPath, merge.updateLevel, componentId);
367371

368372
return {

0 commit comments

Comments
 (0)