@b4n commented on this pull request.


>  {
+       GeanyDocument *doc = document_get_current();
+
+       if (plugin_extension_goto_provided(doc, NULL))
+               return plugin_extension_goto_perform(doc, pos, definition);

there's still the question of whether this should really be guarded behind 
Geany thinking there's a word.  IMO it shouldn't, and callers should stop being 
guarded behind it, and the `perform()` call should return `FALSE` if there's no 
word to act on.  This would alleviate the artificial dependency on Geany 
dictating there's a word -- but not actually providing it.

So the callers would look like
```c
static void goto_tag(GeanyDocument *doc, gboolean definition)
{
        if (! symbols_goto_tag(sci_get_current_position(doc->editor->sci), 
definition))
                utils_beep();
}
```
and
```c
                        if (! symbols_goto_tag(editor_info.click_pos, TRUE))
                                keybindings_send_command(GEANY_KEY_GROUP_GOTO, 
GEANY_KEYS_GOTO_MATCHINGBRACE);
                        return TRUE;
```

And this here just removes the `name` argument and replaces it with
```c
        const gchar *name;

        /* … */

        editor_find_current_word(doc->editor, pos,
                editor_info.current_word, GEANY_MAX_WORD_LENGTH, NULL);
        name = *editor_info.current_word ? editor_info.current_word : NULL;

        if (! name)
                return FALSE;
```
(and possibly return `TRUE` below when there was a match but it wasn't handled 
-- or keep it returning `FALSE`, the only thing that happens then is calling 
*goto mathcing brace*, which might be fine).

---
This might or might not be a detail, it depends on whether extensions depend on 
the fact there's a word, or if they are written carefully enough not to 
actually depend on it.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3849#pullrequestreview-2111338041
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3849/review/[email protected]>

Reply via email to