meganrogge / template-string-converter

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

Allow using just `$` #86

Open Dimava opened 1 year ago

Dimava commented 1 year ago

Compared to literal $ in strings I use ${} much, much more And I definetly never want to remove on the content when typing $ over a selection

I would like the extension to autocomplete {} brackets for me when I write just $

s = `abcd|efg${123}h`
// type `$`
s = `abcd${|}efg${123}h`

// extended: also convert to template string
s = "abcd|efgh"
// type `$`
s = `abcd${|}efgh`

// selection: surround on $
s = "abc|def|gh"
// type `$`
s = `abc${|def|}gh`
Ptujec commented 1 year ago

I have a snippet that lets me complete $ to ${}.

"Template Literal": {
        "prefix": "$TemplateLiteral",
        "body": [
            "\\${$1\\}"
        ],
        "description": "Insert Template Literal"
    }

Unfortunately when using it this extension does not work.