[Geany] tags files classes

Lex Trotman elextr at xxxxx
Fri Oct 8 21:43:55 UTC 2010


On 30 September 2010 17:44, Oliver Marks <oliver.marks at gforces.co.uk> wrote:
> can the custom tag files handle classes so it only autocompletes methods
> under the class, so if i type myclass. it woudl then list func1 func2
> and func3 so if i declare test as an instance of myclass typing test.
> should also list the methods.
>
> Can we currently do this ? and if we can whats the format for the tags
> file ?
>
> myclass:
>        def func1():
>                pass
>        def func2():
>                pass
>        def func3():
>                pass
>

Hi Oliver,

The Python tag manager already recognises things like the above, shows
them in the symbols sidebar and can dump tagfiles (as described in the
manual).

Unfortunately it can't go any further, because Python is a dynamic
language, recognising that test has func1, func2 and func3 can only be
done at runtime.

The line  test=myclass() is an assignment statement, not a declaration
that test is of class myclass. Test only gets a type at runtime when
the statement is evaluated.  Until you trace execution it is not
possible to be sure that myclass() is a constructor, rather than just
a plain function.

Also all the functions of a class's parent classes are also available,
functions can be added to classes dynamically and variables in classes
are also candidates for use after test.  None of these can be
determined until runtime.

Especially since member variables are only added when assigned to
(usually in __init__ but that not the only way) again its not possible
to know what to offer until runtime.

Scope specific completion is available for C like languages because
they are statically typed, each variable has its type declared and the
type has all its members declared, so its possible to know what can be
offered.

Cheers
Lex

> _______________________________________________
> Geany mailing list
> Geany at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>



More information about the Users mailing list