Hi there!
I'd very much like to see some auto-parentheses indentation in Geany. I
mean that this kind of indentation would be auto-generated on typing:
if (cond1 &&
fun_call (param1,
param2) &&
cond3)
{
another_call (param1,
param2);
/* and so on */
}
This includes:
- Indent new lines to match the position of the last opening
parenthesis (lines 2, 3, 7);
- Automatically reduce indentation on closing parenthesis to fit
the indentation of it's matching opening one (lines 4, 5, 8).
I'm trying to get this to work (attached WIP patch, which works but
have caveats)[1], but I have a couple of problems (probably related to
my little habit of Scintilla) and questions.
First, the problems:
- How to know if a character is or not part of a comment, string or
so? (e.g. should be interpreted as a syntactic element by itself) I
need this to find the parenthesis -- and no, I can't do the same than
brace_match() since I don't know the position of any of the parentheses.
- Why brace_match() uses the character at (pos - 1) but
the style at (pos)? This seems to be needed for brackets but
breaks with parentheses (see comments in the WIP patch).
And now the unique question (not that urgent since the patch isn't
ready): how to add this as part of the auto-indentation? (I mean,
always enable it -- I don't think everybody will like --, add a new
indent method, a new separated setting, or what?)
Thanks for your help!
Colomban
[1] But if anybody would like to do this, I'd be happy to let him/her
do :D