No code in Outline pane

149 views
Skip to first unread message

Greg Bullock

unread,
May 20, 2021, 8:37:15 PM5/20/21
to spyder
The Outline pane is no longer showing the names of function and method definitions or the starts of significant code blocks (e.g., if blocks, for loops, etc.).

It's showing only the beginnings of cells, e.g., comment lines that begin with
#%% <optional text here>

This might be related to my recently upgrading to Spyder v 4.2.5 and to 5.0.2 (on Windows 10), but I'm not sure.  Either way, not long ago, the Outline pane used to show both, the cell  beginnings and the names of function and method definitions (and sometimes additional code blocks).

How to fix this?

Regards.
Greg


Derek Hohls

unread,
May 21, 2021, 2:01:37 AM5/21/21
to spyder
Not sure if this is the exactly same problem, but I posted an issue here - https://github.com/spyder-ide/spyder/issues/15640

However, they said it was fixed in 5.0.2, which is what you are running, so this could be something else.

yfprojects

unread,
May 21, 2021, 2:10:14 AM5/21/21
to spyder
Hello Greg,

are code blocks shown in your outline? They are created by a line with `# ---- Some Text`.
Do you have this issue with all your code files?

Kind regards
yfprojects

Greg Bullock

unread,
May 21, 2021, 1:56:08 PM5/21/21
to spyder
Yes, code blocks appear in the Outline.  The snapshot below shows the Outline Pane for a file that defines a few functions and multiple classes, each with multiple methods. A few weeks ago, the Outline Pane would show each of these (function, class, and method) definitions.
scant outline pane.png

And this snapshot shows the same file with a few code blocks added for testing.
scant outline pane with code blocks.png

Yes, the issue occurs with all of my code files.

Warm regards.
Greg

Greg Bullock

unread,
May 21, 2021, 6:29:39 PM5/21/21
to spyder
I just noticed that, while the issue occurs with all of my code files that I've checked, it does not occur with all code files. 

In particular, opening just now a .py file from matplotlib, I see that the Outline Pane shows the class and function definition lines as hoped.

So ... something to do with my own files, but I don't know what that might be.  And as I observed, this worked as hoped even with my own files up until a few weeks ago.

-Greg

yfprojects

unread,
May 25, 2021, 9:49:08 AM5/25/21
to spyder
This might relate to this issue on github since it isn't actually bound to `__init__.py` files.
It would also be interesting whether your problem occurs with a spyder project activated.

Kind regards
yfprojects

Greg Bullock

unread,
May 25, 2021, 1:58:54 PM5/25/21
to spyder
Activating a spyder project seems to make a little improvement, but only a little. 

I separately activated two different projects, and looked at 4 - 5 files in each project.  For most of the files -- all but two -- the Outline Pane continues to show just cell markers and code blocks, but no function definitions, class definitions, or method definitions.  Of the files that I checked, one file in each project each showed one function definition, but still no class or method definitions.

I'm most willing to look deeper into this, if you can suggest further tests to perform.

Regards.
Greg

Greg Bullock

unread,
May 25, 2021, 4:42:47 PM5/25/21
to spyder
Uninstalling Anaconda, deleting the .spyder-py3 folder (saving a backup), then reinstalling Anaconda, did not resolve the problem.  Still no code in the Outline Pane.

Greg Bullock

unread,
May 25, 2021, 6:31:03 PM5/25/21
to spyder
I confirm that the issue persists in version 5.0.3.

* Spyder version: 5.0.3 None
* Python version: 3.9.4 64-bit
* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Windows 10

Greg Bullock

unread,
May 26, 2021, 3:05:35 PM5/26/21
to spyder
The issue also persists with version 4.2.0
* Spyder version: 4.2.0 None
* Python version: 3.7.9 64-bit

* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Windows 10

But the Outline Pane works as expected with version 4.1.5
* Spyder version: 4.1.5 None
* Python version: 3.7.9 64-bit

* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Windows 10

Downgrading to version 4.1.5 also downgraded the python-language-server from 0.36.2 to  0.36.1, so that may also be complicit.

I'm happy to perform any additional tests anyone may want to suggest, but for now I'll stick with version 4.1.5, as the Outline Pane is valuable to me (as is also the option to increase the number of lines in the History).

yfprojects

unread,
May 27, 2021, 3:40:04 AM5/27/21
to spyd...@googlegroups.com

Currently I also don't know any tests that could help solving the problem. But if there is news on this issue I can tell you here.

Kind regards

yfprojects


Am 26.05.21 um 21:05 schrieb Greg Bullock:
--
You received this message because you are subscribed to a topic in the Google Groups "spyder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spyderlib/zfMQ_b1NGHc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spyderlib+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spyderlib/0b34b858-e9b0-4b02-9a94-d18025a0842an%40googlegroups.com.
Message has been deleted

Greg Bullock

unread,
Jun 7, 2021, 8:37:59 PM6/7/21
to spyder
The issue seems to have something to do with whether files are in a project.

Assume a file tree structure as follows:
my_project/
    sparse_outline.py
    sparse_outline_2.py
other_scripts/
    sparse_outline.py

Here,
  • my_project/ is a folder with a Spyder project,
  • sparse_outline.py is one of the files that exhibits the issue where function, class, and method definitions don't appear in the Outline pane,
  • sparse_outline_2.py is a copy of sparse_outline.py (just with a different name), and
  • other_scripts/ is a folder with yet another copy of sparse_outline.py but no Spyder project.
I find the following results using Spyder 4.2.5:

With my_project opened as a project and other_scripts/sparse_outline.py also opened for viewing, the Outline pane exhibits the issue on my_project/sparse_outline.py, but it behaves as expected on other_scripts/sparse_outline.py, showing function, class, and method definitions, as desired.

Closing the project and reopening the files, I see the same thing.  The Outline pane exhibits the issue on my_project/sparse_outline.py, but it behaves as desired on other_scripts/sparse_outline.py.

I made the copy sparse_outline_2.py to test whether there was some memory of the original sparse_outline.py in Spyder's my_project/.spyproject folder that was somehow complicit in whether the issue occurs.  Apparently not, as the Outline pane exhibits the issue with sparse_outline_2.py, with or without the project open.

Regards.
Greg

yfprojects

unread,
Jun 8, 2021, 10:35:05 AM6/8/21
to spyder
 Hi,

I think,  I also had the case that a file worked if there is no project activated, but did not work if the project the file was in was activated. But I am not able to reproduce this because I changed the files since then.
It would be great to determine whether this bug is inside the Spyder code or inside the language server's code. The problem is that I wasn't able to find out how to talk to the language server directly.

Kind regards
yfprojects

Greg Bullock

unread,
Jun 8, 2021, 3:51:59 PM6/8/21
to spyder
My results are slightly different.  For me, the issue occurs for a file that happens to be within a project folder, even if that project is not activated (and even if a different project is activated), but not for the same file when it's copied outside a project folder, even if a project is activated.

Perhaps these are two different problems, yours and mine.

Warm regards.
Greg

Derek

unread,
Jun 9, 2021, 2:23:49 AM6/9/21
to spyd...@googlegroups.com
I found as soon as I saved a file that was in a project to a non-project location e.g the Desktop, and then opened it as a 'stand-alone' file from that new location, all the outlining worked.  So this is clearly a bug related to how Syder is managing projects.

You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spyderlib/eb0e7395-2157-424f-a553-a77bfb9228a9n%40googlegroups.com.

yfprojects

unread,
Jun 9, 2021, 9:20:39 AM6/9/21
to spyder
Hi Derek,
this is the behaviour I initially saw, but I moved the files in my project into a subfolder. Since then I see what Greg describes.

Kind regards
yfprojects

Derek

unread,
Jun 10, 2021, 10:02:23 AM6/10/21
to spyd...@googlegroups.com
I am not sure what he means by "activated"? 

 In the case you mention, surely files in a project that get moved into a sub-folder of the project are still in the project? If you move them to a folder outside of the project, then you are back at the case that I described.

Derek

Greg Bullock

unread,
Jun 10, 2021, 10:45:55 AM6/10/21
to spyder
I embraced the phrase activated after one of yfprojects's posts used it.  For me,
  • Project activated refers to the state of Spyder after using Projects -> Open Project..., and
  • Project inactivated or not activated refers to the state of Spyder after using Projects -> Close Project or before ever using Projects -> Open Project....
Warm regards.
Greg

yfprojects

unread,
Jun 10, 2021, 12:05:20 PM6/10/21
to spyd...@googlegroups.com

I use it like that too. In the example experiment the file is not moved. Instead the project is opened and closed. That is what I meant by activated.

Since I moved the file into a subfolder inside the project, the outline doesn't work independent of whether the project is activated or deactivated.

Kind regards

yfprojects

Am 10.06.21 um 16:45 schrieb Greg Bullock:

yfprojects

unread,
Jun 10, 2021, 12:54:59 PM6/10/21
to spyd...@googlegroups.com

I now tried this again and discovered something new which also occurs in the newest development version of spyder (6.0.0dev0 d4d14d6).

Case 1:

I have the project deactivated and close spyder. On restart spyder restores the state in which I left it. That is the project being deactivated (closed). Now I open one of the affected files inside the project (file tree). The outline works as expected. Now I optionally close the file. Either way I activate the project and open the same OR another affected file in side the project. The outline doesn't work as described in this thread. Then I close the file and the project. After that I open one affected file in the project. The outline works.

Case 2:

I have the project activated and close spyder. On restart spyder restores the state in which I left it. That is the project being activated (opened). I open one of the affected files inside the project. The project is activated and the outline does not work. After I closed the project and I open one of the affected file again. Although the project is deactivated the outline doesn't work.

Case 3:

  1. Start with project already activated.
  2. Open file -> Outline does not work.
  3. Close file and deactivate project.
  4. Open file -> Outline does not work as well.
  5. Close file and open a different project the affected files aren't in.
  6. Open file -> Outline works.

Case 4

  1. Start with project already activated.
  2. Open file -> Outline does not work.
  3. Close file and directly switch to different project the affected files aren't in.
  4. Open file -> Outline works.
  5. Close file and deactivate (all) project(s).
  6. Open file -> Outline does not work.

I am looking forward to hear whether you can reproduce these observations.

Kind regards

yfprojects


Derek

unread,
Jun 11, 2021, 5:40:10 AM6/11/21
to spyd...@googlegroups.com
I agree that if a project is closed (or inactive or not activated) and then you create a new Python file without one, then the outline works.

Again, this just reinforces the idea that the bug is related to how Spyder is managing projects.

Mayur Modi

unread,
Jun 15, 2021, 11:54:59 AM6/15/21
to spyd...@googlegroups.com
Unsubscribe me from email alerts 

yfprojects

unread,
Jun 16, 2021, 8:17:15 AM6/16/21
to spyder
Hi Mayur,
I can't do that. You will probably have to do that yourself. Although this definitely is not related to this thread in any way, I will give you some hints how to do that.

You can unsubscribe this single thread by going to this discussions webpage. Then click on the checkbox left to the title that says something like "Unsubscribe".
You can change the settings for receiving notifications regarding this group (the spyder group) by visiting groups.google.com. This page will present you a table, listing the groups you are part of, in each line. In the third column you can set the settings for notifications.

Kind regards
yfprojects

Mayur Modi

unread,
Jul 6, 2021, 5:14:30 AM7/6/21
to spyd...@googlegroups.com
I am not part of this group, still receiving emails from this group threads.

Reply all
Reply to author
Forward
0 new messages