formulahendry / vscode-auto-close-tag

Auto Close Tag for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag
MIT License
179 stars 53 forks source link

typescript - don't autoclose type arguments #181

Closed oldo closed 4 years ago

oldo commented 4 years ago

When using this extension in Typescript files, type arguments are detected as HTML and autoclosed, which means that I have to manually delete the erroneously created tag.

2020-06-14 12 07 50

I know that I could disable the extension on .ts and .tsx files, however the autoclosing functionality is still useful in these files when working on React project.

Is there a way that the extension can detect when the tags being created are TS type arguments and not autoclose in this situation?

mwisnicki commented 4 years ago

See #24 how to cope but this should really be working out of the box as it's super annoying in most popular languages.

@formulahendry Is there any good reason why default activation list is not limited to markup based languages?

JulioC commented 4 years ago

The solution on #24 totally disables autoclose on tsx, which is not the desirable behavior.

Would it be possible to use some language context to decide when to close a tag or not?

mwisnicki commented 4 years ago

I believe a proper solution to that problem is tracked in Microsoft/vscode#1751 but perhaps some hack could be implemented in the meantime.

tusharsadhwani commented 4 years ago

Bump, hope this can be fixed soon.

tusharsadhwani commented 4 years ago

Okay, the fix for me was that vscode has builtin support for auto closing tags. Just got rid of this extension.

P.S. auto rename is also builtin now, both of these plugins are obsolete i guess 🙃

JulioC commented 4 years ago

Adding to @tusharsadhwani update:

There's a VSCode settings called editor.renameOnType, which rename the matching close tag as you type. It only works on HTML at this point. There is an open issue for supporting other languages: https://github.com/microsoft/vscode/issues/94316

The auto closing feature is done using html.autoClosingTags, typescript.autoClosingTags or javascript.autoClosingTags

This does make the plugin obsolete for me, and solve the original issue. Thanks for pointing that out!

oldo commented 4 years ago

Thanks @tusharsadhwani & @JulioC Issue is resolved by your suggestions.

Thank you @formulahendry for developing the extension which has been useful to me over the past couple of years 👍