[wingide-users] Auto-close characters should not produce non-pythonic code
support at wingware.com
Wed Mar 20 11:59:11 EDT 2013
Luc Bourhis wrote:
> consider the following code
> expr = re.compile(r"let | set", re.X)
> In order to put parenthesis around "let", I would like to proceed as follow:
> 1. put the cursor just before "l"
> 2. type "("
> 3. jump to the position after "t"
> 4. type ")"
> Wing4.1.12 does not let me do it because at step (2) it auto-closes the parenthesis resulting in
> expr = re.compile(r"()let | set, re.X)
> Thus I have to waste time deleting the closing parenthesis before moving to step (3). This is a universal behaviour as Wing does the same if instead
> expr = a + b*c
> and I wanted to put "a+b" between parenthesis by first typing "(" before "a". This is also universally un-pythonic as "()a" almost never leads to valid Python code (the only exception being string formatting "%(name)s" really).
> Thus could we have a rule that typing "(" never auto-closes with ")" if there is a character immediately to the right other than a space?
This is something we need to improve further. It should not be
auto-closing before a symbol like this.
Selecting is one way to get around this for now, if you have the "Apply
() etc to Selection" auto-editing operation turned on. Or turn off the
Auto-Close Characters Auto-editing operation for now.
A related command that might also be useful to know about is 'enclose'
which can be bound to a key. It places a ( at current position and ) at
end of line. The command takes args start and end which can be used to
change the characters place. For example 'enclose(start="[",end="]")'
could be bound to a key.
Wingware | Python IDE
Advancing Software Development
More information about the wingide-users