Class Completion
- All Implemented Interfaces:
Proxy
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 CompletionProvider. There can
be for example a provider to complete words (see CompletionWords),
another provider for the completion of
function names, etc. To add a provider, call
addProvider(org.gnome.gtksourceview.CompletionProvider).
The CompletionProposal interface represents a proposal.
If a proposal contains extra information (see
CompletionColumn.DETAILS), it will be
displayed in a supplemental details window, which appears when
the "Details" button is clicked.
Each View object is associated with a Completion
instance. This instance can be obtained with
View.getCompletion(). The View class contains also the
View::show-completion signal.
A same CompletionProvider object can be used for several
GtkSourceCompletion's.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCompletion.Builder<B extends Completion.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classstatic interfaceFunctional interface declaration of theHideCallbackcallback.static interfaceFunctional interface declaration of theProviderAddedCallbackcallback.static interfaceFunctional interface declaration of theProviderRemovedCallbackcallback.static interfaceFunctional interface declaration of theShowCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Completion.Completion(MemorySegment address) Create a Completion proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProvider(CompletionProvider provider) Adds aCompletionProviderto the list of providers to be queried for completion results.protected CompletionasParent()Returns this instance as if it were its parent type.voidstatic Completion.Builder<? extends Completion.Builder> builder()ACompletion.Builderobject constructs aCompletionwith the specified properties.voidemitHide()Emits the "hide" signal.voidemitProviderAdded(@Nullable CompletionProvider provider) Emits the "provider-added" signal.voidemitProviderRemoved(@Nullable CompletionProvider provider) Emits the "provider-removed" signal.voidemitShow()Emits the "show" signal.static @Nullable AttrListfuzzyHighlight(String haystack, String casefoldQuery) This will add<b>tags around matched characters inhaystackbased oncasefoldQuery.static booleanfuzzyMatch(@Nullable String haystack, String casefoldNeedle, @Nullable Out<Integer> priority) This helper function can do a fuzzy match for you giving a haystack and casefolded needle.intstatic @Nullable TypegetType()Get the GType of the Completion classgetView()Gets theViewthat owns theCompletion.voidhide()Emits the "hide" signal.onHide(Completion.HideCallback handler) 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.onShow(Completion.ShowCallback handler) The "show" signal is emitted when the completion window should be shown.voidremoveProvider(CompletionProvider provider) Removes aCompletionProviderpreviously added withaddProvider(org.gnome.gtksourceview.CompletionProvider).voidsetPageSize(int pageSize) voidshow()Emits the "show" signal.voidMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Completion
Create a Completion proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Completion
public Completion()Creates a new Completion.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
fuzzyHighlight
This will add<b>tags around matched characters inhaystackbased oncasefoldQuery.- Parameters:
haystack- the string to be highlightedcasefoldQuery- the typed-text used to highlighthaystack- Returns:
- a
PangoAttrListornull
-
fuzzyMatch
public static boolean fuzzyMatch(@Nullable String haystack, String casefoldNeedle, @Nullable Out<Integer> priority) This helper function can do a fuzzy match for you giving a haystack and casefolded needle.Casefold your needle using
GLib.utf8Casefold(java.lang.String, long)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.casefoldNeedle- A g_utf8_casefold() version of the needle.priority- An optional location for the score of the match- Returns:
trueifhaystackmatchedcasefoldNeedle,otherwisefalse.
-
addProvider
Adds aCompletionProviderto the list of providers to be queried for completion results.- Parameters:
provider- aGtkSourceCompletionProvider
-
blockInteractive
public void blockInteractive() -
getBuffer
-
getPageSize
public int getPageSize() -
getView
-
hide
public void hide()Emits the "hide" signal.When the "hide" signal is emitted, the completion window will be dismissed.
-
removeProvider
Removes aCompletionProviderpreviously added withaddProvider(org.gnome.gtksourceview.CompletionProvider).- Parameters:
provider- aGtkSourceCompletionProvider
-
setPageSize
public void setPageSize(int pageSize) -
show
public void show()Emits the "show" signal.When the "show" signal is emitted, the completion window will be displayed if there are any results available.
-
unblockInteractive
public void unblockInteractive() -
onHide
The "hide" signal is emitted when the completion window should be hidden.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitHide
public void emitHide()Emits the "hide" signal. SeeonHide(org.gnome.gtksourceview.Completion.HideCallback). -
onProviderAdded
public SignalConnection<Completion.ProviderAddedCallback> onProviderAdded(Completion.ProviderAddedCallback handler) The "provided-added" signal is emitted when a new provider is added to the completion.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitProviderAdded
Emits the "provider-added" signal. SeeonProviderAdded(org.gnome.gtksourceview.Completion.ProviderAddedCallback). -
onProviderRemoved
public SignalConnection<Completion.ProviderRemovedCallback> onProviderRemoved(Completion.ProviderRemovedCallback handler) The "provided-removed" signal is emitted when a provider has been removed from the completion.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitProviderRemoved
Emits the "provider-removed" signal. SeeonProviderRemoved(org.gnome.gtksourceview.Completion.ProviderRemovedCallback). -
onShow
The "show" signal is emitted when the completion window should be shown.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitShow
public void emitShow()Emits the "show" signal. SeeonShow(org.gnome.gtksourceview.Completion.ShowCallback). -
builder
ACompletion.Builderobject constructs aCompletionwith the specified properties. Use the variousset...()methods to set properties, and finish construction withCompletion.Builder.build().- Returns:
- the builder object
-