[Eric] a pair of questions/suggestions

Linos info at linos.es
Sat Sep 27 19:00:10 BST 2008


well about the source code formatting like it is implemented in eclipse you have 
reason that it would break the correct indentation in python because it does not 
respect his indentations rules but it could be implemented in this way and lets 
you define it add the \ at the end of the line where implicit new line can be 
used (inside parenthesis for example). Another option could have about the 
indentation should be it indents at the same level of the line or make the line 
split section indented as well, for example in 
http://www.python.org/dev/peps/pep-0008/, at "Maximum Line Length" section you 
can see this code:

	def __init__(self, width, height,
                      color='black', emphasis=None, highlight=0):
             if width == 0 and height == 0 and \
                color == 'red' and emphasis == 'strong' or \
                highlight > 100:
                 raise ValueError("sorry, you lose")
             if width == 0 and height == 0 and (color == 'red' or
                                                emphasis is None):
                 raise ValueError("I don't think so -- values are %s, %s" %
                                  (width, height))
             Blob.__init__(self, width, height,
                           color, emphasis, highlight)

it is using implicit in __init__arguments and indents the next line, i think 
this should be configurable, i for example use a limit at 100 char for line (i 
am a solo developer and 80 limit in my code kills me sorry) and ever make use of 
\ to easy find multi-line statements and respect the indentation of the line, so 
maybe i would have write the above this way:

	def __init__(self, width, height,\
	color='black', emphasis=None, highlight=0):
             if width == 0 and height == 0 and \
             color == 'red' and emphasis == 'strong' or \
             highlight > 100:
             	raise ValueError("sorry, you lose")
             if width == 0 and height == 0 and (color == 'red'\
	    or emphasis is None):
	    	raise ValueError("I don't think so -- values are"\
		" %s, %s" % (width, height))
             Blob.__init__(self, width, height, color, emphasis,\
	    highlight)


so this options should be configurable, i too split large strings (like in my 
example) but i know any people dont like to split strings so it should be too 
configurable. Not have to be splitting manually the lines would be really a 
speed boost developing, if you for example change a multi-line string really 
large in the second line to add any chars on it you will have to create a really 
small line before with the contents you want to add or reorganize all the 
multi-line split manually.

Regards,
Miguel Angel.

Detlev Offenbach escribió:
> On Samstag, 27. September 2008, Linos wrote:
>> Hello,
>> 	do have eric a feature like the "ctrl+shift+f" of eclipse for autoformat?
>> should be great, i am refactoring old code limiting the maximum number of
>> characters for line and would be really helpful for that, anyway to develop
>> new code it is really nice to not have to get any attention on correct
>> formatting to later use the feature and get formatted it.
> 
> There are languages out there, where the source format is part of the syntax 
> (e.g. Python uses indentation). Therfore I think, that feature would not be 
> good. However, I might have misunderstood, what this feature is supposed to 
> do.
> 
>> About the typing helps i love the automatic insertion of ending parenthesis
>> after opening it, and the space after the comma, but when i am refactoring
>> it is really annoying, for example.
>>
>> if i have this list in a line and try to change it for a tuple [1, 2]  i
>> get this on the first opening parenthesis ()[1, 2] and ever have to delete
>> it, the same problem with the comma logically, if it is difficult to know
>> exactly when to add the closing parenthesis (maybe if you have a char just
>> after the new parenthesis?) i think the typing help should have a easy and
>> fast "change editing mode" to select refactoring or anything else.
> 
> The editor context menu will have an entry to toggle this. That will be part 
> of the next eric4 snapshot.
> 
>> Thanks by this really good editor.
>> Regards,
>> Miguel Angel.
> 
> 
> Regards,
> Detlev



More information about the Eric mailing list