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

James Brierley jmb8710 at xxxxx
Thu Dec 19 23:42:04 UTC 2013


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.

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."


More information about the Users mailing list