I believe that this isn't duplicate. The suggested answer recomennds to use an extention, but I want to use the official feature from vscode.
I have this code:
{
id: 1,
name: 'Ken'
},
{
id: 1,
name: 'Ryu'
},
{
id: 1,
name: 'Vega'
},
I want to make it into this:
{
id: 1,
name: 'Ken'
},
{
id: 2,
name: 'Ryu'
},
{
id: 3,
name: 'Vega'
},
I did some research on it, and turns out I can use a feature 'find' and 'replace' in vs code. You can access it from the menu bar 'Edit'.
In the find box, I put 'id: \d+', and in the replace, I put 'id: $[${++counter}]'. However, vs code doesn't recognize the expression. It just prints out 'id: $[${++counter}]', not like 'id: 1, id: 2...' and so on.
I don't even know if the way I did was correct or not...
Is there anyone who knows how to do it correctly? Thank you in advance.