Top | ![]() |
![]() |
![]() |
![]() |
GIcon * | ide_completion_provider_get_icon () |
gint | ide_completion_provider_get_priority () |
gchar * | ide_completion_provider_get_title () |
void | ide_completion_provider_populate_async () |
GListModel * | ide_completion_provider_populate_finish () |
void | ide_completion_provider_display_proposal () |
void | ide_completion_provider_activate_poposal () |
gboolean | ide_completion_provider_refilter () |
gboolean | ide_completion_provider_is_trigger () |
gboolean | ide_completion_provider_key_activates () |
gchar * | ide_completion_provider_get_comment () |
GIcon *
ide_completion_provider_get_icon (IdeCompletionProvider *self
);
Gets the GIcon to represent this provider. This may be used in UI to allow the user to filter the results to only those of this completion provider.
gint ide_completion_provider_get_priority (IdeCompletionProvider *self
,IdeCompletionContext *context
);
Gets the priority for the completion provider.
This value is used to group all of the providers proposals together when displayed, with relation to other providers.
The context
is provided as some providers may want to lower their
priority based on the position of the completion.
Since: 3.28
gchar *
ide_completion_provider_get_title (IdeCompletionProvider *self
);
Gets the title for the provider. This may be used in UI to give the user context about the type of results that are displayed.
void ide_completion_provider_populate_async (IdeCompletionProvider *self
,IdeCompletionContext *context
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously requests the provider populate the contents.
For completion providers that can provide intermediate results immediately,
use ide_completion_context_set_proposals_for_provider()
to notify of results
while the async operation is in progress.
self |
||
context |
the completion context |
|
cancellable |
a GCancellable, or |
[nullable] |
callback |
a GAsyncReadyCallback
or |
[nullable][scope async][closure user_data] |
user_data |
closure data for |
Since: 3.28
GListModel * ide_completion_provider_populate_finish (IdeCompletionProvider *self
,GAsyncResult *result
,GError **error
);
void ide_completion_provider_display_proposal (IdeCompletionProvider *self
,IdeCompletionListBoxRow *row
,IdeCompletionContext *context
,const gchar *typed_text
,IdeCompletionProposal *proposal
);
Requests that the provider update row
with values from proposal
.
The design rational about having this operation part of the IdeCompletionProvider interface (as opposed to the IdeCompletionProposal interface) is that it allows for some optimizations and code simplification on behalf of completion providers.
self |
||
row |
||
context |
||
typed_text |
the typed text for the proposal. |
[nullable] |
proposal |
an IdeCompletionProposal |
Since: 3.30
void ide_completion_provider_activate_poposal (IdeCompletionProvider *self
,IdeCompletionContext *context
,IdeCompletionProposal *proposal
,const GdkEventKey *key
);
gboolean ide_completion_provider_refilter (IdeCompletionProvider *self
,IdeCompletionContext *context
,GListModel *proposals
);
This requests that the completion provider refilter the results based on
changes to the IdeCompletionContext, such as additional text typed by the
user. If the provider can refine the results, then the provider should do
so and return TRUE
.
Otherwise, FALSE
is returned and the context will request a new set of
completion results.
Since: 3.28
gboolean ide_completion_provider_is_trigger (IdeCompletionProvider *self
,const GtkTextIter *iter
,gunichar ch
);
Completion providers may want to trigger that the completion window is displayed upon insertion of a particular character. For example, a C indenter might want to trigger after -> or . is inserted.
ch
is set to the character that was just inserted. If you need something
more complex, copy iter
and move it backwards twice to check the character
previous to ch
.
Since: 3.30
gboolean ide_completion_provider_key_activates (IdeCompletionProvider *self
,IdeCompletionProposal *proposal
,const GdkEventKey *key
);
This function is called to ask the provider if the key-press event should force activation of the proposal. This is useful for languages where you might want to activate the completion from a language-specific character.
For example, in C, you might want to use period (.) to activate the completion and insert either (.) or (->) based on the type.
self |
||
proposal |
an IdeCompletionProposal created by the provider |
|
key |
the GdkEventKey for the current keyboard event |
Since: 3.30
gchar * ide_completion_provider_get_comment (IdeCompletionProvider *self
,IdeCompletionProposal *proposal
);
If the completion proposal has a comment, the provider should return a newly allocated string containing it.
This is displayed at the bottom of the completion window.
Since: 3.30
#define IDE_TYPE_COMPLETION_PROVIDER (ide_completion_provider_get_type ())
struct IdeCompletionProviderInterface { GTypeInterface parent; void (*load) (IdeCompletionProvider *self, IdeContext *context); GIcon *(*get_icon) (IdeCompletionProvider *self); gint (*get_priority) (IdeCompletionProvider *self, IdeCompletionContext *context); gchar *(*get_title) (IdeCompletionProvider *self); void (*populate_async) (IdeCompletionProvider *self, IdeCompletionContext *context, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); GListModel *(*populate_finish) (IdeCompletionProvider *self, GAsyncResult *result, GError **error); void (*display_proposal) (IdeCompletionProvider *self, IdeCompletionListBoxRow *row, IdeCompletionContext *context, const gchar *typed_text, IdeCompletionProposal *proposal); void (*activate_proposal) (IdeCompletionProvider *self, IdeCompletionContext *context, IdeCompletionProposal *proposal, const GdkEventKey *key); gboolean (*refilter) (IdeCompletionProvider *self, IdeCompletionContext *context, GListModel *proposals); gboolean (*is_trigger) (IdeCompletionProvider *self, const GtkTextIter *iter, gunichar ch); gboolean (*key_activates) (IdeCompletionProvider *self, IdeCompletionProposal *proposal, const GdkEventKey *key); gchar *(*get_comment) (IdeCompletionProvider *self, IdeCompletionProposal *proposal); };