From f0f14feb3702556393cb16cf41f072cea92c94ab Mon Sep 17 00:00:00 2001 From: Rajeshwar Singh <132039556+Raj4478@users.noreply.github.com> Date: Sat, 27 Sep 2025 12:22:16 +0000 Subject: [PATCH] fixed Color highlight in xml closing tag --- src/basic-languages/xml/xml.test.ts | 15 +++++++++++++++ src/basic-languages/xml/xml.ts | 12 ++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/basic-languages/xml/xml.test.ts b/src/basic-languages/xml/xml.test.ts index 8f2bdc5c..333edaf2 100644 --- a/src/basic-languages/xml/xml.test.ts +++ b/src/basic-languages/xml/xml.test.ts @@ -301,6 +301,21 @@ testTokenization('xml', [ } ], + // End Tag with Newline Before Closing Bracket + [ + { + line: '', + tokens: [{ startIndex: 0, type: 'delimiter.xml' }] + } + ], + // Comments [ { diff --git a/src/basic-languages/xml/xml.ts b/src/basic-languages/xml/xml.ts index 016fc57c..c1266ed8 100644 --- a/src/basic-languages/xml/xml.ts +++ b/src/basic-languages/xml/xml.ts @@ -54,12 +54,7 @@ export const language = { [/(<)(@qualifiedName)/, [{ token: 'delimiter' }, { token: 'tag', next: '@tag' }]], // Standard closing tag - [ - /(<\/)(@qualifiedName)(\s*)(>)/, - [{ token: 'delimiter' }, { token: 'tag' }, '', { token: 'delimiter' }] - ], - - // Meta tags - instruction + [/(<\/)(@qualifiedName)/, [{ token: 'delimiter' }, { token: 'tag', next: '@closeTag' }]], // Meta tags - instruction [/(<\?)(@qualifiedName)/, [{ token: 'delimiter' }, { token: 'metatag', next: '@tag' }]], // Meta tags - declaration @@ -77,6 +72,11 @@ export const language = { [/\]/, ''] ], + closeTag: [ + [/[ \t\r\n]+/, ''], + [/>/, { token: 'delimiter', next: '@pop' }] + ], + tag: [ [/[ \t\r\n]+/, ''], [/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/, ['attribute.name', '', 'attribute.value']],