Comment out flutter print statements in vs code

448

Actually, this worked pretty nicely:

Find: ^(\s*)print

Replace: $1// print

Looks like we don't need to use back references in vs code. And remember to turn the little .* icon ON to allow regex search/replace.

Share:
448
K Vij
Author by

K Vij

Updated on December 14, 2022

Comments

  • K Vij
    K Vij over 1 year

    I would like to comment out all the print statements in my flutter code. I am using VS Code. I would also like to preserve the spacing if possible. I have tried some regular expressions but I am not able to capture the space before he print statement. Would anyone know the regex for find/replace in VS code to do this?

    I am trying this ^(\s)*\1print, but it says back references not allowed?

  • K Vij
    K Vij over 4 years
    somebody should make a vs code extension to do this