Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VS code add parameter to a function and add it to every call of the function

Is it possible in VS Code to add a new parameter to my function so like my functions is test(value1) and now i want to add another parameter so test(value1, value2). Can i then say everywhere where this function is called i want value 2 to be 0?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can use a regular expression with a capture group

test\((.*)\)

then replace using that capture group plus your default variable

test($1, 0)

using this Find and Replace (with Regular Expression enabled) this

test(value1)
test(other)
test(again)

will become

test(value1, 0)
test(other, 0)
test(again, 0)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading