[Geany-devel] Patch adding auto-close brackets, braces and string r1
ioguix at free.fr
ioguix at xxxxx
Tue Dec 16 03:58:48 UTC 2008
On Mon, 15 Dec 2008, Enrico Tröger wrote:
> On Mon, 15 Dec 2008 13:12:54 +0000, Nick Treleaven
> <nick.treleaven at btinternet.com> wrote:
>
>> On Tue, 9 Dec 2008 05:14:08 +0100 (CET)
>> ioguix at free.fr wrote:
>>
>>> In a first step, when opening a brace (ie. ( { [ ), we could check if
>>> no closing brace already match it before auto-closing it. That what I
>>> tried to do in the attached patch.
>
> I actually worked on the patch yesterday but had some weird
> connectivity issues (some sites weren't reachable including
> sourceforge.net, so no commits).
Ok. Let me know if this patch need some more work and you prefer me to
work on this a little bit more.
However, it could be easier to commit small bunch of patch instead a big
one. Easier to review as well. But it's a matter of taste :) .
> @ioguix:
> The second of your patch was about to change handling of
> GEANY_AC_SQUOTE with end_pos which was IMO a typo and should have been
> in the GEANY_AC_SBRACKET, so I moved it there. Correct me if I'm wrong.
Oops, I'm confused...Thanks.
>>> - can we really test if we are actually in a in string whatever the
>>> current language style ?
>>
>> Yes, but maybe not all filetypes are completely supported. See
>> is_string_style() in editor.c.
>
> Though this function treats all kinds of strings equally, that is for
> languages like C or Python where you have different kind of strings
> ('blah', "blah", ''' blag ''', ...) this function returns TRUE for all
> kinds. But you probably want something more fine-grained to
> differentiate between 'blah' and "blah".
Ok. This is a good start anyway. We could at least disabling auto-close
quotes inside a string...
However, I noticed simple quoted strings and double quoted strings are
sometime highlighted with different colors (depending of the current
language type, C doesn't, PHP does)...So I guess Scintilla parser has some
internal mechanism to handle this.
@nick:
If we can do this using a plugin, I think it is do-able...I'm not really
closed to the idea as I thought maybe we could fine tune this kind of
feature using some language oriented configuration.
Using a language oriented configuration plugin, we could do far more than
just auto-closing quotes and brackets (don't ask me what tonight plz :P).
I should admit however that I'm not very enclin presently to maintain such
a plugin which needs a lot of work to be very interesting...
> Regards,
> Enrico
>
> --
> Get my GPG key from http://www.uvena.de/pub.asc
--
Guillaume (ioguix) de Rorthais
More information about the Devel
mailing list