Wing Tips: Navigating Python Code with Wing (part 2 of 3)

Nov 21, 2019


Last week we looked at goto-definition, find uses, and project-wide search as tools for navigating Python code in Wing. This time, we'll take a look at the code indices that Wing provides.

Code Index Menus

A quick way to navigate code in the current Python file is to use the source index menus shown at the top of the editor:

/images/blog/code-navigation/index-menus.png

Depending on the location of the caret in the editor, Wing may show multiple menus, as in the above example: One for the contents of the top level of the file, one for the contents of the current top-level scope, and additional menus for each sub-scope. Clicking on any of these provides an index and selecting an item jumps to that place in the source code.

Source Browser

In Wing Pro only, the Source Browser in the Tools menu provides another way to view an index of your source code, either for the current module, all project modules, or all classes:

/images/blog/code-navigation/source-browser.png

The scope being browsed and the types of symbols shown may be selected by clicking on the menus at the top of the tool. Double-clicking on items displays them in the editor.

Browsing all project modules or classes assume that you have used Add Existing Directory in the Project menu to add your source code to your project. Typically the project should contain the code you are actively working on. Packages that your code uses can be left out of the project, unless you anticipate often wanting to open or search files in them. Wing will still be able to find them through the Python Path configured by Python or in Wing's Project Properties.



That's it for now! We'll be back next week to conclude this Wing Tips mini-series on navigating Python code with Wing.

As always, please don't hesitate to email support@wingware.com if you run into problems or have any questions.



Share this article: