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.Objects.CompletionContext

Description

The context of a completion.

GtkSourceCompletionContext contains information about an attept to display completion proposals to the user based on typed text in the [classview].

When typing, [classcompletion] may use registered [ifacecompletionProvider] to determine if there may be results which could be displayed. If so, a GtkSourceCompletionContext is created with information that is provided to the [ifacecompletionProvider] to populate results which might be useful to the user.

ifacecompletionProvider
are expected to provide ListModel with
ifacecompletionProposal
which may be joined together in a list of results for the user. They are also responsible for how the contents are displayed using [classcompletionCell] which allows for some level of customization.
Synopsis

Exported types

newtype CompletionContext Source #

Memory-managed wrapper type.

Constructors

CompletionContext (ManagedPtr CompletionContext) 

Instances

Instances details
Eq CompletionContext Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

GObject CompletionContext Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

ManagedPtrNewtype CompletionContext Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

TypedObject CompletionContext Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

Methods

glibType :: IO GType

HasParentTypes CompletionContext Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

IsGValue (Maybe CompletionContext) Source #

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

Instance details

Defined in GI.GtkSource.Objects.CompletionContext

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe CompletionContext -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe CompletionContext)

type ParentTypes CompletionContext Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

type ParentTypes CompletionContext = '[Object, ListModel]

class (GObject o, IsDescendantOf CompletionContext o) => IsCompletionContext o Source #

Type class for types which can be safely cast to CompletionContext, for instance with toCompletionContext.

Instances

Instances details
(GObject o, IsDescendantOf CompletionContext o) => IsCompletionContext o Source # 
Instance details

Defined in GI.GtkSource.Objects.CompletionContext

toCompletionContext :: (MonadIO m, IsCompletionContext o) => o -> m CompletionContext Source #

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

Methods

getActivation

completionContextGetActivation Source #

Gets the mode for which the context was activated.

getBounds

completionContextGetBounds Source #

Arguments

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

self: an CompletionContext

-> m (Bool, TextIter, TextIter)

Returns: True if the marks are still valid and begin or end was set.

Gets the bounds for the completion, which is the beginning of the current word (taking break characters into account) to the current insertion cursor.

If begin is non-Nothing, it will be set to the start position of the current word being completed.

If end is non-Nothing, it will be set to the insertion cursor for the current word being completed.

getBuffer

completionContextGetBuffer Source #

Arguments

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

self: an CompletionContext

-> m (Maybe Buffer)

Returns: a TextBuffer or Nothing

Gets the underlying buffer used by the context.

This is a convenience function to get the buffer via the Completion property.

getBusy

completionContextGetBusy Source #

Arguments

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

self: a CompletionContext

-> m Bool

Returns: True if the context is busy

Gets the "busy" property. This is set to True while the completion context is actively fetching proposals from registered CompletionProvider's.

getCompletion

completionContextGetCompletion Source #

Arguments

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

self: an CompletionContext

-> m (Maybe Completion)

Returns: an Completion or Nothing

Gets the Completion that created the context.

getEmpty

completionContextGetEmpty Source #

Arguments

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

self: a CompletionContext

-> m Bool

Returns: True if there are no proposals in the context

Checks if any proposals have been provided to the context.

Out of convenience, this function will return True if self is Nothing.

getLanguage

completionContextGetLanguage Source #

Arguments

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

self: a CompletionContext

-> m (Maybe Language)

Returns: a Language or Nothing

Gets the language of the underlying buffer, if any.

getProposalsForProvider

completionContextGetProposalsForProvider Source #

Arguments

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

self: a CompletionContext

-> b

provider: a CompletionProvider

-> m (Maybe ListModel)

Returns: a ListModel or Nothing

Gets the ListModel associated with the provider.

You can connect to CompletionContext::model-changed to receive notifications about when the model has been replaced by a new model.

Since: 5.6

getView

completionContextGetView Source #

Arguments

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

self: a CompletionContext

-> m (Maybe View)

Returns: a View or Nothing

Gets the text view for the context.

getWord

completionContextGetWord Source #

Arguments

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

self: a CompletionContext

-> m Text

Returns: a string containing the current word

Gets the word that is being completed up to the position of the insert mark.

listProviders

completionContextListProviders Source #

Arguments

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

self: a CompletionContext

-> m ListModel

Returns: a ListModel of CompletionProvider

Gets the providers that are associated with the context.

Since: 5.6

setProposalsForProvider

completionContextSetProposalsForProvider Source #

Arguments

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

self: an CompletionContext

-> b

provider: an CompletionProvider

-> Maybe c

results: a ListModel or Nothing

-> m () 

This function allows providers to update their results for a context outside of a call to [methodcompletionProvider.populate_async].

This can be used to immediately return results for a provider while it does additional asynchronous work. Doing so will allow the completions to update while the operation is in progress.

Properties

busy

The "busy" property is True while the completion context is populating completion proposals.

getCompletionContextBusy :: (MonadIO m, IsCompletionContext o) => o -> m Bool Source #

Get the value of the “busy” property. When overloading is enabled, this is equivalent to

get completionContext #busy

completion

The "completion" is the Completion that was used to create the context.

constructCompletionContextCompletion :: (IsCompletionContext o, MonadIO m, IsCompletion a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “completion” property. This is rarely needed directly, but it is used by new.

getCompletionContextCompletion :: (MonadIO m, IsCompletionContext o) => o -> m (Maybe Completion) Source #

Get the value of the “completion” property. When overloading is enabled, this is equivalent to

get completionContext #completion

empty

The "empty" property is True when there are no results.

It will be notified when the first result is added or the last result is removed.

getCompletionContextEmpty :: (MonadIO m, IsCompletionContext o) => o -> m Bool Source #

Get the value of the “empty” property. When overloading is enabled, this is equivalent to

get completionContext #empty

Signals

providerModelChanged

type CompletionContextProviderModelChangedCallback Source #

Arguments

 = CompletionProvider

provider: a CompletionProvider

-> Maybe ListModel

model: a ListModel

-> IO () 

Emitted when a provider changes a model.

This signal is primarily useful for CompletionProvider's that want to track other providers in context. For example, it can be used to create a "top results" provider.

Since: 5.6

afterCompletionContextProviderModelChanged :: (IsCompletionContext a, MonadIO m) => a -> ((?self :: a) => CompletionContextProviderModelChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the providerModelChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after completionContext #providerModelChanged callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onCompletionContextProviderModelChanged :: (IsCompletionContext a, MonadIO m) => a -> ((?self :: a) => CompletionContextProviderModelChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the providerModelChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on completionContext #providerModelChanged callback