[Geany] Detecting symbols

Enrico Tröger enrico.troeger at xxxxx
Tue May 19 20:33:07 UTC 2009


On Mon, 18 May 2009 19:54:24 +0200, Filip wrote:

>> This was already requested a couple of times. I'm not sure whether we
>> want this. It would probably require quite some effort to parse
>> import statements from an opened source file, find the corresponding
>> Python files, parse them, merge the parsed information into
>> tagmanager(the code which provides the main part of symbol
>> completion data). Additionally, added symbols should maybe removed
>> again when the source file is closed which also might not be that
>> trivial.
>
>I am not suggesting anything as complicated, as you say. I understand,
>that in situation like
>thos:
>
>import sth
>
>you want to find module sth.py and detect all symbols inside. I think
>enough is to add sth to namespace. It would became useful in following
>situation:
>
>from sth import LongNameClass, AnotherLongNameClass
>
>and simply add those two. You need to only parse imports and detect
>names, that were added to the local namespace.

Ha, I guess I was a bit off the road with my ideas...:).

Your suggestion was actually quite easy to implement, I did it in SVN.
Geany now parses import statements for Python files and provide it as
symbol compeltion.
Currently it also lists them in the symbol list though I'm not yet
completely sure whether we really want this. Awaiting some feedback of
Python users :).

For testing the parser, I mainly used the following code snippet:
import os, sys, errno, re, glob, gc, datetime, shutil
try: import cPickle
except: import pickle as cPickle
import Runner, TaskGen, Node, Scripting, Utils, Environment, Task,
Logs, Options
from Logs import debug, error, info
from Constants import *

Are there other variants of "import" statements possible? You know, my
Python knowledge is very limited :).


Regards,
Enrico


-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20090519/d0fb3b71/attachment.pgp>


More information about the Users mailing list