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 |
Quick insertion code snippets.
The GtkSourceSnippet
represents a series of chunks that can quickly be
inserted into the [classview
].
Snippets are defined in XML files which are loaded by the
[classsnippetManager
]. Alternatively, applications can create snippets
on demand and insert them into the [classview
] using
[methodview
.push_snippet].
Snippet chunks can reference other snippet chunks as well as post-process the values from other chunks such as capitalization.
Synopsis
- newtype Snippet = Snippet (ManagedPtr Snippet)
- class (GObject o, IsDescendantOf Snippet o) => IsSnippet o
- toSnippet :: (MonadIO m, IsSnippet o) => o -> m Snippet
- snippetAddChunk :: (HasCallStack, MonadIO m, IsSnippet a, IsSnippetChunk b) => a -> b -> m ()
- snippetCopy :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m Snippet
- snippetGetContext :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m (Maybe SnippetContext)
- snippetGetDescription :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m Text
- snippetGetFocusPosition :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m Int32
- snippetGetLanguageId :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m Text
- snippetGetNChunks :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m Word32
- snippetGetName :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m Text
- snippetGetNthChunk :: (HasCallStack, MonadIO m, IsSnippet a) => a -> Word32 -> m SnippetChunk
- snippetGetTrigger :: (HasCallStack, MonadIO m, IsSnippet a) => a -> m (Maybe Text)
- snippetNew :: (HasCallStack, MonadIO m) => Maybe Text -> Maybe Text -> m Snippet
- snippetNewParsed :: (HasCallStack, MonadIO m) => Text -> m Snippet
- snippetSetDescription :: (HasCallStack, MonadIO m, IsSnippet a) => a -> Text -> m ()
- snippetSetLanguageId :: (HasCallStack, MonadIO m, IsSnippet a) => a -> Text -> m ()
- snippetSetName :: (HasCallStack, MonadIO m, IsSnippet a) => a -> Text -> m ()
- snippetSetTrigger :: (HasCallStack, MonadIO m, IsSnippet a) => a -> Text -> m ()
- getSnippetBuffer :: (MonadIO m, IsSnippet o) => o -> m (Maybe TextBuffer)
- constructSnippetDescription :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o)
- getSnippetDescription :: (MonadIO m, IsSnippet o) => o -> m Text
- setSnippetDescription :: (MonadIO m, IsSnippet o) => o -> Text -> m ()
- getSnippetFocusPosition :: (MonadIO m, IsSnippet o) => o -> m Int32
- constructSnippetLanguageId :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o)
- getSnippetLanguageId :: (MonadIO m, IsSnippet o) => o -> m Text
- setSnippetLanguageId :: (MonadIO m, IsSnippet o) => o -> Text -> m ()
- constructSnippetName :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o)
- getSnippetName :: (MonadIO m, IsSnippet o) => o -> m Text
- setSnippetName :: (MonadIO m, IsSnippet o) => o -> Text -> m ()
- constructSnippetTrigger :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o)
- getSnippetTrigger :: (MonadIO m, IsSnippet o) => o -> m (Maybe Text)
- setSnippetTrigger :: (MonadIO m, IsSnippet o) => o -> Text -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Snippet Source # | |
GObject Snippet Source # | |
Defined in GI.GtkSource.Objects.Snippet | |
ManagedPtrNewtype Snippet Source # | |
Defined in GI.GtkSource.Objects.Snippet toManagedPtr :: Snippet -> ManagedPtr Snippet | |
TypedObject Snippet Source # | |
Defined in GI.GtkSource.Objects.Snippet | |
HasParentTypes Snippet Source # | |
Defined in GI.GtkSource.Objects.Snippet | |
IsGValue (Maybe Snippet) Source # | Convert |
Defined in GI.GtkSource.Objects.Snippet gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Snippet -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Snippet) | |
type ParentTypes Snippet Source # | |
Defined in GI.GtkSource.Objects.Snippet type ParentTypes Snippet = '[Object] |
class (GObject o, IsDescendantOf Snippet o) => IsSnippet o Source #
Instances
(GObject o, IsDescendantOf Snippet o) => IsSnippet o Source # | |
Defined in GI.GtkSource.Objects.Snippet |
Methods
Click to display all available methods, including inherited ones
Methods
addChunk, bindProperty, bindPropertyFull, copy, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getContext, getData, getDescription, getFocusPosition, getLanguageId, getNChunks, getName, getNthChunk, getProperty, getQdata, getTrigger.
Setters
setData, setDataFull, setDescription, setLanguageId, setName, setProperty, setTrigger.
addChunk
:: (HasCallStack, MonadIO m, IsSnippet a, IsSnippetChunk b) | |
=> a |
|
-> b |
|
-> m () |
Appends chunk
to the snippet
.
This may only be called before the snippet has been expanded.
copy
Does a deep copy of the snippet.
getContext
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m (Maybe SnippetContext) | Returns: an |
Gets the context used for expanding the snippet.
getDescription
snippetGetDescription Source #
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m Text |
Gets the description for the snippet.
getFocusPosition
snippetGetFocusPosition Source #
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m Int32 | Returns: The focus position, or -1 if unset. |
Gets the current focus for the snippet.
This is changed as the user tabs through focus locations.
getLanguageId
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m Text | Returns: the language identifier |
Gets the language-id used for the source snippet.
The language identifier should be one that matches a
source language [propertylanguage
:id] property.
getNChunks
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m Word32 | Returns: The number of chunks. |
Gets the number of chunks in the snippet.
Note that not all chunks are editable.
getName
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m Text |
Gets the name for the snippet.
getNthChunk
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> Word32 |
|
-> m SnippetChunk | Returns: an |
Gets the chunk at nth
.
getTrigger
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> m (Maybe Text) | Returns: A string or |
Gets the trigger for the source snippet.
A trigger is a word that can be expanded into the full snippet when the user presses Tab.
new
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Maybe Text |
|
-> m Snippet | Returns: A new |
Creates a new Snippet
newParsed
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Snippet | Returns: the newly parsed |
Parses the snippet formatted text
into a series of chunks and adds them
to a new Snippet
.
Since: 5.6
setDescription
snippetSetDescription Source #
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the description for the snippet.
setLanguageId
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the language identifier for the snippet.
This should match the [propertylanguage
:id] identifier.
setName
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the name for the snippet.
setTrigger
:: (HasCallStack, MonadIO m, IsSnippet a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the trigger for the snippet.
Properties
buffer
No description available in the introspection data.
getSnippetBuffer :: (MonadIO m, IsSnippet o) => o -> m (Maybe TextBuffer) Source #
Get the value of the “buffer
” property.
When overloading is enabled, this is equivalent to
get
snippet #buffer
description
No description available in the introspection data.
constructSnippetDescription :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “description
” property. This is rarely needed directly, but it is used by new
.
getSnippetDescription :: (MonadIO m, IsSnippet o) => o -> m Text Source #
Get the value of the “description
” property.
When overloading is enabled, this is equivalent to
get
snippet #description
setSnippetDescription :: (MonadIO m, IsSnippet o) => o -> Text -> m () Source #
Set the value of the “description
” property.
When overloading is enabled, this is equivalent to
set
snippet [ #description:=
value ]
focusPosition
No description available in the introspection data.
getSnippetFocusPosition :: (MonadIO m, IsSnippet o) => o -> m Int32 Source #
Get the value of the “focus-position
” property.
When overloading is enabled, this is equivalent to
get
snippet #focusPosition
languageId
No description available in the introspection data.
constructSnippetLanguageId :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “language-id
” property. This is rarely needed directly, but it is used by new
.
getSnippetLanguageId :: (MonadIO m, IsSnippet o) => o -> m Text Source #
Get the value of the “language-id
” property.
When overloading is enabled, this is equivalent to
get
snippet #languageId
setSnippetLanguageId :: (MonadIO m, IsSnippet o) => o -> Text -> m () Source #
Set the value of the “language-id
” property.
When overloading is enabled, this is equivalent to
set
snippet [ #languageId:=
value ]
name
No description available in the introspection data.
constructSnippetName :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “name
” property. This is rarely needed directly, but it is used by new
.
getSnippetName :: (MonadIO m, IsSnippet o) => o -> m Text Source #
Get the value of the “name
” property.
When overloading is enabled, this is equivalent to
get
snippet #name
setSnippetName :: (MonadIO m, IsSnippet o) => o -> Text -> m () Source #
Set the value of the “name
” property.
When overloading is enabled, this is equivalent to
set
snippet [ #name:=
value ]
trigger
No description available in the introspection data.
constructSnippetTrigger :: (IsSnippet o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “trigger
” property. This is rarely needed directly, but it is used by new
.
getSnippetTrigger :: (MonadIO m, IsSnippet o) => o -> m (Maybe Text) Source #
Get the value of the “trigger
” property.
When overloading is enabled, this is equivalent to
get
snippet #trigger
setSnippetTrigger :: (MonadIO m, IsSnippet o) => o -> Text -> m () Source #
Set the value of the “trigger
” property.
When overloading is enabled, this is equivalent to
set
snippet [ #trigger:=
value ]