[Geany-Users] Highlighting the lexical scope relative to the cursor position

Lex Trotman elextr at xxxxx
Fri Dec 20 09:35:33 UTC 2013


On 20 December 2013 10:42, James Brierley <jmb8710 at gmail.com> wrote:

> Hello everyone,
>
> I might just be being dense, but I can’t seem to find any hard info about
> this, so I’ll just throw it out there.
>
> Suppose I’m writing a function such as the following C/Java-ish pseudocode
> (the spurious symbols will be explained in due course):
>
> void some_function(int foo, double spam)
> {
>         int pointless_var = 0xD00D; *[1]*
>
>         while (HELL_HASNT_FROZEN_OVER) {
>
>                 if (some_condition) {
>
>                         do_something(); *[2]*
>                 }
>
>                 else {
>
>                         do_something_else(); *[3]*
>                 }
>
>         }
>
>         return;
> }
>
> Now, what would be useful is, to give some concrete examples, when the
> cursor is at position *[1]*, everything between some_function’s braces
> would be highlighted in some way, say with a slightly off-white background;
> at position *[2]* everything between the if statement’s braces would be
> highlighted, and at *[3]* — you guessed it — everything within the else
> block would be highlighted. In other words, the extent of the scope of
> declarations would always be highlighted.
>
> Would it be possible in any way to extend the brace matching capabilities
> of Geany to make anything like this possible? Of course, in some languages
> scope is more complicated than “everything between a { and a }” but even
> something this simple and stupid would be useful in a lot of cases.
>
> I should point out that this was prompted by me writing quite a lot of
> Lisp, and occasionally getting ‘Lost In Silly Parentheses’, but I presented
> a C-esque example for the benefit of anyone who would rather eat their own
> toenails than program in Lisp.
>

Note that highlighting matching bracket works for parens too, so you could
make the style for that ***very*** visible to help with the Lisp problems.

Cheers
Lex



>
> Anyway, just wondering if the various components of Geany can be persuaded
> to make something like this possible, whether that means me writing a patch
> or something else.
>
> James
>
> --
> "Unix is the worst computer operating system, except
> all the others that have been tried."
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/users/attachments/20131220/0b3fd832/attachment.html>


More information about the Users mailing list