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 |
Context for expanding [classsnippetChunk
].
This class is currently used primary as a hashtable. However, the longer
term goal is to have it hold onto a GjsContext
as well as other languages
so that [classsnippetChunk
] can expand themselves by executing
script within the context.
The [classsnippet
] will build the context and then expand each of the
chunks during the insertion/edit phase.
Synopsis
- newtype SnippetContext = SnippetContext (ManagedPtr SnippetContext)
- class (GObject o, IsDescendantOf SnippetContext o) => IsSnippetContext o
- toSnippetContext :: (MonadIO m, IsSnippetContext o) => o -> m SnippetContext
- snippetContextClearVariables :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> m ()
- snippetContextExpand :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m Text
- snippetContextGetVariable :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m (Maybe Text)
- snippetContextNew :: (HasCallStack, MonadIO m) => m SnippetContext
- snippetContextSetConstant :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> Text -> m ()
- snippetContextSetLinePrefix :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m ()
- snippetContextSetTabWidth :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Int32 -> m ()
- snippetContextSetUseSpaces :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Bool -> m ()
- snippetContextSetVariable :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> Text -> m ()
- type SnippetContextChangedCallback = IO ()
- afterSnippetContextChanged :: (IsSnippetContext a, MonadIO m) => a -> ((?self :: a) => SnippetContextChangedCallback) -> m SignalHandlerId
- onSnippetContextChanged :: (IsSnippetContext a, MonadIO m) => a -> ((?self :: a) => SnippetContextChangedCallback) -> m SignalHandlerId
Exported types
newtype SnippetContext Source #
Memory-managed wrapper type.
SnippetContext (ManagedPtr SnippetContext) |
Instances
Eq SnippetContext Source # | |
Defined in GI.GtkSource.Objects.SnippetContext (==) :: SnippetContext -> SnippetContext -> Bool # (/=) :: SnippetContext -> SnippetContext -> Bool # | |
GObject SnippetContext Source # | |
Defined in GI.GtkSource.Objects.SnippetContext | |
ManagedPtrNewtype SnippetContext Source # | |
Defined in GI.GtkSource.Objects.SnippetContext toManagedPtr :: SnippetContext -> ManagedPtr SnippetContext | |
TypedObject SnippetContext Source # | |
Defined in GI.GtkSource.Objects.SnippetContext | |
HasParentTypes SnippetContext Source # | |
Defined in GI.GtkSource.Objects.SnippetContext | |
IsGValue (Maybe SnippetContext) Source # | Convert |
Defined in GI.GtkSource.Objects.SnippetContext gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SnippetContext -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SnippetContext) | |
type ParentTypes SnippetContext Source # | |
Defined in GI.GtkSource.Objects.SnippetContext type ParentTypes SnippetContext = '[Object] |
class (GObject o, IsDescendantOf SnippetContext o) => IsSnippetContext o Source #
Type class for types which can be safely cast to SnippetContext
, for instance with toSnippetContext
.
Instances
(GObject o, IsDescendantOf SnippetContext o) => IsSnippetContext o Source # | |
Defined in GI.GtkSource.Objects.SnippetContext |
toSnippetContext :: (MonadIO m, IsSnippetContext o) => o -> m SnippetContext Source #
Cast to SnippetContext
, 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, clearVariables, expand, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getProperty, getQdata, getVariable.
Setters
setConstant, setData, setDataFull, setLinePrefix, setProperty, setTabWidth, setUseSpaces, setVariable.
clearVariables
snippetContextClearVariables Source #
:: (HasCallStack, MonadIO m, IsSnippetContext a) | |
=> a |
|
-> m () |
Removes all variables from the context.
expand
snippetContextExpand :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m Text Source #
No description available in the introspection data.
getVariable
snippetContextGetVariable Source #
:: (HasCallStack, MonadIO m, IsSnippetContext a) | |
=> a |
|
-> Text |
|
-> m (Maybe Text) | Returns: the value for the variable, or |
Gets the current value for a variable named key
.
new
:: (HasCallStack, MonadIO m) | |
=> m SnippetContext | Returns: a |
Creates a new SnippetContext
.
Generally, this isn't needed unless you are controlling the expansion of snippets manually.
setConstant
snippetContextSetConstant Source #
:: (HasCallStack, MonadIO m, IsSnippetContext a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Sets a constatnt within the context.
This is similar to a variable set with [methodsnippetContext
.set_variable]
but is expected to not change during use of the snippet.
Examples would be the date or users name.
setLinePrefix
snippetContextSetLinePrefix :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m () Source #
No description available in the introspection data.
setTabWidth
snippetContextSetTabWidth :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Int32 -> m () Source #
No description available in the introspection data.
setUseSpaces
snippetContextSetUseSpaces :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Bool -> m () Source #
No description available in the introspection data.
setVariable
snippetContextSetVariable Source #
:: (HasCallStack, MonadIO m, IsSnippetContext a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Sets a variable within the context.
This variable may be overridden by future updates to the context.
Signals
changed
type SnippetContextChangedCallback = IO () Source #
The signal is emitted when a change has been discovered in one of the chunks of the snippet which has caused a variable or other dynamic data within the context to have changed.
afterSnippetContextChanged :: (IsSnippetContext a, MonadIO m) => a -> ((?self :: a) => SnippetContextChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
snippetContext #changed 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.
onSnippetContextChanged :: (IsSnippetContext a, MonadIO m) => a -> ((?self :: a) => SnippetContextChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
snippetContext #changed callback