Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for scoped function calltips #1176

Closed
wants to merge 0 commits into from

Conversation

krogank9
Copy link

@krogank9 krogank9 commented Aug 12, 2016

I created function read_scope_prefix which is similar to read_current_word. It gets the scope of the word the cursor is on:

if the user types: ScopeA::ScopeB::Function
it will return ScopeA::ScopeB

Then I used my read_scope_prefix function in editor_show_calltip where find_calltips is called. To find_calltips I added an argument const gchar *scope to send the value over. Then, inside find_calltips the function tm_workspace_find (which then calls fill_find_tags_array) is called. tm_workspace_find & fill_find_tags_array already had a scope argument that was unused, so I just passed in the scope argument.

However, in fill_find_tags_array, when passed a non-null scope it filters any tags that are not exactly equal to that scope. E.g. if you have ClassA { setterFunc(abc) {} } ClassA::setterFunc will work but then ClassA obj.setterFunc will no longer work because scope != NULL. So I added a check inside fill_find_tags_array. First, it loops through the list of tags and attempts to find an exact match for the scope being typed, if it doesn't find a match, the function will just ignore the scope as if it had been set to NULL from the start.

@@ -109,6 +109,8 @@ static void close_block(GeanyEditor *editor, gint pos);
static void editor_highlight_braces(GeanyEditor *editor, gint cur_pos);
static void read_current_word(GeanyEditor *editor, gint pos, gchar *word, gsize wordlen,
const gchar *wc, gboolean stem);
static void read_current_scope(GeanyEditor *editor, gint pos, gchar *word, gsize wordlen,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't read the "current" scope, which is a lexical attribute of the position in the code, rather it reads scope related prefixes that exist in the text.

So I suggest renaming it to read_scope_prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants