Top | ![]() |
![]() |
![]() |
![]() |
GtkTextView * | buffer | Read |
guint | page-size | Read / Write |
gboolean | remember-info-visibility | Read / Write |
gboolean | select-on-show | Read / Write |
gboolean | show-icons | Read / Write |
GtkSourceView * | view | Read / Write / Construct Only |
void | hide | Action |
void | provider-added | Run Last |
void | provider-removed | Run Last |
void | show | Action |
The completion system helps the user when he/she 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 GtkSourceCompletionProvider. There can
be for example a provider to complete words (see
GtkSourceCompletionWords), another provider for the completion of
function names, etc. To add a provider, call
gtk_source_completion_add_provider()
.
When several providers match, they are all shown in the completion window, but one can switch between providers: see the “move-page” signal. It is also possible to activate the first proposals with key bindings, see the “accelerators” property.
The GtkSourceCompletionProposal interface represents a proposal.
If a proposal contains extra information (see
GTK_SOURCE_COMPLETION_COLUMN_DETAILS
), it will be
displayed in a supplemental details window, which appears when
the "Details" button is clicked.
Each GtkSourceView object is associated with a GtkSourceCompletion
instance. This instance can be obtained with
gtk_source_view_get_completion()
. The GtkSourceView class contains also the
“show-completion” signal.
A same GtkSourceCompletionProvider object can be used for several GtkSourceCompletion's.
GtkSourceView *
gtk_source_completion_get_view (GtkSourceCompletion *self
);
Gets the GtkSourceView that owns the GtkSourceCompletion.
Since: 5.0
GtkSourceBuffer *
gtk_source_completion_get_buffer (GtkSourceCompletion *self
);
Gets the connected GtkSourceView's GtkSourceBuffer
Since: 5.0
void
gtk_source_completion_show (GtkSourceCompletion *self
);
Emits the "show" signal.
When the "show" signal is emitted, the completion window will be displayed if there are any results available.
Since: 5.0
void
gtk_source_completion_hide (GtkSourceCompletion *self
);
Emits the "hide" signal.
When the "hide" signal is emitted, the completion window will be dismissed.
Since: 5.0
void gtk_source_completion_add_provider (GtkSourceCompletion *self
,GtkSourceCompletionProvider *provider
);
Adds an GtkSourceCompletionProvider to the list of providers to be queried for completion results.
Since: 5.0
void gtk_source_completion_remove_provider (GtkSourceCompletion *self
,GtkSourceCompletionProvider *provider
);
Removes an GtkSourceCompletionProvider previously added with
gtk_source_completion_add_provider()
.
Since: 5.0
void
gtk_source_completion_block_interactive
(GtkSourceCompletion *self
);
void
gtk_source_completion_unblock_interactive
(GtkSourceCompletion *self
);
guint
gtk_source_completion_get_page_size (GtkSourceCompletion *self
);
void gtk_source_completion_set_page_size (GtkSourceCompletion *self
,guint page_size
);
gboolean gtk_source_completion_fuzzy_match (const char *haystack
,const char *casefold_needle
,guint *priority
);
This helper function can do a fuzzy match for you giving a haystack and
casefolded needle. Casefold your needle using g_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.
haystack |
the string to be searched. |
[nullable] |
casefold_needle |
A |
|
priority |
An optional location for the score of the match. |
[out][allow-none] |
Since: 5.0
PangoAttrList * gtk_source_completion_fuzzy_highlight (const char *haystack
,const char *casefold_query
);
This will add <b> tags around matched characters in haystack
based on casefold_query
.
haystack |
the string to be highlighted |
|
casefold_query |
the typed-text used to highlight |
Since: 5.0
“buffer”
property “buffer” GtkTextView *
The GtkTextBuffer for the “view”. This is a convenience property for providers.
Owner: GtkSourceCompletion
Flags: Read
Since: 5.0
“page-size”
property“page-size” guint
The number of rows to display to the user before scrolling.
Owner: GtkSourceCompletion
Flags: Read / Write
Allowed values: [1,32]
Default value: 5
Since: 5.0
“remember-info-visibility”
property“remember-info-visibility” gboolean
Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again.
Owner: GtkSourceCompletion
Flags: Read / Write
Default value: FALSE
“select-on-show”
property“select-on-show” gboolean
Determines whether the first proposal should be selected when the completion is first shown.
Owner: GtkSourceCompletion
Flags: Read / Write
Default value: FALSE
“show-icons”
property“show-icons” gboolean
The "show-icons" property denotes if icons should be displayed within the list of completions presented to the user.
Owner: GtkSourceCompletion
Flags: Read / Write
Default value: TRUE
“view”
property“view” GtkSourceView *
The "view" property is the GtkTextView for which this GtkSourceCompletion is providing completion features.
Owner: GtkSourceCompletion
Flags: Read / Write / Construct Only
Since: 5.0
“hide”
signalvoid user_function (GtkSourceCompletion *self, gpointer user_data)
The "hide" signal is emitted when the completion window should be hidden.
Flags: Action
Since: 5.0
“provider-added”
signalvoid user_function (GtkSourceCompletion *self, GtkSourceCompletionProvider *provider, gpointer user_data)
The "provided-added" signal is emitted when a new provider is added to the completion.
self |
an ideCompletion |
|
provider |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 5.0
“provider-removed”
signalvoid user_function (GtkSourceCompletion *self, GtkSourceCompletionProvider *provider, gpointer user_data)
The "provided-removed" signal is emitted when a provider has been removed from the completion.
self |
an ideCompletion |
|
provider |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 5.0
“show”
signalvoid user_function (GtkSourceCompletion *self, gpointer user_data)
The "show" signal is emitted when the completion window should be shown.
Flags: Action
Since: 5.0