SnippetContext

open class SnippetContext(pointer: <Error class: unknown class><<Error class: unknown class>>)

Context for expanding class@SnippetChunk.

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 class@SnippetChunk can expand themselves by executing script within the context.

The class@Snippet will build the context and then expand each of the chunks during the insertion/edit phase.

Constructors

Link copied to clipboard
constructor()

Creates a new #GtkSourceSnippetContext.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gtksourceSnippetContextPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun clearVariables()

Removes all variables from the context.

Link copied to clipboard
fun connectChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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.

Link copied to clipboard
open fun expand(input: String): String
Link copied to clipboard
open fun getVariable(key: String): String?

Gets the current value for a variable named @key.

Link copied to clipboard
open fun setConstant(key: String, value: String)

Sets a constatnt within the context.

Link copied to clipboard
open fun setLinePrefix(linePrefix: String)
Link copied to clipboard
open fun setTabWidth(tabWidth: Int)
Link copied to clipboard
open fun setUseSpaces(useSpaces: Boolean)
Link copied to clipboard
open fun setVariable(key: String, value: String)

Sets a variable within the context.