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

Lex Trotman elextr at xxxxx
Mon Dec 23 11:43:15 UTC 2013


>
> [...]
>


> Nice! Could scope detection potentially also be used to add local
> variables to autocompletion?
>

Thomas,

I looked fairly closely at the possibility of adding local variables a
while ago.  There are several things missing to get local variables and
local scope completion (talking about c.c languages only, other languages
mileage may vary :-)

1. our parsers don't parse anything other than global scope, which is only
declarations, so they only parse declarations, not statements, and they may
be complicated significantly by the addition of the ability to discriminate
between declarations and statements that are mixed inside local scopes.

2. tagmanager itself only understands named scopes, not lexical scopes, so
whilst the fold info can detect a lexical scope, tagmanager has no way of
storing such information.  If tagmanager could store it, it would probably
fall out of the parser anyway, once the local scopes are parsed, so fold
info isn't much benefit.

3. for C, autocomplete would need to understand how to look up local
variables, through the nested scopes, also the rules for hiding outer
scopes, and for C++, also rules for member lookup in member functions.  For
other languages whatever rules they may add.  And it has to apply these
rules to partially complete symbol names, and fast.

All of which is a way of saying: 1. its possible 2. its a lot of work, 3.
fold info won't help much if at all.

Cheers
Lex


> PS: The video didn't play in VLC (stuck on first frame) but did with
> ffplay.
>

Sadly can't play it at all, I'm on holidays with very slow internet,
effectively email and some browsing only, no IRC and no videos :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/users/attachments/20131223/6769db2e/attachment.html>


More information about the Users mailing list