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 |
Main Completion Object.
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 [ifacecompletionProvider
]. There can
be for example a provider to complete words (see [classcompletionWords
]),
another provider for the completion of
function names, etc. To add a provider, call
[methodcompletion
.add_provider].
When several providers match, they are all shown in the completion
window, but one can switch between providers: see the
Completion
::move-page
signal. It is also possible to
activate the first proposals with key bindings, see the
Completion
:accelerators
property.
The [ifacecompletionProposal
] interface represents a proposal.
If a proposal contains extra information (see
CompletionColumnDetails
), it will be
displayed in a supplemental details window, which appears when
the "Details" button is clicked.
Each [classview
] object is associated with a [classcompletion
]
instance. This instance can be obtained with
[methodview
.get_completion]. The [classview
] class contains also the
signalview
[showCompletion] signal.
A same [ifacecompletionProvider
] object can be used for several
GtkSourceCompletion
's.
Synopsis
- newtype Completion = Completion (ManagedPtr Completion)
- class (GObject o, IsDescendantOf Completion o) => IsCompletion o
- toCompletion :: (MonadIO m, IsCompletion o) => o -> m Completion
- completionAddProvider :: (HasCallStack, MonadIO m, IsCompletion a, IsCompletionProvider b) => a -> b -> m ()
- completionBlockInteractive :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m ()
- completionFuzzyHighlight :: (HasCallStack, MonadIO m) => Text -> Text -> m (Maybe AttrList)
- completionFuzzyMatch :: (HasCallStack, MonadIO m) => Maybe Text -> Text -> m (Bool, Word32)
- completionGetBuffer :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m Buffer
- completionGetPageSize :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m Word32
- completionGetView :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m View
- completionHide :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m ()
- completionRemoveProvider :: (HasCallStack, MonadIO m, IsCompletion a, IsCompletionProvider b) => a -> b -> m ()
- completionSetPageSize :: (HasCallStack, MonadIO m, IsCompletion a) => a -> Word32 -> m ()
- completionShow :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m ()
- completionUnblockInteractive :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m ()
- getCompletionBuffer :: (MonadIO m, IsCompletion o) => o -> m (Maybe TextView)
- constructCompletionPageSize :: (IsCompletion o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getCompletionPageSize :: (MonadIO m, IsCompletion o) => o -> m Word32
- setCompletionPageSize :: (MonadIO m, IsCompletion o) => o -> Word32 -> m ()
- constructCompletionRememberInfoVisibility :: (IsCompletion o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCompletionRememberInfoVisibility :: (MonadIO m, IsCompletion o) => o -> m Bool
- setCompletionRememberInfoVisibility :: (MonadIO m, IsCompletion o) => o -> Bool -> m ()
- constructCompletionSelectOnShow :: (IsCompletion o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCompletionSelectOnShow :: (MonadIO m, IsCompletion o) => o -> m Bool
- setCompletionSelectOnShow :: (MonadIO m, IsCompletion o) => o -> Bool -> m ()
- constructCompletionShowIcons :: (IsCompletion o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCompletionShowIcons :: (MonadIO m, IsCompletion o) => o -> m Bool
- setCompletionShowIcons :: (MonadIO m, IsCompletion o) => o -> Bool -> m ()
- constructCompletionView :: (IsCompletion o, MonadIO m, IsView a) => a -> m (GValueConstruct o)
- getCompletionView :: (MonadIO m, IsCompletion o) => o -> m View
- type CompletionHideCallback = IO ()
- afterCompletionHide :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionHideCallback) -> m SignalHandlerId
- onCompletionHide :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionHideCallback) -> m SignalHandlerId
- type CompletionProviderAddedCallback = CompletionProvider -> IO ()
- afterCompletionProviderAdded :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderAddedCallback) -> m SignalHandlerId
- onCompletionProviderAdded :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderAddedCallback) -> m SignalHandlerId
- type CompletionProviderRemovedCallback = CompletionProvider -> IO ()
- afterCompletionProviderRemoved :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderRemovedCallback) -> m SignalHandlerId
- onCompletionProviderRemoved :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderRemovedCallback) -> m SignalHandlerId
- type CompletionShowCallback = IO ()
- afterCompletionShow :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionShowCallback) -> m SignalHandlerId
- onCompletionShow :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionShowCallback) -> m SignalHandlerId
Exported types
newtype Completion Source #
Memory-managed wrapper type.
Completion (ManagedPtr Completion) |
Instances
Eq Completion Source # | |
Defined in GI.GtkSource.Objects.Completion (==) :: Completion -> Completion -> Bool # (/=) :: Completion -> Completion -> Bool # | |
GObject Completion Source # | |
Defined in GI.GtkSource.Objects.Completion | |
ManagedPtrNewtype Completion Source # | |
Defined in GI.GtkSource.Objects.Completion toManagedPtr :: Completion -> ManagedPtr Completion | |
TypedObject Completion Source # | |
Defined in GI.GtkSource.Objects.Completion | |
HasParentTypes Completion Source # | |
Defined in GI.GtkSource.Objects.Completion | |
IsGValue (Maybe Completion) Source # | Convert |
Defined in GI.GtkSource.Objects.Completion gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Completion -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Completion) | |
type ParentTypes Completion Source # | |
Defined in GI.GtkSource.Objects.Completion type ParentTypes Completion = '[Object] |
class (GObject o, IsDescendantOf Completion o) => IsCompletion o Source #
Type class for types which can be safely cast to Completion
, for instance with toCompletion
.
Instances
(GObject o, IsDescendantOf Completion o) => IsCompletion o Source # | |
Defined in GI.GtkSource.Objects.Completion |
toCompletion :: (MonadIO m, IsCompletion o) => o -> m Completion Source #
Cast to Completion
, 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
addProvider, bindProperty, bindPropertyFull, blockInteractive, forceFloating, freezeNotify, getv, hide, isFloating, notify, notifyByPspec, ref, refSink, removeProvider, runDispose, show, stealData, stealQdata, thawNotify, unblockInteractive, unref, watchClosure.
Getters
getBuffer, getData, getPageSize, getProperty, getQdata, getView.
Setters
addProvider
completionAddProvider Source #
:: (HasCallStack, MonadIO m, IsCompletion a, IsCompletionProvider b) | |
=> a |
|
-> b |
|
-> m () |
Adds a [ifacecompletionProvider
] to the list of providers to be queried
for completion results.
blockInteractive
completionBlockInteractive :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m () Source #
No description available in the introspection data.
fuzzyHighlight
completionFuzzyHighlight Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m (Maybe AttrList) |
This will add <b>
tags around matched characters in haystack
based on casefoldQuery
.
fuzzyMatch
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Text |
|
-> m (Bool, Word32) | Returns: |
This helper function can do a fuzzy match for you giving a haystack and casefolded needle.
Casefold your needle using utf8Casefold
before
running the query.
Score will be set with the score of the match upon success. Otherwise, it will be set to zero.
getBuffer
:: (HasCallStack, MonadIO m, IsCompletion a) | |
=> a |
|
-> m Buffer | Returns: A |
Gets the connected [classview
]'s [classbuffer
]
getPageSize
completionGetPageSize :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m Word32 Source #
No description available in the introspection data.
getView
:: (HasCallStack, MonadIO m, IsCompletion a) | |
=> a |
|
-> m View | Returns: A |
Gets the [classview
] that owns the [classcompletion
].
hide
:: (HasCallStack, MonadIO m, IsCompletion a) | |
=> a |
|
-> m () |
Emits the "hide" signal.
When the "hide" signal is emitted, the completion window will be dismissed.
removeProvider
completionRemoveProvider Source #
:: (HasCallStack, MonadIO m, IsCompletion a, IsCompletionProvider b) | |
=> a |
|
-> b |
|
-> m () |
Removes a [ifacecompletionProvider
] previously added with
[methodcompletion
.add_provider].
setPageSize
completionSetPageSize :: (HasCallStack, MonadIO m, IsCompletion a) => a -> Word32 -> m () Source #
No description available in the introspection data.
show
:: (HasCallStack, MonadIO m, IsCompletion a) | |
=> a |
|
-> m () |
Emits the "show" signal.
When the "show" signal is emitted, the completion window will be displayed if there are any results available.
unblockInteractive
completionUnblockInteractive :: (HasCallStack, MonadIO m, IsCompletion a) => a -> m () Source #
No description available in the introspection data.
Properties
buffer
The TextBuffer
for the Completion:view.
This is a convenience property for providers.
getCompletionBuffer :: (MonadIO m, IsCompletion o) => o -> m (Maybe TextView) Source #
Get the value of the “buffer
” property.
When overloading is enabled, this is equivalent to
get
completion #buffer
pageSize
The number of rows to display to the user before scrolling.
constructCompletionPageSize :: (IsCompletion o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “page-size
” property. This is rarely needed directly, but it is used by new
.
getCompletionPageSize :: (MonadIO m, IsCompletion o) => o -> m Word32 Source #
Get the value of the “page-size
” property.
When overloading is enabled, this is equivalent to
get
completion #pageSize
setCompletionPageSize :: (MonadIO m, IsCompletion o) => o -> Word32 -> m () Source #
Set the value of the “page-size
” property.
When overloading is enabled, this is equivalent to
set
completion [ #pageSize:=
value ]
rememberInfoVisibility
Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again.
constructCompletionRememberInfoVisibility :: (IsCompletion o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “remember-info-visibility
” property. This is rarely needed directly, but it is used by new
.
getCompletionRememberInfoVisibility :: (MonadIO m, IsCompletion o) => o -> m Bool Source #
Get the value of the “remember-info-visibility
” property.
When overloading is enabled, this is equivalent to
get
completion #rememberInfoVisibility
setCompletionRememberInfoVisibility :: (MonadIO m, IsCompletion o) => o -> Bool -> m () Source #
Set the value of the “remember-info-visibility
” property.
When overloading is enabled, this is equivalent to
set
completion [ #rememberInfoVisibility:=
value ]
selectOnShow
Determines whether the first proposal should be selected when the completion is first shown.
constructCompletionSelectOnShow :: (IsCompletion o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “select-on-show
” property. This is rarely needed directly, but it is used by new
.
getCompletionSelectOnShow :: (MonadIO m, IsCompletion o) => o -> m Bool Source #
Get the value of the “select-on-show
” property.
When overloading is enabled, this is equivalent to
get
completion #selectOnShow
setCompletionSelectOnShow :: (MonadIO m, IsCompletion o) => o -> Bool -> m () Source #
Set the value of the “select-on-show
” property.
When overloading is enabled, this is equivalent to
set
completion [ #selectOnShow:=
value ]
showIcons
The "show-icons" property denotes if icons should be displayed within the list of completions presented to the user.
constructCompletionShowIcons :: (IsCompletion o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “show-icons
” property. This is rarely needed directly, but it is used by new
.
getCompletionShowIcons :: (MonadIO m, IsCompletion o) => o -> m Bool Source #
Get the value of the “show-icons
” property.
When overloading is enabled, this is equivalent to
get
completion #showIcons
setCompletionShowIcons :: (MonadIO m, IsCompletion o) => o -> Bool -> m () Source #
Set the value of the “show-icons
” property.
When overloading is enabled, this is equivalent to
set
completion [ #showIcons:=
value ]
view
The "view" property is the TextView
for which this Completion
is providing completion features.
constructCompletionView :: (IsCompletion o, MonadIO m, IsView a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “view
” property. This is rarely needed directly, but it is used by new
.
getCompletionView :: (MonadIO m, IsCompletion o) => o -> m View Source #
Get the value of the “view
” property.
When overloading is enabled, this is equivalent to
get
completion #view
Signals
hide
type CompletionHideCallback = IO () Source #
The "hide" signal is emitted when the completion window should be hidden.
afterCompletionHide :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionHideCallback) -> m SignalHandlerId Source #
Connect a signal handler for the hide signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
completion #hide 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.
onCompletionHide :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionHideCallback) -> m SignalHandlerId Source #
Connect a signal handler for the hide signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
completion #hide callback
providerAdded
type CompletionProviderAddedCallback Source #
= CompletionProvider |
|
-> IO () |
The "provided-added" signal is emitted when a new provider is added to the completion.
afterCompletionProviderAdded :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderAddedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the providerAdded signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
completion #providerAdded 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.
onCompletionProviderAdded :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderAddedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the providerAdded signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
completion #providerAdded callback
providerRemoved
type CompletionProviderRemovedCallback Source #
= CompletionProvider |
|
-> IO () |
The "provided-removed" signal is emitted when a provider has been removed from the completion.
afterCompletionProviderRemoved :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderRemovedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the providerRemoved signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
completion #providerRemoved 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.
onCompletionProviderRemoved :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionProviderRemovedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the providerRemoved signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
completion #providerRemoved callback
show
type CompletionShowCallback = IO () Source #
The "show" signal is emitted when the completion window should be shown.
afterCompletionShow :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionShowCallback) -> m SignalHandlerId Source #
Connect a signal handler for the show signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
completion #show 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.
onCompletionShow :: (IsCompletion a, MonadIO m) => a -> ((?self :: a) => CompletionShowCallback) -> m SignalHandlerId Source #
Connect a signal handler for the show signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
completion #show callback