[wingide-users] Indent analysis confused
support at wingware.com
Wed Nov 4 12:09:43 MST 2009
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:
# 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.
Wingware | Python IDE
Advancing Software Development
More information about the wingide-users