vscode-auto-close-tag
vscode-auto-close-tag copied to clipboard
Result regex not matching closed tag
Hello! Thank you for your work on this project.
I wanted to report an issue I encountered while I was investigating why the extension stopped working for me.
When typing the following snippet the tag won't autoclose.
<div></div>
After some debugging, I found out this regex
https://github.com/formulahendry/vscode-auto-close-tag/blob/49da90ac0a264f3db40a5e79a8eda72f0a75152c/src/extension.ts#L80
is returning null.
if (((!isSublimeText3Mode || isFullMode) && isRightAngleBracket) ||
(enableAutoCloseSelfClosingTag && event.contentChanges[0].text === "/")) {
let textLine = editor.document.lineAt(selection.start);
let text = textLine.text.substring(0, selection.start.character + 1);
console.log(text, "TEXT")
let result = /<([a-zA-Z][a-zA-Z0-9:\-_.]*)(?:\s+[^<>]*?[^\s/<>=]+?)*?\s?(\/|>)$/.exec(text);
console.log(result, "RESULT")

I believe being familiar with this regex you would be able to fix it very easily.
Thank you!