Hi all.  I hope you'll forgive me if these are newbie comments/questions.

I use 1.71 on Windows and have noticed that the included Python properties file
makes SciTE autoindent in a couple of situations it shouldn't.  First, when you
have a colon that isn't being used as the signal to start a block; for example,
you are just assigning something using slice notation.  Second, when your entire
block is one statement which you've put on the same line as the colon; common in
quickie 'if' statements such as

  if abort_loop: break

I suppose you could argue that the above example is bad style, and should be
avoided anyway.  It would be harder to argue not to use slice notation, one of
the nicer features of Python.

For now, I've at least gotten SciTE to stop indenting for slices by switching to
the keyword strategy (indent if line contains 'if', 'for', 'while', etc.,
instead of ':') but it would be wonderful if there is some way to configure it
to work all the way correctly.  The rule I'm looking for is "if the line ends in
a colon, indent the next one", but I don't know how or if it is possible at all
in SciTE.  Something along the lines of

  statement.indent.$(file.patterns.py)=10 :\n

would be great.

Anyway, the keyword indentation strategy brings me to Java, because the C++
properties file is where I first noticed keywords being used for that purpose. 
Someone recently posted to the Scintilla project page that his Java code is
being autoindented when he uses 'private' (one of the indentation keywords) to
declare variables, as opposed to methods.

Since you do want to autoindent after a private method declaration but not after
a private variable declaration, the block-delimiter strategy may be more
appropriate in the C++ file (used for Java source).  You can easily set it up to
autoindent after '{' unless it is followed by a ';', which I believe will be
much closer to the desired Java behavior.

Still, I think a better rule would be "if the current line ends with an open
curly brace, indent the next line" rather than "if the current line contains
<blah>, then indent the next line unless there is a subsequent <blahblah>". 
(The K&R-style 'switch..case' indentation would be the main reason I would
consider sticking with the keyword strategy for plain C; but I could deal with
manually fixing 'switch..case' in Java to get variable and method declaration to
work better.)

I know this post is on the long side, but I don't want to end it without first
saying that I really like SciTE, and I absolutely do not presume to know more
about any of these languages than the author of SciTE, who I know is fairly
prominent in the Python community and uses C++ to develop Scintilla and SciTE.

John


_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to