highlighting

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package highlighting contains provides NeoVim RPC client for syntax highlighting.

Index

Constants

This section is empty.

Variables

View Source
var DocIndex = make(map[nvim.Buffer]*Document)
View Source
var NoOpts = make(map[string]interface{})

NoOpts is a value which could be passed in NeoVim RPC.

Functions

func AttachToBuffer

func AttachToBuffer(v *nvim.Nvim, buf *nvim.Buffer) error

AttachToBuffer attaches plugin to buffer's updates. This method is temporary until it is supported in official Golang client.

func DetachFromBuffer

func DetachFromBuffer(v *nvim.Nvim, buf *nvim.Buffer) error

DetachFromBuffer detaches plugin from buffer's updates. This method is temporary until it is supported in official Golang client.

func GenManifest

func GenManifest(host string) []byte

GenManifest generates a remote plugin manifest. It is parametrized with plugin host name. In this particular case host name is name of plugin binary.

func RunPlugin

func RunPlugin() error

RunPlugin initializes NeoVim RPC client, registers local procedures and runs plugin over stdint/stdout pair.

func SetVirtualText

func SetVirtualText(
	b *nvim.Batch, buf *nvim.Buffer, nsID int, line int, chunks []Chunk,
	opts map[string]interface{}, result *int,
)

SetVirtualText add virtual text to a buffer in batch mode.

Types

type Chunk

type Chunk []string

Chunk type describes part of virtual text.

func NewChunk

func NewChunk(text, hlGroup string) Chunk

NewChunk creates new chunk of virtual text.

type Document

type Document struct {
	Lines [][]byte
	// contains filtered or unexported fields
}

Document is a mirrored content of NeoVim buffer. This object provides human-readable interface for document management, hightlighting and versioning.

func (*Document) Get

func (d *Document) Get(idx int) ([]byte, bool)

Get returns line in document if it exists.

func (*Document) Hightlight

func (d *Document) Hightlight(v *nvim.Nvim, buf nvim.Buffer)

Hightlight adds hightlight to buffer for an entire document.

func (*Document) HightlightHunk

func (d *Document) HightlightHunk(v *nvim.Nvim, buf nvim.Buffer, from, to int)

HightlightHunk adds hightlight to a chunk of lines of a buffer.

func (*Document) NoLines

func (d *Document) NoLines() int

NoLines returns number of lines in document.

func (*Document) Update

func (d *Document) Update(lines [][]byte, from, to int) (int, int)

Update updates document with a hunk of lines.

type Highlighter

type Highlighter struct {
	// contains filtered or unexported fields
}

Highlighter is an implementation of semantic hightlighting for BNF. It manages all RPC request and response between NeoVim instance and BNF parser.

func (*Highlighter) HandleBufChangedTickEvent

func (h *Highlighter) HandleBufChangedTickEvent(
	buf nvim.Buffer, changedTick int,
)

func (*Highlighter) HandleBufDetachEvent

func (p *Highlighter) HandleBufDetachEvent(buf *nvim.Buffer)

func (*Highlighter) HandleBufLinesEvent

func (h *Highlighter) HandleBufLinesEvent(
	buf *nvim.Buffer, changedTick int, firstLine, lastLine int,
	data [][]byte, more bool,
)

func (*Highlighter) HandleBufReadEvent

func (h *Highlighter) HandleBufReadEvent(buf nvim.Buffer, filename string)

func (*Highlighter) Serve

func (h *Highlighter) Serve() error

Jump to

Keyboard shortcuts

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