IDE Spyder indentation level comments

raplapla -  
 Anonymous user -

Hello everyone,

Do you know how to make Spyder place the # just before the non-white character (thus at the indentation level) when using our keyboard shortcut to comment a line?

Simple example:

def toto: I type my comment here return 'toto'


If with a simple and wonderfully lightweight IDE like Geany, I use my keyboard shortcut to comment the line, I get:

def toto: # I type my comment here return 'toto'


Which is perfect, it respects the indentation of the block I'm in.

Spyder, on the other hand, places the # at the beginning of the line...
def toto: # I type my comment here return 'toto'


I am therefore looking to have the same intuitive behavior as Geany.
For now, I use the shortcut to go to the beginning of the line and insert # + space there.

Unfortunately, there’s nothing in the spyder.ini file regarding this.
I am using Spyder 3.3.3, the version provided in my Debian packages.

If anyone knows how to configure this, I would appreciate it =)

4 réponses

Phil_1857
 

Hello,

I use a simple text editor, but one that applies syntax highlighting, auto indentation, commenting out one or more lines, etc... and for several programming languages.

And it does exactly the same thing as Spyder.

And the IDE Idle does the same thing...

0
raplapla
 

Good evening, no a simple text editor can't do what an IDE like Spyder does, for simple small scripts or projects Geany is enough for me, but for big projects with tons of classes, I prefer Spyder. As they say, to each their own ;-)

Everything happens in the codeeditor.py file of Spyder, I will check if in the comment and uncomment method of the huge CodeEditor class I can access the current line to count the number of spaces and if with a simple regex I can modify this behavior.

It's not going to be easy ^^

As always, thank you for your response =)

0
Phil_1857
 

Hello,

My text editor is called UltraEdit32 and it supports syntax highlighting,

automatic indentations following line breaks, such as in a

function, an if statement, or a while loop, commenting

or uncommenting one or multiple lines, etc...

But it does not execute the code and does not perform debugging:

0
Anonymous user
 

Hello, in Pycharm the shortcut is Ctrl + / (the divide key on the numeric keypad because it doesn't work with the : key) it places the # and a space at the correct indentation level


When I was little, the Dead Sea was just ill.
George Burns

0