gi-gtksource-5.0.0: GtkSource bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GtkSource.Interfaces.CompletionProvider

Description

Completion provider interface.

You must implement this interface to provide proposals to [classcompletion].

In most cases, implementations of this interface will want to use [vfunccompletionProvider.populate_async] to asynchronously populate the results to avoid blocking the main loop.

Synopsis

Exported types

newtype CompletionProvider Source #

Memory-managed wrapper type.

Constructors

CompletionProvider (ManagedPtr CompletionProvider) 

Instances

Instances details
Eq CompletionProvider Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

GObject CompletionProvider Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

ManagedPtrNewtype CompletionProvider Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

TypedObject CompletionProvider Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

Methods

glibType :: IO GType

HasParentTypes CompletionProvider Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

IsGValue (Maybe CompletionProvider) Source #

Convert CompletionProvider to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

type ParentTypes CompletionProvider Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

type ParentTypes CompletionProvider = '[Object]

class (GObject o, IsDescendantOf CompletionProvider o) => IsCompletionProvider o Source #

Type class for types which can be safely cast to CompletionProvider, for instance with toCompletionProvider.

Instances

Instances details
(GObject o, IsDescendantOf CompletionProvider o) => IsCompletionProvider o Source # 
Instance details

Defined in GI.GtkSource.Interfaces.CompletionProvider

toCompletionProvider :: (MonadIO m, IsCompletionProvider o) => o -> m CompletionProvider Source #

Cast to CompletionProvider, for types for which this is known to be safe. For general casts, use castTo.

Methods

activate

completionProviderActivate Source #

This function requests proposal to be activated by the CompletionProvider.

What the provider does to activate the proposal is specific to that provider. Many providers may choose to insert a Snippet with edit points the user may cycle through.

See also: [classsnippet], [classsnippetChunk], [methodview.push_snippet]

display

completionProviderDisplay Source #

This function requests that the CompletionProvider prepares cell to display the contents of proposal.

Based on cells column type, you may want to display different information.

This allows for columns of information among completion proposals resulting in better alignment of similar content (icons, return types, method names, and parameter lists).

getPriority

completionProviderGetPriority Source #

This function should return the priority of self in context.

The priority is used to sort groups of completion proposals by provider so that higher priority providers results are shown above lower priority providers.

Higher value indicates higher priority.

getTitle

completionProviderGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsCompletionProvider a) 
=> a

self: a CompletionProvider

-> m (Maybe Text)

Returns: a title for the provider or Nothing

Gets the title of the completion provider, if any.

Currently, titles are not displayed in the completion results, but may be at some point in the future when non-Nothing.

isTrigger

completionProviderIsTrigger Source #

Arguments

:: (HasCallStack, MonadIO m, IsCompletionProvider a) 
=> a

self: a CompletionProvider

-> TextIter

iter: a TextIter

-> Char

ch: a gunichar of the character inserted

-> m Bool 

This function is used to determine if a character inserted into the text editor should cause a new completion request to be triggered.

An example would be period '.' which might indicate that the user wants to complete method or field names of an object.

This method will only trigger when text is inserted into the TextBuffer while the completion list is visible and a proposal is selected. Incremental key-presses (like shift, control, or alt) are not triggerable.

keyActivates

completionProviderKeyActivates Source #

Arguments

:: (HasCallStack, MonadIO m, IsCompletionProvider a, IsCompletionContext b, IsCompletionProposal c) 
=> a

self: a CompletionProvider

-> b

context: a CompletionContext

-> c

proposal: a CompletionProposal

-> Word32

keyval: a keyval such as [constgdk.KEY_period]

-> [ModifierType]

state: a ModifierType or 0

-> m Bool 

This function is used to determine if a key typed by the user should activate proposal (resulting in committing the text to the editor).

This is useful when using languages where convention may lead to less typing by the user. One example may be the use of "." or "-" to expand a field access in the C programming language.

listAlternates

completionProviderListAlternates Source #

Providers should return a list of alternates to proposal or Nothing if there are no alternates available.

This can be used by the completion view to allow the user to move laterally through similar proposals, such as overrides of methods by the same name.

populateAsync

completionProviderPopulateAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsCompletionProvider a, IsCompletionContext b, IsCancellable c) 
=> a

self: a CompletionProvider

-> b

context: a CompletionContext

-> Maybe c

cancellable: a Cancellable or Nothing

-> Maybe AsyncReadyCallback

callback: a callback to execute upon completion

-> m () 

Asynchronously requests that the provider populates the completion results for context.

For providers that would like to populate a ListModel while those results are displayed to the user, [methodcompletionContext.set_proposals_for_provider] may be used to reduce latency until the user sees results.

populateFinish

completionProviderPopulateFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsCompletionProvider a, IsAsyncResult b) 
=> a

self: a CompletionProvider

-> b

result: a AsyncResult provided to callback

-> m ListModel

Returns: a ListModel of CompletionProposal (Can throw GError)

Completes an asynchronous operation to populate a completion provider.

refilter

completionProviderRefilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsCompletionProvider a, IsCompletionContext b, IsListModel c) 
=> a

self: a CompletionProvider

-> b

context: a CompletionContext

-> c

model: a ListModel

-> m () 

This function can be used to filter results previously provided to the [classcompletionContext] by the CompletionProvider.

This can happen as the user types additional text onto the word so that previously matched items may be removed from the list instead of generating new ListModel of results.