Completion
Superclasses: Object
- Constructors:
Completion(**properties)
Methods
- class Completion
- add_provider(provider: CompletionProvider) None
Adds a
CompletionProvider
to the list of providers to be queried for completion results.- Parameters:
provider – a
CompletionProvider
- fuzzy_highlight(haystack: str, casefold_query: str) AttrList | None
This will add
<b>
tags around matched characters inhaystack
based oncasefold_query
.- Parameters:
haystack – the string to be highlighted
casefold_query – the typed-text used to highlight
haystack
- fuzzy_match(haystack: str | None, casefold_needle: str) tuple[bool, int]
This helper function can do a fuzzy match for you giving a haystack and casefolded needle.
Casefold your needle using
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.
- Parameters:
haystack – the string to be searched.
casefold_needle – A
utf8_casefold()
version of the needle.
- get_view() View
Gets the
View
that owns theCompletion
.
- hide() None
Emits the “hide” signal.
When the “hide” signal is emitted, the completion window will be dismissed.
- remove_provider(provider: CompletionProvider) None
Removes a
CompletionProvider
previously added withadd_provider
.- Parameters:
provider – a
CompletionProvider
Properties
- class Completion
- props.buffer: TextView
The
TextBuffer
for theCompletion
:view. This is a convenience property for providers.
- props.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.
- props.select_on_show: bool
Determines whether the first proposal should be selected when the completion is first shown.
- props.show_icons: bool
The “show-icons” property denotes if icons should be displayed within the list of completions presented to the user.
- props.view: View
The “view” property is the
TextView
for which thisCompletion
is providing completion features.
Signals
- class Completion.signals
-
- provider_added(provider: CompletionProvider) None
The “provided-added” signal is emitted when a new provider is added to the completion.
- Parameters:
provider – a
CompletionProvider
- provider_removed(provider: CompletionProvider) None
The “provided-removed” signal is emitted when a provider has been removed from the completion.
- Parameters:
provider – a
CompletionProvider