-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Outline Explorer: disable if/else/try/for
statements
#5821
Comments
if/else/try/for
statementsif/else/try/for
statements
I can second that; this would indeed be very useful. In general, I'm not sure I understand what general reason there would be to give if/else/try/catch substantially more importance than any other line of code, at least on the level of functions, classes, cells, etc, particularly without any option to disable it. I wouldn't think this would be too difficult to do... |
If @ccordoba12 accept it, I can take a look at it since it is something that has been bothering me for some time now. |
Jean, I think we should remove the code that shows |
Perfect @ccordoba12 , consider it done :) |
if/else/try/for
statementsif/else/try/for
statements
Hello, Many thanks for the nice editor, the outline Pane helps a lot. I just switched to spyder 4. Now I need to modify 10 years of scripts to add "####" lines before each "if". Would it be possible to add an option to include again the if/else/try/for statements in the outline ? Just in case this would be a really-easy task on your side. Thanks |
a fix using sed sed -i 's/^if ./#### &\n&/' test.py (but the "expandable" outline of spyder 3 was nicer) |
Hey, sorry about that. If there's enough interest from other users, @ccordoba12 might consider a PR, which you could base on the code that was removed by PR #5842; I'm just not sure how widely something like this would be used. As an alternative, you could consider replacing them with code cell comments instead of plain ones ( |
I think @jnsebgosselin decided to remove that functionality because it introduced too much noise in the Outline (and I agree with that). So I don't think we'd like it back. |
To be clear, I was referring to considering it as an option, off by default, if broader support among users was plausible, rather than always on as before. However, given this is the first time someone has requested it back, as far as I'm aware, and an alternative (code cells) exists that would provide the same benefits and more, and can be added with simple |
Ok thanks a lot, I was not aware about the code cells
allowing a foldable outline, that should do the job just as needed.
Thanks again.
Le 2021-01-14 00:20, CAM Gerlach a écrit :
Hey, sorry about that. If there's enough interest from other users, @ccordoba12 [1] might consider a PR, which you could base on the code that was removed by PR #5842 [2]; I'm just not sure how widely something like this would be used. As an alternative, you could consider replacing them with code cell comments instead of plain ones (# %% Optional descriptive text), which do allow the code within them to be expanded/collapsed just like your if statements, while also allowing you to give them a name/description, run just the code inside, and a few other features.
--
You are receiving this because you commented.
Reply to this email directly, view it on GitHub [3], or unsubscribe [4].
|
The Outline Explorer is really useful to jump to certain parts of the code quickly -- especially to functions, classes, code cells, and even comments starting with
# ---
. Especially the latter two help to structure a longer script better. However, the Outline Explorer also shows everyif/else/try/for
which makes the outline basically useless: for a rather long file, the actual main structures (functions, cells, etc.) are somewhere in between severalif/else/try/for
code statements that are rather meaningless for an actual "outline" (especially the singleelse:
lines).For this reason I ask whether you can implement an additional option in the right-click menu like "Show if/else/try/for... statements" ... just as there exists "Show special comments" to toggle code cell and
# ---
comments. Thanks for considering!The text was updated successfully, but these errors were encountered: