Parse Python calltips.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3809 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
3b9840dafb
commit
5acdfaf4e0
@ -4,6 +4,8 @@
|
||||
Fix multiline indent when selection covers text on the last line.
|
||||
* src/notebook.c:
|
||||
Show current document in bold in tab popup menu.
|
||||
* src/editor.c, tagmanager/python.c, TODO:
|
||||
Parse Python calltips.
|
||||
|
||||
|
||||
2009-05-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
8
TODO
8
TODO
@ -20,10 +20,6 @@ Note: features included in brackets have lower priority.
|
||||
o (better search & replace regex support - use
|
||||
SCI_GETCHARACTERPOINTER and GNU regex?)
|
||||
o (parsing tags from a memory buffer instead of a file on disk)
|
||||
o (calltip support for non-C-like languages that use
|
||||
function_name(arguments) syntax)
|
||||
o (better tags support for popular languages? - this is a moving
|
||||
target...)
|
||||
o (tango-like icons for the symbol list)
|
||||
o (show autocompletion symbol icons - see SCI_REGISTERIMAGE)
|
||||
|
||||
@ -40,6 +36,10 @@ Wishlist
|
||||
--------
|
||||
Note: these items might not get worked on.
|
||||
|
||||
o (calltip support for non-C-like languages that use
|
||||
function_name(arguments) syntax - see python.c:parseArglist())
|
||||
o (better tags support for popular languages? - this is a moving
|
||||
target...)
|
||||
o Some kind of support for CTags tags files
|
||||
o Scope resolution for object members
|
||||
o Python plugin interface (different concept from Lua scripting)
|
||||
|
@ -1377,7 +1377,8 @@ static gchar *find_calltip(const gchar *word, GeanyFiletype *ft)
|
||||
|
||||
g_return_val_if_fail(ft && word && *word, NULL);
|
||||
|
||||
tags = tm_workspace_find(word, arg_types | tm_tag_class_t, attrs, FALSE, ft->lang);
|
||||
/* use all types in case language uses wrong tag type e.g. python "members" instead of "methods" */
|
||||
tags = tm_workspace_find(word, tm_tag_max_t, attrs, FALSE, ft->lang);
|
||||
if (tags->len == 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -61,13 +61,14 @@ static boolean isIdentifierCharacter (int c)
|
||||
* extract all relevant information and create a tag.
|
||||
*/
|
||||
static void makeFunctionTag (vString *const function,
|
||||
vString *const parent, int is_class_parent)
|
||||
vString *const parent, int is_class_parent, const char *arglist)
|
||||
{
|
||||
tagEntryInfo tag;
|
||||
initTagEntry (&tag, vStringValue (function));
|
||||
|
||||
tag.kindName = "function";
|
||||
tag.kind = 'f';
|
||||
tag.extensionFields.arglist = arglist;
|
||||
|
||||
if (vStringLength (parent) > 0)
|
||||
{
|
||||
@ -291,11 +292,39 @@ static void parseImports (const char *cp)
|
||||
vStringDelete (name_next);
|
||||
}
|
||||
|
||||
/* modified from get.c getArglistFromStr().
|
||||
* warning: terminates rest of string past arglist!
|
||||
* note: does not ignore brackets inside strings! */
|
||||
static char *parseArglist(const char *buf)
|
||||
{
|
||||
char *start, *end;
|
||||
int level;
|
||||
if (NULL == buf)
|
||||
return NULL;
|
||||
if (NULL == (start = strchr(buf, '(')))
|
||||
return NULL;
|
||||
for (level = 1, end = start + 1; level > 0; ++end)
|
||||
{
|
||||
if ('\0' == *end)
|
||||
break;
|
||||
else if ('(' == *end)
|
||||
++ level;
|
||||
else if (')' == *end)
|
||||
-- level;
|
||||
}
|
||||
*end = '\0';
|
||||
return strdup(start);
|
||||
}
|
||||
|
||||
static void parseFunction (const char *cp, vString *const def,
|
||||
vString *const parent, int is_class_parent)
|
||||
{
|
||||
char *arglist;
|
||||
|
||||
cp = parseIdentifier (cp, def);
|
||||
makeFunctionTag (def, parent, is_class_parent);
|
||||
arglist = parseArglist (cp);
|
||||
makeFunctionTag (def, parent, is_class_parent, arglist);
|
||||
eFree (arglist);
|
||||
}
|
||||
|
||||
/* Get the combined name of a nested symbol. Classes are separated with ".",
|
||||
|
Loading…
x
Reference in New Issue
Block a user