The changes below replace the `__init__` method name on the calltip with its class and so make the calltip look more consistent with the others, as shown in https://github.com/geany/geany/pull/3334#issuecomment-1321212468.
```diff diff --git a/src/editor.c b/src/editor.c index 20b9c56cb..a21aa8667 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1878,6 +1878,17 @@ static gchar *find_calltip(const gchar *word, GeanyFiletype *ft) g_free(scope); if (constructor_tags->len != 0) { /* found constructor tag, so use it instead of the class tag */ + TMTag *constructor_tag; + foreach_ptr_array(constructor_tag, i, constructor_tags) + { + if (constructor_tag->type == tm_tag_method_t && constructor_tag->scope != NULL) + { + g_free(constructor_tag->name); + constructor_tag->name = g_strdup(constructor_tag->scope); + g_free(constructor_tag->scope); + constructor_tag->scope = NULL; + } + } g_ptr_array_free(tags, TRUE); tags = constructor_tags; } ``` To reproduce use the following simple test file and trigger the calltip on `__init__`, then on `LocalClass` and then on `EncodedWord`. ```python class LocalClass(object): def __init__(self, arg1, arg2=None): super().__init__() # custom class from above LocalClass() # class imported via global tags file EncodedWord() # imported via global tags file in ctags format # EncodedWord /unknown 1;" kind:class signature:(*args, **kw) ``` However, this crashes Geany upon the last triggered calltip on `EncodedWord`. It seems in `tm_tags_find` on calculating the `tagCount` there is no `last` tag found and it is NULL, so the calculation is "0 - first +1" which results in wrong numbers obviously. I changed the calculation to `*tagCount = (last) ? last - first + 1 : 1;` to return 1 as `tagCount` when we did not find a `last` tag but only the first one. This made it much more stable but I still got a few random crashes which I cannot reliably reproduce and also sometimes after all three calltips have been shown, the calltip on `LocalClass` is missing :(. Sorry for the vague description. I'm not sure whether it is worth to proceed with this, it already required quite some efforts for a rather small and specific feature. If anyone has a quick clue what I'm doing wrong, I could give it another try. Otherwise I think I'll leave it as is. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/3334#issuecomment-1345540217 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany/pull/3334/c1345540...@github.com>