lsif

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Lsif = "lsif"
)

Functions

This section is empty.

Types

type Docs

type Docs struct {
	Root      string
	Entries   map[Id]string
	DocRanges map[Id][]Id
	Ranges    *Ranges
}

func NewDocs

func NewDocs() (*Docs, error)

func (*Docs) Close

func (d *Docs) Close() error

func (*Docs) Parse

func (d *Docs) Parse(r io.Reader) error

func (*Docs) SerializeEntries

func (d *Docs) SerializeEntries(w *zip.Writer) error

type Document

type Document struct {
	Id  Id     `json:"id"`
	Uri string `json:"uri"`
}

type DocumentRange

type DocumentRange struct {
	OutV     Id   `json:"outV"`
	RangeIds []Id `json:"inVs"`
}

type HoverRef

type HoverRef struct {
	ResultSetId Id `json:"outV"`
	HoverId     Id `json:"inV"`
}

type Hovers

type Hovers struct {
	File          *os.File
	Offsets       *cache
	CurrentOffset int
}

func NewHovers

func NewHovers() (*Hovers, error)

func (*Hovers) Close

func (h *Hovers) Close() error

func (*Hovers) For

func (h *Hovers) For(refId Id) json.RawMessage

func (*Hovers) Read

func (h *Hovers) Read(label string, line []byte) error

type Id

type Id int32

func (*Id) UnmarshalJSON

func (id *Id) UnmarshalJSON(b []byte) error

type Item

type Item struct {
	Line    int32
	DocId   Id
	RangeId Id
}

type Line

type Line struct {
	Type string `json:"label"`
}

type Metadata

type Metadata struct {
	Root string `json:"projectRoot"`
}

type Next

type Next struct {
	Id    Id     `json:"id"`
	Type  string `json:"type"`
	Label string `json:"label"`
	OutV  Id     `json:"outV"`
	InV   Id     `json:"inV"`
}

type Offset

type Offset struct {
	At  int32
	Len int32
}

type Parser

type Parser struct {
	Docs *Docs
	// contains filtered or unexported fields
}

func NewParser

func NewParser(ctx context.Context, r io.Reader) (*Parser, error)

func NewParserRaw

func NewParserRaw(ctx context.Context, r io.Reader) (*Parser, error)

func (*Parser) Close

func (p *Parser) Close() error

func (*Parser) Read

func (p *Parser) Read(b []byte) (int, error)

type Range

type Range struct {
	Line      int32 `json:"line"`
	Character int32 `json:"character"`
	RefId     Id
}

type Ranges

type Ranges struct {
	DefRefs    map[Id]Item
	References *References
	Hovers     *Hovers
	Cache      *cache

	NextMap           map[Id]Id
	TextReferenceMap  map[Id]Id
	TextDefinitionMap map[Id]Id
}

func NewRanges

func NewRanges() (*Ranges, error)

func (*Ranges) Close

func (r *Ranges) Close() error

func (*Ranges) Read

func (r *Ranges) Read(label string, line []byte) error

func (*Ranges) Serialize

func (r *Ranges) Serialize(f io.Writer, rangeIds []Id, docs map[Id]string) error

type RawData

type RawData struct {
	Id     Id        `json:"id"`
	Result RawResult `json:"result"`
}

type RawItem

type RawItem struct {
	Property string `json:"property"`
	RefId    Id     `json:"outV"`
	RangeIds []Id   `json:"inVs"`
	DocId    Id     `json:"document"`
}

type RawRange

type RawRange struct {
	Id   Id    `json:"id"`
	Data Range `json:"start"`
}

type RawResult

type RawResult struct {
	Contents json.RawMessage `json:"contents"`
}

type References

type References struct {
	Items           *cache
	Offsets         *cache
	CurrentOffsetId Id
}

func NewReferences

func NewReferences() (*References, error)

func (*References) Close

func (r *References) Close() error

func (*References) For

func (r *References) For(docs map[Id]string, refId Id) []SerializedReference

func (*References) GetItems

func (r *References) GetItems(refId Id) []Item

func (*References) Store

func (r *References) Store(refId Id, references []Item) error

Store is responsible for keeping track of references that will be used when serializing in `For`.

The references are stored in a file to cache them. It is like `map[Id][]Item` (where `Id` is `refId`) but relies on caching the array and its offset in files for storage to reduce RAM usage. The items can be fetched by calling `GetItems`.

type ReferencesOffset

type ReferencesOffset struct {
	Id  Id
	Len int32
}

type ResultSetRef

type ResultSetRef struct {
	ResultSetId Id `json:"outV"`
	RefId       Id `json:"inV"`
}

type SerializedRange

type SerializedRange struct {
	StartLine      int32                 `json:"start_line"`
	StartChar      int32                 `json:"start_char"`
	DefinitionPath string                `json:"definition_path,omitempty"`
	Hover          json.RawMessage       `json:"hover"`
	References     []SerializedReference `json:"references,omitempty"`
}

type SerializedReference

type SerializedReference struct {
	Path string `json:"path"`
}

type TextReference

type TextReference struct {
	Id    Id     `json:"id"`
	Type  string `json:"type"`
	Label string `json:"label"`
	OutV  Id     `json:"outV"`
	InV   Id     `json:"inV"`
}

Jump to

Keyboard shortcuts

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