Edit: I just tried this in the VSVim extension in VS2019, and it worked as expected. I'm starting to think that VSCodeVim extension for VSCode doesn't handle captures properly?
I am trying to search my typescript file for a list of variables that have not yet been assigned an initial value, and set it to = null
.
private __requestor: Req;
private __feedback: FeedbackObject;
private __dueDate: Calendar = null;
private __priority: number = NaN;
private __bigTest = TestObject;
I am using the following command:
:%s/(: [a-zA-Z]+);/\1 = null;/g
I expect the output to stick = null
on lines 1, 2 and 5, but instead it sticks a \1
.
Expected:
private __requestor: Req = null;
private __feedback: FeedbackObject = null;
private __dueDate: Calendar = null;
private __priority: number = NaN;
private __bigTest: TestObject = null;
Actual:
private __requestor\1 = null;
private __feedback\1 = null;
private __dueDate: Calendar = null;
private __priority: number = NaN;
private __bigTest\1 = null;
Is there something wrong with my regex/search & replace command? It looks similar to the other S&R commands that use capture groups in examples I've seen, and I haven't seen any settings for "enabling" capture groups.