Skip to content

Commit 6baae50

Browse files
wangxi761wangxi
andauthored
fix the error that "/" in attribute value make indentation problem (#985)
* fix xml non self closing tags can not match "/" in attribute value * Optimized indented regular expressions, borrowed from html pattern --------- Co-authored-by: wangxi <[email protected]>
1 parent d4db83a commit 6baae50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/client/indentation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export function getIndentationRules(): LanguageConfiguration {
1111
},
1212
onEnterRules: [
1313
{
14-
beforeText: new RegExp(`<([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
15-
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>/i,
14+
beforeText: /<(?:[_:\w][_:\w\-.\d]*)(?:(?:[^'"/>]|"[^"]*"|'[^']*')*?(?!\/)>)[^<]*$/i,
15+
afterText: /^<\/(?:[_:\w][_:\w-.\d]*)\s*>/i,
1616
action: { indentAction: IndentAction.IndentOutdent }
1717
},
1818
{
19-
beforeText: new RegExp(`<(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
19+
beforeText: /<(?:\w[\w\d]*)(?:(?:[^'"/>]|"[^"]*"|'[^']*')*?(?!\/)>)[^<]*$/i,
2020
action: { indentAction: IndentAction.Indent }
2121
}
2222
]

0 commit comments

Comments
 (0)