kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
3.18k stars 62 forks source link

Visual surround with tag doesn't work #71

Closed benfrain closed 2 years ago

benfrain commented 2 years ago

Checklist

Describe the bug Given text like this in a TS file:

return html`${this.theEvent.opp.oddsPre} ${this.theEvent.opp.odds}`

If I select one of the ${} blocks visually and then use ST and type '\<span>' and press enter, nothing happens. The 'Enter an HTML tag: ` remains in the command line but the buffer does not update.

Expected behavior Give what the expected buffer output should be after the keystroke sequence.

return html`<span>${this.theEvent.opp.oddsPre}</span> ${this.theEvent.opp.odds}`

Additional context Wondered if this was related to Dressing, but have removed that from my config and problem remains.

kylechui commented 2 years ago

Hi @benfrain, it looks like my messages might have been a bit unclear; when it asks for the tag you don't need the opening and closing <, > markers. However, I'll still implement it so that it works with the angle brackets on a new branch fix-html-patterns. If there's anything else you'd like to mention, don't hesitate to do so

benfrain commented 2 years ago

I think the existing implementation is actually fine, it just wasn't what I expected coming from tpope's surround. Perhaps just detail that needs adding in the readme? I'm happy to add a little there if it saves you adding more code and let's you deal with actual bugs rather than just 'different' way of doing things?

kylechui commented 2 years ago

I'm currently working on a massive overhaul of how this project is documented/how features are shared, to better help people understand the feature set/what the defaults are. I also hold the design philosophy that the best design is the one that you don't notice; e.g. in this case ideally you wouldn't need any explanation to know how to use it. Also for this particular use case it's only a few characters so don't worry about it too much :) I would also ask that you try out branch refactor-code, as I also did an overhaul of the internals and will be making most commits there, before merging that branch into main. Thanks!

P.S. Feel free to re-open this issue if necessary.