formulahendry / vscode-auto-rename-tag

Automatically rename paired HTML/XML tag
https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag
MIT License
258 stars 36 forks source link

Renaming wrong tag when code is not valid #73

Open KristerV opened 5 years ago

KristerV commented 5 years ago

Imgur video example

The plugin shouldn't rename anything if the file isn't valid in the first place. In this example I caught the problem red-handed, but a lot of the time this problem arises when editing a 300 line file and it renames the top tag for whatever reason and creates a lot of problems that take time to debug.

tdd commented 5 years ago

Pairing needs to be rewritten, the current regex approach is massively faulty. VSCode does have some builtin pairing, not sure it's accessible to extensions, but that's our only valid hope, as relying on AST parsing would bind us to specific main-file syntaxes, which is very limitative.