meganrogge / template-string-converter

Autocorrect from quotes to backticks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support multiple cursors

laymonage opened this issue · comments

Hi,

First of all, thanks for the extension, it's really helpful!

I encountered an issue when trying to use template strings with multiple cursors (e.g. press Shift + Alt + ↑/↓). If I type $ followed by {, I would lose all cursors except the last one, and only the last cursor will have the correct result (changing to ` and have the } automatically inserted).

Would it be possible to fix this in a future release?

Thanks!

Hey, this used to work. Thanks for bringing it to my attention. I'll look into the fix

Okay I think I know what's going on here actually the extension assumes that the lines have a proper end to them (like a semi-colon). It relies upon this as a way to distinguish whether or not the current change is within backticks.

This is to prevent conversion from happening for example in this case (multi-line):

`
${text}
`

recording - 2021-05-24T093650 476

Hey, sorry to bump, does this mean this extension doesn't have (and won't) support for multiple cursors when not using semi-colons?

@innocenzi that's correct. if there's a high demand for such a feature, I'll consider supporting it under a setting, but think that most use cases involve semi-colon terminated lines

I think semicolonless code is pretty common (eg. standardjs, or big projects like Vite), so I think this could be useful. But no big deal if you don't have the time for this