skip to Main Content

While trying to add the @typechecked property above all (of the 487) functions, I was experiencing some difficulties with finding the right replace command. I intend to go from:

    def some_function(

to:

    @typechecked
    def some_function(

However, when I do Ctrl+H and replace def with:

@typechecked
def 

The indentation of the def gets lost.

Hence I would like to ask:
How can I add the property typechecked above all functions in all .py` files in vscode?

2

Answers


  1. use

    Find: ^(s*)def

    Replace: $1@typecheckedn$1def

    Login or Signup to reply.
  2. Do a find/replace in VSCode with the following find and replace values:

         find: ^(s*)(def [w_]+()
      replace: $1@typecheckedn$1$2
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search