-1
"test": {
        "prefix": "test",
        "body": "${1:hello} ${1:world}"
    }

Expected Result:

hello world

Current Result:

hello hello

I am trying to create snippet with same index and different placeholder but second placeholder change to first one when snippet called.

Case Scenario:

If I remove hello then world should be removed as well and If I don't change default hello then tabstop should goto next world. Then If I change world, hello shouldn't be effected.

This work great with Atom See this youtube video but not with vscode !!!

Wasim A.
  • 9,660
  • 22
  • 90
  • 120
  • You only have one tabstop so there is no going to the "next" `world`. I would say that using two different default placeholders for the same tabstop is unsupported. I could be wrong. Can you make animated gif showing the Atom behaviour? – Mark Oct 16 '19 at 20:46
  • https://youtu.be/SFY-5yMV634 – Wasim A. Oct 18 '19 at 18:15

1 Answers1

0

I figured it out myself at last, here it is,

"test": {
        "prefix": "test",
        "body": [
            "${1:hello} I am good",
            "how are ${1/^(?!\\s*$).+/world/}",
        ]
    },

$1 is hello and replace second clone with world which is also at $1, if no hello then no world as well.

Wasim A.
  • 9,660
  • 22
  • 90
  • 120