From 26c15511ebe97a44708c775d8bcec1f43cadffb9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Jul 2026 19:25:59 +0000 Subject: [PATCH 1/4] Initial plan From c05a712d6a7c2041ed018b0648cd0200fbf1a2cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Jul 2026 19:36:50 +0000 Subject: [PATCH 2/4] Add diagnostic and fix transpile for mismatched XML tags - Added xmlTagMismatch diagnostic message (code 1155) - Modified SGParser to capture and validate closing tag names - Updated SGTag and subclasses to store optional closingTag - Added diagnostic when opening/closing tags mismatch - Transpile always uses opening tag name for closing tag - Added comprehensive tests for both diagnostic and transpile behavior - All existing tests pass Co-authored-by: TwitchBronBron <2544493+TwitchBronBron@users.noreply.github.com> --- src/DiagnosticMessages.ts | 5 +++ src/files/XmlFile.spec.ts | 67 +++++++++++++++++++++++++++++++++++++ src/parser/SGParser.spec.ts | 19 +++++++++++ src/parser/SGParser.ts | 50 +++++++++++++++++++-------- src/parser/SGTypes.ts | 38 ++++++++++++--------- 5 files changed, 150 insertions(+), 29 deletions(-) diff --git a/src/DiagnosticMessages.ts b/src/DiagnosticMessages.ts index cd81e60bc..2a7c3b0a1 100644 --- a/src/DiagnosticMessages.ts +++ b/src/DiagnosticMessages.ts @@ -382,6 +382,11 @@ export let DiagnosticMessages = { code: 1070, severity: DiagnosticSeverity.Error }), + xmlTagMismatch: (openingTag: string, closingTag: string) => ({ + message: `Mismatched closing tag: expected '' but found ''`, + code: 1155, + severity: DiagnosticSeverity.Error + }), expectedLabelIdentifierAfterGotoKeyword: () => ({ message: `Expected label identifier after 'goto' keyword`, code: 1071, diff --git a/src/files/XmlFile.spec.ts b/src/files/XmlFile.spec.ts index 44d1700ee..9d6b0069d 100644 --- a/src/files/XmlFile.spec.ts +++ b/src/files/XmlFile.spec.ts @@ -669,6 +669,73 @@ describe('XmlFile', () => { `, 'none', 'components/Comp.xml'); }); + it('transpiles mismatched tags correctly using opening tag', () => { + const file = program.setFile('components/Comp.xml', trim` + + + + + + + + `); + file.needsTranspiled = true; + program.validate(); + + // Should have a diagnostic for the mismatch + expect(file.diagnostics).to.have.lengthOf(1); + expect(file.diagnostics[0]).to.deep.include({ + ...DiagnosticMessages.xmlTagMismatch('Group', 'LayoutGroup') + }); + + // But transpile should still work correctly (self-closing since no children) + const transpiled = file.transpile(); + expect(trimMap(transpiled.code)).to.equal(trim` + + +