[wingide-users] Indent analysis confused

Michael Foord fuzzyman at voidspace.org.uk
Wed Nov 4 13:25:58 MST 2009

Tom Stambaugh wrote:
> I think the current behavior of WingIDE is superb, I think you've done 
> a marvelous job of handling an extraordinarily difficult task. In my 
> view, the current functionality does just the right thing -- I'm 
> constantly impressed by how well it works inside long comment blocks 
> and multi-line docstrings.
> The workaround that I offered (adding an indent before the row of 
> hashes) perhaps gets Michael most of the way to where he needs to go.

Sorry, but it looks 'truly horrible'.

> This sounds, to me, like a case of "if it ain't broke, don't fix it."

For this use case it is unfortunately broken (the auto-indent puts the 
indent in a location that is syntactically invalid).



> Wingware Support wrote:
>> Tom Stambaugh wrote:
>>> PyDoc and the various other tools that use docstrings (such as the 
>>> "Source Assistant" of WingIDE) are likely to at least be stressed if 
>>> not broken, because I would expect the un-indented second line of 
>>> hashes to potentially violate the syntactically-significant 
>>> whitespace grammar of Python. I know that comments are supposed to 
>>> be invisible, but as you can see from the indent manager they really 
>>> aren't.
>> The reason we chose to pay attention to comment position in the indent
>> manager (for auto-indent only, I believe) was that _usually_ the 
>> comment's
>> position is significant and using it is preferable to requiring the user
>> to dedent twice for example in:
>> if x:
>>   pass
>> # comment (had to dedent here)
>> <don't want to have to dedent again here!>
>> This is a very common case in coding so I think what we're doing is
>> in general correct.  The algorithm is actually more complex that just
>> looking at comments all the time (e.g. it ignores block comments in
>> certain cases).  As I noted earlier, I think we can enhance this to work
>> OK in the case Michael reported w/o really breaking anything.  It's
>> (probably) reasonable enough to stubbornly indent again for any first
>> non-comment line in a code block.  Most comments here will already be
>> indented to the "right" position.
>> This is good example of how being "smarter" in an IDE can backfire.  
>> There
>> is an unavoidable tension between doing more than just being a plain 
>> text
>> editor and sometimes doing too much.
>> BTW, it's useful to get feedback like this.  A lot of the value in Wing
>> is from long years of tweaking in response to user reports.


More information about the wingide-users mailing list