Wing Tips: Active Ranges: New Feature in Wing IDE 5.0.9

Sep 12, 2014

An often-requested feature that we've added to Wing IDE version 5.0.9 is the ability to mark a range of code in the editor as "active" so it is easily reevaluated in the Python Shell or Debug Probe. This makes it easier to work interactively with Python without having to copy and paste code between the Python Shell or Debug Probe and the editor.

To use this feature, select a range of code in the editor and press the Set Active Range icon setactiverange in the top right of the Python Shell or Debug Probe. This marks the range in the editor and adds an Evaluate Active Range icon evaluate-active-range for evaluating the range and a Visit Active Range icon visit-active-range for visiting the active range in the editor to the top right of the shell tool. The Remove Active Range remove-active-range icon can be used to remove the active range.

Here is an example of this feature in action, in the integrated Python Shell:

The same capability exists in the Debug Probe, which is a Python Shell that acts in the context of the currently active debug stack frame.

Setting up Key Bindings

There are no default key bindings for these actions, but keys can be bound to them using the User Interface > Keyboard > Custom Key Bindings preference. The commands defined are:

python-shell-toggle-active-range sets or clears the active range in the Python Shell, using the current selection or current line in the editor when setting the range.

python-shell-evaluate-active-range evaluates the current active range in the Python Shell.

python-shell-show-active-range shows the Python Shell's active range in the editor.

Similar commands are defined for the Debug Probe: debug-probe-toggle-active-range, debug-probe-evaluate-active-range, and debug-probe-show-active-range.

Share this article: