types

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Num      int
	Name     string
	Contents []byte
	Version  int
	// contains filtered or unexported fields
}

A Buffer is govim's representation of the current state of a buffer in Vim i.e. it is versioned.

func (*Buffer) ToTextDocumentIdentifier

func (b *Buffer) ToTextDocumentIdentifier() protocol.TextDocumentIdentifier

ToTextDocumentIdentifier converts b to a protocol.TextDocumentIdentifier

func (*Buffer) URI

func (b *Buffer) URI() span.URI

URI returns the b's Name as a span.URI, assuming it is a file. TODO we should panic here is this is not a file-based buffer

type Point

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

Point represents a position within a Buffer

func PointFromPosition

func PointFromPosition(b *Buffer, pos protocol.Position) (Point, error)

func PointFromVim

func PointFromVim(b *Buffer, line, col int) (Point, error)

func (Point) Col

func (p Point) Col() int

Col refers to the byte index (1-based) in Line() in the buffer. This is often referred to as the column number, but is definitely not the visual column as seen on screen. This is how Vim refers to column positions.

func (Point) GoplsChar

func (p Point) GoplsChar() float64

GoplsChar is the 0-index character offset in a buffer.

func (Point) GoplsLine

func (p Point) GoplsLine() float64

GoplsLine is the 0-index line in the buffer, returned as a float64 value. This is how gopls refers to lines.

func (Point) Line

func (p Point) Line() int

Line refers to the 1-indexed line in the buffer. This is how Vim refers to line numbers.

func (Point) Offset

func (p Point) Offset() int

Offset represents the byte offset (0-indexed) of p within p.Buffer()

func (Point) ToPosition

func (p Point) ToPosition() protocol.Position

ToPosition converts p to a protocol.Position

type Range

type Range struct {
	Start Point
	End   Point
}

Range represents a range within a Buffer. Create ranges using NewRange

type WatchedFile added in v0.0.11

type WatchedFile struct {
	Path     string
	Version  int
	Contents []byte
}

A WatchedFile is a file we are watching but that is not loaded as a buffer in Vim

func (*WatchedFile) URI added in v0.0.11

func (w *WatchedFile) URI() span.URI

Jump to

Keyboard shortcuts

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