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.Snippet

Description

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

Exported types

newtype Snippet Source #

Memory-managed wrapper type.

Constructors

Snippet (ManagedPtr Snippet) 

Instances

Instances details
Eq Snippet Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

Methods

(==) :: Snippet -> Snippet -> Bool #

(/=) :: Snippet -> Snippet -> Bool #

GObject Snippet Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

ManagedPtrNewtype Snippet Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

Methods

toManagedPtr :: Snippet -> ManagedPtr Snippet

TypedObject Snippet Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

Methods

glibType :: IO GType

HasParentTypes Snippet Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

IsGValue (Maybe Snippet) Source #

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

Instance details

Defined in GI.GtkSource.Objects.Snippet

Methods

gvalueGType_ :: IO GType

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

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

type ParentTypes Snippet Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

type ParentTypes Snippet = '[Object]

class (GObject o, IsDescendantOf Snippet o) => IsSnippet o Source #

Type class for types which can be safely cast to Snippet, for instance with toSnippet.

Instances

Instances details
(GObject o, IsDescendantOf Snippet o) => IsSnippet o Source # 
Instance details

Defined in GI.GtkSource.Objects.Snippet

toSnippet :: (MonadIO m, IsSnippet o) => o -> m Snippet Source #

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

Methods

addChunk

snippetAddChunk Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnippet a, IsSnippetChunk b) 
=> a

snippet: a Snippet

-> b

chunk: a SnippetChunk

-> m () 

Appends chunk to the snippet.

This may only be called before the snippet has been expanded.

copy

snippetCopy Source #

Arguments

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

snippet: a Snippet

-> m Snippet

Returns: A new Snippet

Does a deep copy of the snippet.

getContext

snippetGetContext Source #

Arguments

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

snippet: an Snippet

-> m (Maybe SnippetContext)

Returns: an SnippetContext

Gets the context used for expanding the snippet.

getDescription

snippetGetDescription Source #

Arguments

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

snippet: a Snippet

-> m Text 

Gets the description for the snippet.

getFocusPosition

snippetGetFocusPosition Source #

Arguments

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

snippet: a Snippet

-> 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

snippetGetLanguageId Source #

Arguments

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

snippet: a Snippet

-> 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

snippetGetNChunks Source #

Arguments

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

snippet: a Snippet

-> m Word32

Returns: The number of chunks.

Gets the number of chunks in the snippet.

Note that not all chunks are editable.

getName

snippetGetName Source #

Arguments

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

snippet: a Snippet

-> m Text 

Gets the name for the snippet.

getNthChunk

snippetGetNthChunk Source #

Arguments

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

snippet: a Snippet

-> Word32

nth: the nth chunk to get

-> m SnippetChunk

Returns: an SnippetChunk

Gets the chunk at nth.

getTrigger

snippetGetTrigger Source #

Arguments

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

snippet: a Snippet

-> m (Maybe Text)

Returns: A string or Nothing

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

snippetNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe Text

trigger: the trigger word

-> Maybe Text

languageId: the source language

-> m Snippet

Returns: A new Snippet

Creates a new Snippet

newParsed

snippetNewParsed Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

text: the formatted snippet text to parse

-> m Snippet

Returns: the newly parsed Snippet, or Nothing upon failure and error is set. (Can throw GError)

Parses the snippet formatted text into a series of chunks and adds them to a new Snippet.

Since: 5.6

setDescription

snippetSetDescription Source #

Arguments

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

snippet: a Snippet

-> Text

description: the snippet description

-> m () 

Sets the description for the snippet.

setLanguageId

snippetSetLanguageId Source #

Arguments

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

snippet: a Snippet

-> Text

languageId: the language identifier for the snippet

-> m () 

Sets the language identifier for the snippet.

This should match the [propertylanguage:id] identifier.

setName

snippetSetName Source #

Arguments

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

snippet: a Snippet

-> Text

name: the snippet name

-> m () 

Sets the name for the snippet.

setTrigger

snippetSetTrigger Source #

Arguments

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

snippet: a Snippet

-> Text

trigger: the trigger word

-> 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 ]