meganrogge/template-string-converter

should not convert quotes already in template literal

Closed this issue · 6 comments

I just noticed when you have something like

html`<span class="">`

the plugin wrongly detects the inner " quotes and converts them to ` when typing ${ inside, so the above turns into

html`<span class=`${}`>`

which is invalid code

This extension shouldn’t work for html files. I will look into this.

I don't think the tagged template is detected as html file just because the function is named html. I am using lit-html by the way.

Oh okay that’s helpful to know. I think I know how to solve this and will implement the fix soon.

resolved in 0.1.3 which should be available in a few minutes.

Hey, thanks for the quick fix. I just noticed that it is still a problem in multiline template literals.

const foo = `
  ""
`;

will result in

const foo = `
  `${}`
`;

At this time multiline isn’t supported. I might work on that soon though.