meganrogge / template-string-converter

Autocorrect from quotes to backticks
MIT License
194 stars 24 forks source link

Converting strings that contain backticks? #26

Closed JacksonKearl closed 3 years ago

JacksonKearl commented 3 years ago

This is a bit specific so feel free to *out-of-scope, but it'd be nice if this could turn:

content = '```${'

into

content = `\`\`\`${}`
meganrogge commented 3 years ago

not sure I understand the use case.....

JacksonKearl commented 3 years ago

It's a narrow use case, but I needed to build markdown strings using templates.

meganrogge commented 3 years ago

it does seem out of scope to me, but I could always add a setting that looks for this specific case. do you think others would find it useful?

JacksonKearl commented 3 years ago

I don't think there's much value to adding this as a specific case, but in general I'd expect it to still work if the string contains backtics and simply escape them.

meganrogge commented 3 years ago

I think most people don't want this to work if they're within backticks, such as #23 .

JacksonKearl commented 3 years ago

That's a different thing, what I'm taking about is

const a = 'this has some internal `backticks` and I'd like to insert a substitution ${'

to

const a = `this has some internal \`backticks\` and I'd like to insert a substitution ${}`
meganrogge commented 3 years ago

I think this is out of scope for now because the extension primarily focuses on the presence of quotes around the ${ as a precursor to any replacement. Thanks for the idea though.