Spyder: Variable names are displayed in the Outline pane

Created on 29 Sep 2020  路  8Comments  路  Source: spyder-ide/spyder

Description

What steps will reproduce the problem?

In the 4.1.5 version, only the function name was displayed in the outline pane as follows:
4 1 5

In the master version, the variable names are also displayed in the outline pane as follows:
dev

The example code is as follows:

# -*- coding: utf-8 -*-
"""Test outline."""
# Third party imports
from matplotlib.pyplot import figure
from numpy import linspace
from numpy.core.umath import log2


def nextpow2(val):
    r"""."""
    val_abs = abs(val)

    exponent = 1

    while exponent < val_abs:
        exponent *= 2

    exponent = log2(exponent)

    return exponent


if __name__ == '__main__':
    data = linspace(1, 2, 3)

    fig = figure()
    ax1 = fig.add_subplot(1, 1, 1)
    ax1.plot(data)

    data = linspace(1, 3, 3)
    fig = figure()
    ax1 = fig.add_subplot(1, 1, 1)
    ax1.plot(data)

If it's working properly, could you add a functionality to hide variables?
Thank you for reading it.

Versions

  • Spyder version: 4.2.0.dev0 af7d224ba
  • Python version: 3.8.5
  • Qt version: 5.12.5
  • PyQt5 version: 5.12.3
  • Operating System: Linux 5.4.0-48-generic

Dependencies

# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.18.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
keyring                        :  None (OK)
nbconvert >=4.0                :  6.0.6 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.7.1 (OK)
pylint >=1.0                   :  2.6.0 (OK)
pyls >=0.35.0;<1.0.0           :  v4.1.4+326.gaf7d224ba (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.7.7              :  4.7.7 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.10.0.dev0 (OK)
watchdog                       :  None (OK)
xdg >=0.26                     :  0.26 (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  0.29.21 (OK)
matplotlib >=2.0.0             :  3.3.1 (OK)
numpy >=1.7                    :  1.19.1 (OK)
pandas >=1.1.1                 :  1.1.1 (OK)
scipy >=0.17.0                 :  1.5.2 (OK)
sympy >=0.7.3                  :  1.6.2 (OK)
Outline Explorer Enhancement

All 8 comments

If it's working properly, could you add a functionality to hide variables?

I don't think that's possible now. The thing is we switched to use the information provided by the Python language server instead of parsing the file, so now we are able to display more symbols in the Outline than before. And that was done in order to avoid serious lags while typing in the editor when the Outline is visible for large files.

@andfoy, what do you think about this one?

I think we can add an option to hid the variable-specific types, since class attributes are identified as fields rather than variables. We can include this as part of the upcoming PR to restore cells and block comments

@ccordoba12 @andfoy Thanks for the detailed explanation.

I think we can add an option to hid the variable-specific types,

Great! I didn't that was possible.

I tagged this for 4.2.1 because it's not critical, but if you can solve it for 4.2.0 it'd be great.

I support this 100% :D

Do you think adding an option to hide variable names is enough? Or would like to see other object types to be hidden as well?

I think variable names is enough.

I think the option to hide variables should also hide attributes. For example, in the code below, I would expect the attribute dataf to be hidden as well as the variable subset_columns.

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieltomasz picture danieltomasz  路  3Comments

JesterEE picture JesterEE  路  3Comments

ok97465 picture ok97465  路  3Comments

keith-golden picture keith-golden  路  3Comments

spyder-bot picture spyder-bot  路  3Comments