Any program or trick to find the definition of a variable?

前端 未结 8 1073
梦谈多话
梦谈多话 2021-01-02 09:01

Many times when I am watching others code I just want to find where and how a variable is defined. Normally what I do now is look for the type of the variable until I find t

8条回答
  •  甜味超标
    2021-01-02 09:28

    I use one of three methods:

    1. I will use CTags to process my source tree (nightly) and then can easily use commands in Vim (or other editors) to jump right to the definition.
    2. I will just use grep (linux) or findstr (windows) to look for all occurrences of the variable name or type. The definition is usually quite obvious.
    3. In Vim, you can just search backward in the scope and often find what you are looking for.

提交回复
热议问题