-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Visual help for indentation: draw spaces and tabs #670
Comments
From jorisvan...@gmail.com on 2011-05-29T01:32:14Z And you don't have to look at the code in the example, just to show what I mean. Because defining a function in a for loop each time again is rather stupid :-) |
From ccordoba12 on 2011-10-08T06:57:54Z There is no option to do this right now, but it would be really really helpful. I'll see what I can do about it. Labels: -Type-Defect Type-Enhancement Cat-Editor |
From contrebasse on 2012-03-14T16:28:04Z I'd rather have indentation lines, like geany (and others) has. It's especially useful in python to see blocks. |
From pierre.raybaut on 2012-03-18T14:09:58Z Labels: -Type-Enhancement Type-Enh |
From ccordoba12 on 2013-02-13T09:41:25Z Labels: MS-v2.3 |
From omegat...@gmail.com on 2013-02-13T10:03:34Z Notepad++ does this, too. I have the space dots turned really light so they aren't distracting, but the tab arrows then end up a little too dark. Attachment: Notepad++ space and tabs.png |
From pierre.raybaut on 2013-03-12T05:43:06Z Summary: Visual help for indentation: draw spaces and tabs (was: Visual help for indentation: draw spaces) |
From pierre.raybaut on 2013-03-12T05:43:30Z issue #1308 has been merged into this issue. |
From pierre.raybaut on 2013-03-13T04:37:23Z issue #1311 has been merged into this issue. |
From pierre.raybaut on 2013-05-11T05:32:15Z Labels: -MS-v2.3 MS-v2.4 |
From dr.bag...@gmail.com on 2013-08-07T12:26:10Z Given how useful it is for python, I'd vote for implementing something similar to sublime. lines for tabs, dots for spaces. See pic. Attachment: XDUxE.png |
From ccordoba12 on 2013-08-09T19:57:14Z You are right: we should provide this functionality because of its importance to learn and use Python. I know how to do it and even had a patch to make it work a long time ago, so it shouldn't be that hard to make it work again. Status: Accepted |
From contrebasse on 2013-08-12T04:14:28Z I would prefer vertical lines over the sublime way, because I find it clearer to see the indentation. The important information is not the number of tabs but rather the alignment with previous blocks of code. Visually differentiating between tabs and space can help check indentation coherency, but this can be automatically corrected anyway. Of course, any solution is better than nothing ! |
From pierre.raybaut on 2013-08-12T05:02:01Z I fully agree with contrebasse. |
From dr.bag...@gmail.com on 2013-08-12T06:35:41Z I still prefer the sublime way. Unless I'm misunderstanding you guys, it has best of both worlds as you do also get alignment information, the vertical lines may be subtle, but that's just the theme. Perhaps, if it's not that much added effort, a few options to accommodate both methods? |
From omegat...@gmail.com on 2013-08-12T08:05:05Z it seems notepad++ has both? horizontal lines (with arrows) for tabs, dots for spaces, and vertical lines for "indent guide"? |
From contrebasse on 2013-08-13T07:35:23Z Oh yeah, the vertical lines are present in sublime, they are visible when looking at the full scale image. Sorry. |
From ajande...@gmail.com on 2013-08-13T17:44:09Z This would be a beautiful thing. It would definitely make nested loops easier to look at. I've been setting the "show vertical line" at multiples of 4 to make sure things are lined up :( |
From ccordoba12 on 2013-09-04T11:50:58Z issue #1478 has been merged into this issue. |
From ccordoba12 on 2013-12-11T12:17:37Z Labels: -MS-v2.3 MS-v2.3.1 |
From Norl...@gmail.com on 2013-12-19T22:51:20Z So once again I have to open up my file in notepad++ to fix indentation by visual inspection because my file is FUBAR from some cut and paste operation... what is the status on this feature request? I really don't care how its displayed just so long as I am able to discern the different breads of white space. [coming from a c background it still has me stumped why people think its a good idea to be able to break code via invisible differences in the file!] |
From trueflyi...@gmail.com on 2013-12-20T01:29:11Z
step 1: use python 3 instead of python 2 but i agree that step 2 can be replaced with, “don’t make indentation mistakes since you see indentation in the editor” |
From contrebasse on 2014-01-07T06:34:29Z You can use autopep8 to automatically correct the indentation (where possible). There's a plugin for spyder (disclaimer: I'm the author of the plugin): https://github.com/Nodd/spyder_autopep8 |
From rbrato on 2014-04-25T03:37:41Z Vertical lines, that would show the indentation would be very helpful. I have just started using Spyder and am missing them so much from Notepad++. Writing long/many lines codes in Spyder will become so much easier to follow with at least the vertical indentation guides. |
From ccordoba12 on 2014-05-17T17:41:58Z I think points are easier on the eye than lines. I'll try to implement it for 2.3.1 (I had a prototype a long time ago). |
From phyo.arkarlwin on 2014-06-24T16:40:32Z I like the way kate does it , can chose points or vertical lines or both. |
From ccordoba12 on 2014-06-27T10:50:14Z My prototype is not publicly available but you could take a look at IEP source code to see how they do it: https://bitbucket.org/iep-project/iep |
From nicola.m...@tut.by on 2014-07-21T00:18:09Z Hello all, Some time ago I've implemented a small dirty hack to show spaces and tabs. This is still working in Spyder ver. 2.3.0rc (as with Anaconda 2.0 under Windows). Perhaps, after some polishing and adding configuration controls, this can be a basis of 'real' implementation: In the file <PYTHON_DIR>\Lib\site-packages\spyderlib\widgets\sourcecode\codeeditor.py I've added the following lines at the end of set_language() of CodeEditor class
For this to work, it is necessary to import the class QTextOption from spyderlib.qt.QtGui The idea was taken from discussion at http://www.qtcentre.org/threads/27245-Printing-white-spaces-in-QPlainTextEdit-the-QtCreator-way Perhaps, there is a better way to implement the whitespace visibility, but I does not know the Spyder internals well enough. |
From ccordoba12 on 2014-08-17T18:29:23Z Labels: -MS-v2.3.1 MS-v2.3.2 |
From ccordoba12 on 2014-09-21T10:36:01Z To solve this we need to
Labels: Easy |
From ccordoba12 on 2014-10-31T15:10:19Z Labels: -MS-v2.3.2 MS-v2.4 |
From TheSa...@gmail.com on 2014-11-20T13:45:41Z @-ccordoba: is there any chance to have this new feature in the next release? |
From nicola.m...@tut.by on 2014-11-25T00:50:07Z @#32: I'm using Spyder v. 2.3.1 (Anaconda 64-bit distribution on MS Windows) and have patched it without issues. Have you tried to run Spyder from console to see any errors? As I've written before in comment |
From ccordoba12 on 2014-11-25T08:48:46Z Ok, given its high demand, I'll work on this issue for 2.3.3. Unfortunately 2.3.2 is almost ready ;-) Labels: -MS-v2.4 MS-v2.3.3 |
From ccordoba12 on 2015-02-03T12:49:11Z This issue was updated by revision 3a925f7ed02a . Status: Started |
From ccordoba12 on 2015-02-03T12:49:12Z This issue was updated by revision 43df2897db69 . Status: Fixed |
From contrebasse on 2015-02-05T01:59:13Z I think only part of the proposal is fixed. Sure, spaces are shown but |
From ccordoba12 on 2015-02-05T07:44:36Z About your points:
|
From nicola.m...@tut.by on 2015-02-09T00:45:15Z Very good to see the issue fixed! Thank you! For me (as everyday Spyder user) it is quite helpful to see spaces and (eventually) tabs everywhere - indentation, trailing spaces, etc. to have my code cleaner. |
Could the dots to highlight the spaces perhaps have a lighter color? Currently it seems to have the 'Normal text' color, which is a bit to dark and makes the code hard to read. The attached gedit screenshot and the eclipse one from duplicate #1478 are easier to read. |
This has been reported in #2175. It should be doable with the syntax highlighter. |
@hugobuddel, that doesn't depend on us, sorry :-( |
For a little more info, see the details of #2437. Basically, the dot characters are set by Qt. You can help out by commenting on or voting for https://bugreports.qt.io/browse/QTBUG-46072 EDIT: |
From jorisvan...@gmail.com on 2011-05-29T03:29:41Z
This is actually a feature request.
In gedit there is a plugin that allows you to 'draw spaces and tabs' ('Draw spaces' in the gedit-plugins package). I find it very handy to see visually of my indentation is correct. Certainly for example, if you have a blank line in an indentated group like a class of function definition or for loop, that blank line has also to be indentated with the same level. But you can't visually see if this is done correctly or not. When you have the 'draw spaces' enabled it is much easier (see example in attachment how it looks like).
So I wonder if something like this would be possible in Spyder (as an option in the preferences)?
Attachment: gedit-printscreen.png
Original issue: http://code.google.com/p/spyderlib/issues/detail?id=670
The text was updated successfully, but these errors were encountered: