olvenmage
olvenmage

Reputation: 485

Vscode escaping a slash before using a variable

I was checking out the VS Code snippets the other day, and upon wanting to create a certain snippet I stumbled upon this problem:

"body": [
            "test=\"some\\path\\$1\""
        ]

I want to escape the slash after 'path' but I dont want to escape the variable, which does now happen since it's the same notation as \$. But I want to escape the slash and just let my $1 be.

Any ideas on how to "unescape" this? I tried doing the string separately, but I couldnt find a way to concatenate strings either!

Help would be appreciated :)

Upvotes: 1

Views: 1226

Answers (1)

Mark
Mark

Reputation: 182046

I think you want:

"test=\"some\\path\\\\$1\""

this gives:

test="some\path\[cursor here]"

Upvotes: 1

Related Questions