Trait sourceview4::prelude::CompletionExt
source · pub trait CompletionExt: IsA<Completion> + Sealed + 'static {
Show 45 methods
// Provided methods
fn add_provider(
&self,
provider: &impl IsA<CompletionProvider>
) -> Result<(), Error> { ... }
fn block_interactive(&self) { ... }
fn info_window(&self) -> Option<CompletionInfo> { ... }
fn providers(&self) -> Vec<CompletionProvider> { ... }
fn view(&self) -> Option<View> { ... }
fn hide(&self) { ... }
fn remove_provider(
&self,
provider: &impl IsA<CompletionProvider>
) -> Result<(), Error> { ... }
fn start(
&self,
providers: &[CompletionProvider],
context: &impl IsA<CompletionContext>
) -> bool { ... }
fn unblock_interactive(&self) { ... }
fn accelerators(&self) -> u32 { ... }
fn set_accelerators(&self, accelerators: u32) { ... }
fn auto_complete_delay(&self) -> u32 { ... }
fn set_auto_complete_delay(&self, auto_complete_delay: u32) { ... }
fn proposal_page_size(&self) -> u32 { ... }
fn set_proposal_page_size(&self, proposal_page_size: u32) { ... }
fn provider_page_size(&self) -> u32 { ... }
fn set_provider_page_size(&self, provider_page_size: u32) { ... }
fn is_remember_info_visibility(&self) -> bool { ... }
fn set_remember_info_visibility(&self, remember_info_visibility: bool) { ... }
fn selects_on_show(&self) -> bool { ... }
fn set_select_on_show(&self, select_on_show: bool) { ... }
fn shows_headers(&self) -> bool { ... }
fn set_show_headers(&self, show_headers: bool) { ... }
fn shows_icons(&self) -> bool { ... }
fn set_show_icons(&self, show_icons: bool) { ... }
fn connect_activate_proposal<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_activate_proposal(&self) { ... }
fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_hide(&self) { ... }
fn connect_move_cursor<F: Fn(&Self, ScrollStep, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_move_cursor(&self, step: ScrollStep, num: i32) { ... }
fn connect_move_page<F: Fn(&Self, ScrollStep, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_move_page(&self, step: ScrollStep, num: i32) { ... }
fn connect_populate_context<F: Fn(&Self, &CompletionContext) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_populate_context(&self, context: &CompletionContext) { ... }
fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_show(&self) { ... }
fn connect_accelerators_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_auto_complete_delay_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_proposal_page_size_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_provider_page_size_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_remember_info_visibility_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_select_on_show_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_show_headers_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_show_icons_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn add_provider(
&self,
provider: &impl IsA<CompletionProvider>
) -> Result<(), Error>
fn add_provider( &self, provider: &impl IsA<CompletionProvider> ) -> Result<(), Error>
Add a new CompletionProvider
to the completion object. This will
add a reference provider
, so make sure to unref your own copy when you
no longer need it.
provider
Returns
true
if provider
was successfully added, otherwise if error
is provided, it will be set with the error and false
is returned.
sourcefn block_interactive(&self)
fn block_interactive(&self)
Block interactive completion. This can be used to disable interactive
completion when inserting or deleting text from the buffer associated with
the completion. Use unblock_interactive()
to enable
interactive completion again.
This function may be called multiple times. It will continue to block
interactive completion until unblock_interactive()
has been called the same number of times.
sourcefn info_window(&self) -> Option<CompletionInfo>
fn info_window(&self) -> Option<CompletionInfo>
The info widget is the window where the completion displays optional extra information of the proposal.
Returns
The CompletionInfo
window
associated with self
.
sourcefn providers(&self) -> Vec<CompletionProvider>
fn providers(&self) -> Vec<CompletionProvider>
Get list of providers registered on self
. The returned list is owned
by the completion and should not be freed.
Returns
list of CompletionProvider
.
sourcefn remove_provider(
&self,
provider: &impl IsA<CompletionProvider>
) -> Result<(), Error>
fn remove_provider( &self, provider: &impl IsA<CompletionProvider> ) -> Result<(), Error>
sourcefn start(
&self,
providers: &[CompletionProvider],
context: &impl IsA<CompletionContext>
) -> bool
fn start( &self, providers: &[CompletionProvider], context: &impl IsA<CompletionContext> ) -> bool
Starts a new completion with the specified CompletionContext
and
a list of potential candidate providers for completion.
It can be convenient for showing a completion on-the-fly, without the need to
add or remove providers to the Completion
.
Another solution is to add providers with
add_provider()
, and implement
CompletionProviderExt::match_()
for each provider.
providers
a list of CompletionProvider
, or None
.
context
The CompletionContext
with which to start the completion.
Returns
true
if it was possible to the show completion window.
sourcefn unblock_interactive(&self)
fn unblock_interactive(&self)
Unblock interactive completion. This can be used after using
block_interactive()
to enable interactive completion
again.
sourcefn accelerators(&self) -> u32
fn accelerators(&self) -> u32
Number of keyboard accelerators to show for the first proposals. For
example, to activate the first proposal, the user can press
<keycombo>``<keycap>
Alt</keycap>``<keycap>
1</keycap>``</keycombo>
.
sourcefn set_accelerators(&self, accelerators: u32)
fn set_accelerators(&self, accelerators: u32)
Number of keyboard accelerators to show for the first proposals. For
example, to activate the first proposal, the user can press
<keycombo>``<keycap>
Alt</keycap>``<keycap>
1</keycap>``</keycombo>
.
sourcefn auto_complete_delay(&self) -> u32
fn auto_complete_delay(&self) -> u32
Determines the popup delay (in milliseconds) at which the completion will be shown for interactive completion.
sourcefn set_auto_complete_delay(&self, auto_complete_delay: u32)
fn set_auto_complete_delay(&self, auto_complete_delay: u32)
Determines the popup delay (in milliseconds) at which the completion will be shown for interactive completion.
sourcefn proposal_page_size(&self) -> u32
fn proposal_page_size(&self) -> u32
The scroll page size of the proposals in the completion window. In
other words, when <keycap>
PageDown</keycap>
or
<keycap>
PageUp</keycap>
is pressed, the selected
proposal becomes the one which is located one page size backward or
forward.
See also the move-cursor
signal.
sourcefn set_proposal_page_size(&self, proposal_page_size: u32)
fn set_proposal_page_size(&self, proposal_page_size: u32)
The scroll page size of the proposals in the completion window. In
other words, when <keycap>
PageDown</keycap>
or
<keycap>
PageUp</keycap>
is pressed, the selected
proposal becomes the one which is located one page size backward or
forward.
See also the move-cursor
signal.
sourcefn provider_page_size(&self) -> u32
fn provider_page_size(&self) -> u32
The scroll page size of the provider pages in the completion window.
See the move-page
signal.
sourcefn set_provider_page_size(&self, provider_page_size: u32)
fn set_provider_page_size(&self, provider_page_size: u32)
The scroll page size of the provider pages in the completion window.
See the move-page
signal.
sourcefn is_remember_info_visibility(&self) -> bool
fn is_remember_info_visibility(&self) -> bool
Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again.
sourcefn set_remember_info_visibility(&self, remember_info_visibility: bool)
fn set_remember_info_visibility(&self, remember_info_visibility: bool)
Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again.
sourcefn selects_on_show(&self) -> bool
fn selects_on_show(&self) -> bool
Determines whether the first proposal should be selected when the completion is first shown.
sourcefn set_select_on_show(&self, select_on_show: bool)
fn set_select_on_show(&self, select_on_show: bool)
Determines whether the first proposal should be selected when the completion is first shown.
sourcefn shows_headers(&self) -> bool
fn shows_headers(&self) -> bool
Determines whether provider headers should be shown in the proposal list. It can be useful to disable when there is only one provider.
sourcefn set_show_headers(&self, show_headers: bool)
fn set_show_headers(&self, show_headers: bool)
Determines whether provider headers should be shown in the proposal list. It can be useful to disable when there is only one provider.
sourcefn shows_icons(&self) -> bool
fn shows_icons(&self) -> bool
Determines whether provider and proposal icons should be shown in the completion popup.
sourcefn set_show_icons(&self, show_icons: bool)
fn set_show_icons(&self, show_icons: bool)
Determines whether provider and proposal icons should be shown in the completion popup.
sourcefn connect_activate_proposal<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_activate_proposal<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId
The activate-proposal
signal is a
keybinding signal which gets emitted when the user initiates
a proposal activation.
Applications should not connect to it, but may emit it with
g_signal_emit_by_name()
if they need to control the proposal
activation programmatically.
fn emit_activate_proposal(&self)
sourcefn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the completion window is hidden. The default handler will actually hide the window.
fn emit_hide(&self)
sourcefn connect_move_cursor<F: Fn(&Self, ScrollStep, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_move_cursor<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F ) -> SignalHandlerId
The move-cursor
signal is a keybinding
signal which gets emitted when the user initiates a cursor
movement.
The <keycap>
Up</keycap>
, <keycap>
Down</keycap>
,
<keycap>
PageUp</keycap>
, <keycap>
PageDown</keycap>
,
<keycap>
Home</keycap>
and <keycap>
End</keycap>
keys are bound to the
normal behavior expected by those keys.
When step
is equal to gtk::ScrollStep::Pages
, the page size is defined by
the proposal-page-size
property. It is used for
the <keycap>
PageDown</keycap>
and <keycap>
PageUp</keycap>
keys.
Applications should not connect to it, but may emit it with
g_signal_emit_by_name()
if they need to control the cursor
programmatically.
step
The gtk::ScrollStep
by which to move the cursor
num
The amount of steps to move the cursor
fn emit_move_cursor(&self, step: ScrollStep, num: i32)
sourcefn connect_move_page<F: Fn(&Self, ScrollStep, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_move_page<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F ) -> SignalHandlerId
The move-page
signal is a keybinding
signal which gets emitted when the user initiates a page
movement (i.e. switches between provider pages).
<keycombo>``<keycap>
Control</keycap>``<keycap>
Left</keycap>``</keycombo>
is for going to the previous provider.
<keycombo>``<keycap>
Control</keycap>``<keycap>
Right</keycap>``</keycombo>
is for going to the next provider.
<keycombo>``<keycap>
Control</keycap>``<keycap>
Home</keycap>``</keycombo>
is for displaying all the providers.
<keycombo>``<keycap>
Control</keycap>``<keycap>
End</keycap>``</keycombo>
is for going to the last provider.
When step
is equal to gtk::ScrollStep::Pages
, the page size is defined by
the provider-page-size
property.
Applications should not connect to it, but may emit it with
g_signal_emit_by_name()
if they need to control the page selection
programmatically.
step
The gtk::ScrollStep
by which to move the page
num
The amount of steps to move the page
fn emit_move_page(&self, step: ScrollStep, num: i32)
sourcefn connect_populate_context<F: Fn(&Self, &CompletionContext) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_populate_context<F: Fn(&Self, &CompletionContext) + 'static>( &self, f: F ) -> SignalHandlerId
Emitted just before starting to populate the completion with providers. You can use this signal to add additional attributes in the context.
context
The CompletionContext
for the current completion
fn emit_populate_context(&self, context: &CompletionContext)
sourcefn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the completion window is shown. The default handler will actually show the window.