Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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.
- iface
completionProvider
- are expected to provide
ListModel
with - iface
completionProposal
- which may be joined together in a list of
results for the user. They are also responsible for how the contents are
displayed using [class
completionCell
] which allows for some level of customization.
Synopsis
- newtype CompletionContext = CompletionContext (ManagedPtr CompletionContext)
- class (GObject o, IsDescendantOf CompletionContext o) => IsCompletionContext o
- toCompletionContext :: (MonadIO m, IsCompletionContext o) => o -> m CompletionContext
- completionContextGetActivation :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m CompletionActivation
- completionContextGetBounds :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m (Bool, TextIter, TextIter)
- completionContextGetBuffer :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m (Maybe Buffer)
- completionContextGetBusy :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m Bool
- completionContextGetCompletion :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m (Maybe Completion)
- completionContextGetEmpty :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m Bool
- completionContextGetLanguage :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m (Maybe Language)
- completionContextGetProposalsForProvider :: (HasCallStack, MonadIO m, IsCompletionContext a, IsCompletionProvider b) => a -> b -> m (Maybe ListModel)
- completionContextGetView :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m (Maybe View)
- completionContextGetWord :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m Text
- completionContextListProviders :: (HasCallStack, MonadIO m, IsCompletionContext a) => a -> m ListModel
- completionContextSetProposalsForProvider :: (HasCallStack, MonadIO m, IsCompletionContext a, IsCompletionProvider b, IsListModel c) => a -> b -> Maybe c -> m ()
- getCompletionContextBusy :: (MonadIO m, IsCompletionContext o) => o -> m Bool
- constructCompletionContextCompletion :: (IsCompletionContext o, MonadIO m, IsCompletion a) => a -> m (GValueConstruct o)
- getCompletionContextCompletion :: (MonadIO m, IsCompletionContext o) => o -> m (Maybe Completion)
- getCompletionContextEmpty :: (MonadIO m, IsCompletionContext o) => o -> m Bool
- type CompletionContextProviderModelChangedCallback = CompletionProvider -> Maybe ListModel -> IO ()
- afterCompletionContextProviderModelChanged :: (IsCompletionContext a, MonadIO m) => a -> ((?self :: a) => CompletionContextProviderModelChangedCallback) -> m SignalHandlerId
- onCompletionContextProviderModelChanged :: (IsCompletionContext a, MonadIO m) => a -> ((?self :: a) => CompletionContextProviderModelChangedCallback) -> m SignalHandlerId
Exported types
newtype CompletionContext Source #
Memory-managed wrapper type.
CompletionContext (ManagedPtr CompletionContext) |
Instances
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
(GObject o, IsDescendantOf CompletionContext o) => IsCompletionContext o Source # | |
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
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, itemsChanged, listProviders, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getActivation, getBounds, getBuffer, getBusy, getCompletion, getData, getEmpty, getItem, getItemType, getLanguage, getNItems, getProperty, getProposalsForProvider, getQdata, getView, getWord.
Setters
getActivation
completionContextGetActivation Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m CompletionActivation |
Gets the mode for which the context was activated.
getBounds
completionContextGetBounds Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m (Bool, TextIter, TextIter) | Returns: |
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 #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m (Maybe Buffer) | Returns: a |
Gets the underlying buffer used by the context.
This is a convenience function to get the buffer via the Completion
property.
getBusy
completionContextGetBusy Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m Bool | Returns: |
Gets the "busy" property. This is set to True
while the completion
context is actively fetching proposals from registered
CompletionProvider
's.
getCompletion
completionContextGetCompletion Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m (Maybe Completion) | Returns: an |
Gets the Completion
that created the context.
getEmpty
completionContextGetEmpty Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m Bool | Returns: |
getLanguage
completionContextGetLanguage Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m (Maybe Language) |
Gets the language of the underlying buffer, if any.
getProposalsForProvider
completionContextGetProposalsForProvider Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a, IsCompletionProvider b) | |
=> a |
|
-> b |
|
-> m (Maybe ListModel) |
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 #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m (Maybe View) |
Gets the text view for the context.
getWord
completionContextGetWord Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsCompletionContext a) | |
=> a |
|
-> m ListModel | Returns: a |
Gets the providers that are associated with the context.
Since: 5.6
setProposalsForProvider
completionContextSetProposalsForProvider Source #
:: (HasCallStack, MonadIO m, IsCompletionContext a, IsCompletionProvider b, IsListModel c) | |
=> a |
|
-> b |
|
-> Maybe c | |
-> 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 #
= CompletionProvider |
|
-> Maybe 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