reader

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ChannelBufferSize = 512

ChannelBufferSize is the number sources lines that can be read ahead of the correlator.

View Source
const LineBufferSize = 1e7

LineBufferSize is the maximum size of the buffer used to read each line of a raw LSIF index. Lines in LSIF can get very long as it include escaped hover text (package documentation), as well as large edges such as the contains edge of large documents.

This corresponds a 10MB buffer that can accommodate 10 million characters.

Variables

View Source
var (
	HoverPartSeparator = []byte("\n\n---\n\n")
	CodeFence          = []byte("```")
)
View Source
var NumUnmarshalGoRoutines = runtime.GOMAXPROCS(0)

NumUnmarshalGoRoutines is the number of goroutines launched to unmarshal individual lines.

Functions

func Read

func Read(ctx context.Context, r io.Reader) <-chan Pair

Read reads the given content as line-separated JSON objects and returns a channel of Pair values for each non-empty line.

Types

type Diagnostic

type Diagnostic struct {
	Severity       int
	Code           string
	Message        string
	Source         string
	StartLine      int
	StartCharacter int
	EndLine        int
	EndCharacter   int
}

type Edge

type Edge struct {
	OutV     int
	InV      int
	InVs     []int
	Document int
}

type Element

type Element struct {
	ID      int
	Type    string
	Label   string
	Payload interface{}
}

type Interner

type Interner struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Interner converts strings into unique identifers. Submitting the same byte value to the interner will result in the same identifier being produced. Each unique input is guaranteed to have a unique output (no two inputs share the same identifier). The identifier space of two distinct interner instances may overlap.

Assumption: The output of LSIF indexers will not generally mix types of identifiers. If integers are used, they are used for all ids. If strings are used, they are used for all ids.

func NewInterner

func NewInterner() *Interner

NewInterner creates a new empty interner.

func (*Interner) Intern

func (i *Interner) Intern(raw []byte) (int, error)

Intern returns the unique identifier for the given byte value. The byte value should be a raw LSIF input identifier, which should be a JSON-encoded number or quoted string. This method is safe to call from multiple goroutines.

type MetaData

type MetaData struct {
	Version     string
	ProjectRoot string
}

type Moniker

type Moniker struct {
	Kind       string
	Scheme     string
	Identifier string
}

type PackageInformation

type PackageInformation struct {
	Name    string
	Version string
}

type Pair

type Pair struct {
	Element Element
	Err     error
}

type Range

type Range struct {
	StartLine      int
	StartCharacter int
	EndLine        int
	EndCharacter   int
}

type ResultSet

type ResultSet struct{}

type StringOrInt

type StringOrInt string

func (*StringOrInt) UnmarshalJSON

func (id *StringOrInt) UnmarshalJSON(raw []byte) error

Jump to

Keyboard shortcuts

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