On 04/16/2010 02:39 PM, Colomban Wendling wrote:
jordan a écrit :
As Enzo said, there is the scope to determine if a particular line is part of a function or not, but its is not supported by every tag generator used by Geany. What I personally chose was to walk the tag list and find the tag closest to the current line. Tweaking this way a bit gives quite good results.
And for the function definition, see the tag list, there is everything you probably want (or almost). One missing thing is the argument list – I personally chose to fix this with a regular expression, but there might be better solutions; for example if hard-coded things are acceptable, a custom argument parser is a somewhat easy task.
How do I access the scope, or this tag list you speak of, I noticed nothing like that in plug-in api documentation?
See the tm_file field of GeanyDocument. I don't know exactly for the scope, but the tag list is doc->tm_file->tags_array.
Thanks for the pointer, I have figured out how to access the tags, and have started re-writing my code to use tags instead of the current line, and it is now able to handle multiline function definitions, however this method seems broken as after the first comment block is inserted any tags below the insertion no longer have a valid line number until the application is saved.
I notice this behavior is also present in the symbol browser of Geany, if you add some lines and try to go to a symbol using the symbol browser it will take you to the wrong line, is there any way to force an update of the tags after my plugin inserts the text? -Jordan