Problem: When I toggle a comment in Pydev it adds a space, inconveniencing me to manually correct this indentation. This was not an issue with earlier versions of Eclipse/Pydev. This problem occurs if I use the comment toggle key (ctrl + /) alone, or if I use it in combination with the uncomment key (ctrl + \).
System Versions: Eclipse Juno (Version: 4.2.2), Pydev 2.7.3
Examples:
a = 4
# a = 4
a = 4
In line 2 I comment that code (ctrl + /). Line 3 I uncomment (ctrl + /). Notice there is a lingering space before the a in line 3.
Redoing this example with the same version of eclipse but using java no spaces are added:
a = 4
//a = 4
a = 4
So, I think this is a pydev issue.
Research:
As I said before, this is not an issue with my Eclipse Indigo / Pydev 2.5 install. Spaces are neither added nor subtracted when toggling comments (ctrl + /).
This appeared on stackoverflow before as an issue in java. The fix provided there had no effect for me (it doesn't matter if I use tabs or spaces):
Eclipse "Toggle Comment" Shortcut Indents on New Projects
This issue has also been reported on pydev source forge: http://sourceforge.net/p/pydev/bugs/1547/
Work Around:
This is a solution for me, but isn't a true solution to the problem at hand. As suggested in the link above, do the following:
go to (in Preferences): Pydev | Editor | Code Style | Code Formatter
for the "Spaces in comment start?" combobox select "Don't change manual formatting".
Again, this solves my problem but doesn't solve the true problem at hand for someone who would like there to be spaces separating their comment from the comment symbol.
Also, because the default install preference is set to: "At least one space", this isn't an issue you would intuitively know how to fix upon just installing pydev for the first time.