SyntaxHighlighter

package
v0.0.0-...-5fa07e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package SyntaxHighlighter provides methods for working with SyntaxHighlighter object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsSyntaxHighlighter() Instance
}

type Entry

type Entry struct {
	Color struct {
		R float32
		G float32
		B float32
		A float32
	} `gd:"color"`
}

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.SyntaxHighlighter

Base class for syntax highlighters. Provides syntax highlighting data to a [TextEdit]. The associated [TextEdit] will call into the [SyntaxHighlighter] on an as-needed basis. [b]Note:[/b] A [SyntaxHighlighter] instance should not be used across multiple [TextEdit] nodes.

See [Interface] for methods that can be overridden by a [Class] that extends it.

%!(EXTRA string=SyntaxHighlighter)

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsSyntaxHighlighter

func (self Instance) AsSyntaxHighlighter() Instance

func (Instance) ClearHighlightingCache

func (self Instance) ClearHighlightingCache()

Clears all cached syntax highlighting data. Then calls overridable method [method _clear_highlighting_cache].

func (Instance) GetLineSyntaxHighlighting

func (self Instance) GetLineSyntaxHighlighting(line int) map[int]Entry

Returns syntax highlighting data for a single line. If the line is not cached, calls [method _get_line_syntax_highlighting] to calculate the data. The return [Dictionary] is column number to [Dictionary]. The column number notes the start of a region, the region will end if another region is found, or at the end of the line. The nested [Dictionary] contains the data for that region, currently only the key "color" is supported. [b]Example return:[/b] [codeblock]

var color_map = {
    0: {
        "color": Color(1, 0, 0)
    },
    5: {
        "color": Color(0, 1, 0)
    }
}

[/codeblock] This will color columns 0-4 red, and columns 5-eol in green.

func (Instance) GetTextEdit

func (self Instance) GetTextEdit() [1]gdclass.TextEdit

Returns the associated [TextEdit] node.

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) UpdateCache

func (self Instance) UpdateCache()

Clears then updates the [SyntaxHighlighter] caches. Override [method _update_cache] for a callback. [b]Note:[/b] This is called automatically when the associated [TextEdit] node, updates its own cache.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	//Virtual method which can be overridden to return syntax highlighting data.
	//See [method get_line_syntax_highlighting] for more details.
	GetLineSyntaxHighlighting(line int) map[any]any
	//Virtual method which can be overridden to clear any local caches.
	ClearHighlightingCache()
	//Virtual method which can be overridden to update any local caches.
	UpdateCache()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL