GtkSource.Completion¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The buffer for the view |
||
r/w/en |
Number of rows to display to the user |
||
r/w |
Remember Info Visibility |
||
r/w |
Select on Show |
||
r/w |
If icons should be shown in the completion results |
||
r/w/co |
The text view for which to provide completion |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The “hide” signal is emitted when the completion window should be hidden. |
|
The “provided-added” signal is emitted when a new provider is added to the completion. |
|
The “provided-removed” signal is emitted when a provider has been removed from the completion. |
|
The “show” signal is emitted when the completion window should be shown. |
Fields¶
- Inherited:
Class Details¶
- class GtkSource.Completion(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Main Completion Object.
The completion system helps the user when they writes some text, such as words, command names, functions, and suchlike. Proposals can be shown, to complete the text the user is writing. Each proposal can contain an additional piece of information (for example documentation), that is displayed when the “Details” button is clicked.
Proposals are created via a [iface`CompletionProvider`]. There can be for example a provider to complete words (see [class`CompletionWords`]), another provider for the completion of function names, etc. To add a provider, call [method`Completion`.add_provider].
The [iface`CompletionProposal`] interface represents a proposal.
If a proposal contains extra information (see
GtkSource.CompletionColumn.DETAILS
), it will be displayed in a supplemental details window, which appears when the “Details” button is clicked.Each [class`View`] object is associated with a [class`Completion`] instance. This instance can be obtained with [method`View`.get_completion]. The [class`View`] class contains also the [signal`View`:py:func:::show-completion<GtkSource.Completion.signals.show_completion>] signal.
A same [iface`CompletionProvider`] object can be used for several
GtkSourceCompletion
’s.- classmethod fuzzy_highlight(haystack, casefold_query)¶
- Parameters:
- Returns:
a
Pango.AttrList
orNone
- Return type:
This will add
<b>
tags around matched characters in haystack based on casefold_query.
- classmethod fuzzy_match(haystack, casefold_needle)¶
- Parameters:
casefold_needle (
str
) – AGLib.utf8_casefold
() version of the needle.
- Returns:
True
if haystack matched casefold_needle, otherwiseFalse
.- priority:
An optional location for the score of the match
- Return type:
This helper function can do a fuzzy match for you giving a haystack and casefolded needle.
Casefold your needle using [func`GLib`.utf8_casefold] before running the query.
Score will be set with the score of the match upon success. Otherwise, it will be set to zero.
- add_provider(provider)¶
- Parameters:
provider (
GtkSource.CompletionProvider
) – aGtkSource.CompletionProvider
Adds a [iface`CompletionProvider`] to the list of providers to be queried for completion results.
- block_interactive()¶
- get_buffer()¶
- Returns:
- Return type:
Gets the connected [class`View`]’s [class`Buffer`]
- get_view()¶
- Returns:
- Return type:
Gets the [class`View`] that owns the [class`Completion`].
- hide()¶
Emits the “hide” signal.
When the “hide” signal is emitted, the completion window will be dismissed.
- remove_provider(provider)¶
- Parameters:
provider (
GtkSource.CompletionProvider
) – aGtkSource.CompletionProvider
Removes a [iface`CompletionProvider`] previously added with [method`Completion`.add_provider].
- show()¶
Emits the “show” signal.
When the “show” signal is emitted, the completion window will be displayed if there are any results available.
- unblock_interactive()¶
Signal Details¶
- GtkSource.Completion.signals.hide(completion)¶
- Signal Name:
hide
- Flags:
- Parameters:
completion (
GtkSource.Completion
) – The object which received the signal
The “hide” signal is emitted when the completion window should be hidden.
- GtkSource.Completion.signals.provider_added(completion, provider)¶
- Signal Name:
provider-added
- Flags:
- Parameters:
completion (
GtkSource.Completion
) – The object which received the signalprovider (
GtkSource.CompletionProvider
) – aGtkSource.CompletionProvider
The “provided-added” signal is emitted when a new provider is added to the completion.
- GtkSource.Completion.signals.provider_removed(completion, provider)¶
- Signal Name:
provider-removed
- Flags:
- Parameters:
completion (
GtkSource.Completion
) – The object which received the signalprovider (
GtkSource.CompletionProvider
) – aGtkSource.CompletionProvider
The “provided-removed” signal is emitted when a provider has been removed from the completion.
- GtkSource.Completion.signals.show(completion)¶
- Signal Name:
show
- Flags:
- Parameters:
completion (
GtkSource.Completion
) – The object which received the signal
The “show” signal is emitted when the completion window should be shown.
Property Details¶
- GtkSource.Completion.props.buffer¶
- Name:
buffer
- Type:
- Default Value:
- Flags:
The
Gtk.TextBuffer
for theGtkSource.Completion
:view
. This is a convenience property for providers.
- GtkSource.Completion.props.page_size¶
- Name:
page-size
- Type:
- Default Value:
5
- Flags:
The number of rows to display to the user before scrolling.
- GtkSource.Completion.props.remember_info_visibility¶
-
Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again.
- GtkSource.Completion.props.select_on_show¶
-
Determines whether the first proposal should be selected when the completion is first shown.
- GtkSource.Completion.props.show_icons¶
-
The “show-icons” property denotes if icons should be displayed within the list of completions presented to the user.
- GtkSource.Completion.props.view¶
- Name:
view
- Type:
- Default Value:
- Flags:
The “view” property is the
Gtk.TextView
for which thisGtkSource.Completion
is providing completion features.