Trait sourceview4::prelude::CompletionProviderExt
source · pub trait CompletionProviderExt: IsA<CompletionProvider> + Sealed + 'static {
Show 13 methods
// Provided methods
fn activate_proposal(
&self,
proposal: &impl IsA<CompletionProposal>,
iter: &mut TextIter
) -> bool { ... }
fn activation(&self) -> CompletionActivation { ... }
fn gicon(&self) -> Option<Icon> { ... }
fn icon(&self) -> Option<Pixbuf> { ... }
fn icon_name(&self) -> Option<GString> { ... }
fn info_widget(
&self,
proposal: &impl IsA<CompletionProposal>
) -> Option<Widget> { ... }
fn interactive_delay(&self) -> i32 { ... }
fn name(&self) -> Option<GString> { ... }
fn priority(&self) -> i32 { ... }
fn start_iter(
&self,
context: &impl IsA<CompletionContext>,
proposal: &impl IsA<CompletionProposal>
) -> Option<TextIter> { ... }
fn match_(&self, context: &impl IsA<CompletionContext>) -> bool { ... }
fn populate(&self, context: &impl IsA<CompletionContext>) { ... }
fn update_info(
&self,
proposal: &impl IsA<CompletionProposal>,
info: &impl IsA<CompletionInfo>
) { ... }
}
Expand description
Provided Methods§
sourcefn activate_proposal(
&self,
proposal: &impl IsA<CompletionProposal>,
iter: &mut TextIter
) -> bool
fn activate_proposal( &self, proposal: &impl IsA<CompletionProposal>, iter: &mut TextIter ) -> bool
Activate proposal
at iter
. When this functions returns false
, the default
activation of proposal
will take place which replaces the word at iter
with the text of proposal
(see CompletionProposalExt::text()
).
Here is how the default activation selects the boundaries of the word to
replace. The end of the word is iter
. For the start of the word, it depends
on whether a start iter is defined for proposal
(see
start_iter()
). If a start iter is defined,
the start of the word is the start iter. Else, the word (as long as possible)
will contain only alphanumerical and the “_” characters.
proposal
iter
Returns
true
to indicate that the proposal activation has been handled,
false
otherwise.
sourcefn activation(&self) -> CompletionActivation
fn activation(&self) -> CompletionActivation
Get with what kind of activation the provider should be activated.
Returns
a combination of CompletionActivation
.
sourcefn icon(&self) -> Option<Pixbuf>
fn icon(&self) -> Option<Pixbuf>
Get the gdk_pixbuf::Pixbuf
for the icon of the self
.
Returns
The icon to be used for the provider,
or None
if the provider does not have a special icon.
sourcefn info_widget(&self, proposal: &impl IsA<CompletionProposal>) -> Option<Widget>
fn info_widget(&self, proposal: &impl IsA<CompletionProposal>) -> Option<Widget>
Get a customized info widget to show extra information of a proposal.
This allows for customized widgets on a proposal basis, although in general
providers will have the same custom widget for all their proposals and
proposal
can be ignored. The implementation of this function is optional.
If this function is not implemented, the default widget is a GtkLabel
. The
return value of CompletionProposalExt::info()
is used as the
content of the GtkLabel
.
<note>
<para>
If implemented, update_info()
<emphasis>
must</emphasis>
also be implemented.
</para>
</note>
proposal
a currently selected CompletionProposal
.
Returns
a custom gtk::Widget
to show extra
information about proposal
, or None
if the provider does not have a special
info widget.
sourcefn interactive_delay(&self) -> i32
fn interactive_delay(&self) -> i32
Get the delay in milliseconds before starting interactive completion for
this provider. A value of -1 indicates to use the default value as set
by the auto-complete-delay
property.
Returns
the interactive delay in milliseconds.
sourcefn name(&self) -> Option<GString>
fn name(&self) -> Option<GString>
Get the name of the provider. This should be a translatable name for
display to the user. For example: _(“Document word completion provider”). The
returned string must be freed with g_free()
.
Returns
a new string containing the name of the provider.
sourcefn priority(&self) -> i32
fn priority(&self) -> i32
Get the provider priority. The priority determines the order in which proposals appear in the completion popup. Higher priorities are sorted before lower priorities. The default priority is 0.
Returns
the provider priority.
sourcefn start_iter(
&self,
context: &impl IsA<CompletionContext>,
proposal: &impl IsA<CompletionProposal>
) -> Option<TextIter>
fn start_iter( &self, context: &impl IsA<CompletionContext>, proposal: &impl IsA<CompletionProposal> ) -> Option<TextIter>
Get the gtk::TextIter
at which the completion for proposal
starts. When
implemented, this information is used to position the completion window
accordingly when a proposal is selected in the completion window. The
proposal
text inside the completion window is aligned on iter
.
If this function is not implemented, the word boundary is taken to position
the completion window. See activate_proposal()
for an explanation on the word boundaries.
When the proposal
is activated, the default handler uses iter
as the start
of the word to replace. See
activate_proposal()
for more information.
context
proposal
Returns
true
if iter
was set for proposal
, false
otherwise.
iter
fn match_(&self, context: &impl IsA<CompletionContext>) -> bool
sourcefn populate(&self, context: &impl IsA<CompletionContext>)
fn populate(&self, context: &impl IsA<CompletionContext>)
Populate context
with proposals from self
added with the
CompletionContextExt::add_proposals()
function.
context
sourcefn update_info(
&self,
proposal: &impl IsA<CompletionProposal>,
info: &impl IsA<CompletionInfo>
)
fn update_info( &self, proposal: &impl IsA<CompletionProposal>, info: &impl IsA<CompletionInfo> )
Update extra information shown in info
for proposal
.
<note>
<para>
This function <emphasis>
must</emphasis>
be implemented when
info_widget()
is implemented.
</para>
</note>