Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: VSCode autoclose for HTML causing wrap to occur twice #1

Closed
bgashler1 opened this issue Nov 23, 2017 · 6 comments
Closed

BUG: VSCode autoclose for HTML causing wrap to occur twice #1

bgashler1 opened this issue Nov 23, 2017 · 6 comments

Comments

@bgashler1
Copy link
Owner

From @GitLiamuk on September 8, 2017 9:2

VSCode version: 1.16.0 adds a html autoclose feature.

This feature causes this extension to wrap the selected text prematurely, resulting in faulty markup.

Copied from original issue: microsoft/vscode-htmltagwrap#15

@bgashler1
Copy link
Owner Author

From @dimkir on September 12, 2017 11:38

The "inner" </p> is added by autoclose..
image

@bgashler1
Copy link
Owner Author

From @bennyschaefer on September 22, 2017 11:8

htmltagwrap hasn't seen an update in about a year. I doubt we'll see a fix for this. But I did some testing and came up with this solution that works:

VSCode can do htmltagwrap without the extension. Here's how:

  1. Disable or remove the htmltagwrap extension
  2. File > Preferences > Keyboard Shortcuts
  3. Search for 'emmet wrap'
  4. Set Keybinding for 'Wrap Individual Lines with Abbreviation' to Alt + W (or whatever you desire)

There you go. The only difference is that you get to enter the desired tag instead of automatically getting a p-tag.

PS: I know this doesn't really contribute to a bugfix, but since there hasn't been any work on this extension in a while, and I really grew fond of its functionality (as did others), I felt comfortable sharing this workaround here in case anyone else misses the ease of adding tags to a selection.

PPS: I'm aware this kinda misuses the emmet wrap feature, but it still works. Definitely better than having to remove an auto-closed tag each time.

@bgashler1
Copy link
Owner Author

This bug is the result of a breaking change from the autoclose feature discussed in microsoft/vscode#2246 (comment). I'm looking into fixing this (and also on accepting the pull requests that have been sitting here for a while). Apologies for the neglect to this extension. I want to fix it up and deliver on the top requests. Thanks for your patience!

@bgashler1
Copy link
Owner Author

In the meantime, a workaround is using the setting

    "html.autoClosingTags": false

which will prevent the duplicate tag.

@bgashler1
Copy link
Owner Author

From @dreadsoul on October 3, 2017 13:13

I have also the same problem and think the following details will be useful:
1. if I do select a word then i get: <p></p>Lorem.</p>
2. if i do just Alt+W i have: </p><p>

Note: If I select more then 1 line the problem does not occur!

@bgashler1
Copy link
Owner Author

@GitLiamuk this should be fixed now. It was an issue with an emmet feature that was enabled by default in a recent VS Code release. I've updated the way htmltagwrap does its thing so that it doesn't trigger emmet to do duplicate work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant