lsif

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheTypeFile = "file"
	CacheTypeMem  = "mem"
)

Variables

View Source
var CacheType = CacheTypeFile
View Source
var Lsif = "lsif"

Functions

This section is empty.

Types

type Cache added in v0.6.10

type Cache interface {
	SetEntry(id Id, data interface{}) error
	Entry(id Id, data interface{}) error
	Close() error

	GetReader() io.Reader
	// contains filtered or unexported methods
}

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 File added in v0.6.1

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

File is an in-memory emulation of the I/O operations of os.File. The zero value for File is an empty file ready to use. Comes from: https://github.com/dsnet/golib/blob/master/memfile/file.go

func New added in v0.6.1

func New(b []byte) *File

New creates and initializes a new File using b as its initial contents. The new File takes ownership of b.

func (*File) Bytes added in v0.6.1

func (fb *File) Bytes() []byte

Bytes returns the full contents of the File. The result in only valid until the next Write, WriteAt, or Truncate call.

func (*File) Read added in v0.6.1

func (fb *File) Read(b []byte) (int, error)

Read reads up to len(b) bytes from the File. It returns the number of bytes read and any error encountered. At end of file, Read returns (0, io.EOF).

func (*File) ReadAt added in v0.6.1

func (fb *File) ReadAt(b []byte, offset int64) (int, error)

ReadAt reads len(b) bytes from the File starting at byte offset. It returns the number of bytes read and the error, if any. At end of file, that error is io.EOF.

func (*File) Seek added in v0.6.1

func (fb *File) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read or Write on file with offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end.

func (*File) Truncate added in v0.6.1

func (fb *File) Truncate(n int64) error

Truncate changes the size of the file. It does not change the I/O offset.

func (*File) Write added in v0.6.1

func (fb *File) Write(b []byte) (int, error)

Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. If the current file offset is past the io.EOF, then the space in-between are implicitly filled with zero bytes.

func (*File) WriteAt added in v0.6.1

func (fb *File) WriteAt(b []byte, offset int64) (int, error)

WriteAt writes len(b) bytes to the File starting at byte offset. It returns the number of bytes written and an error, if any. If offset lies past io.EOF, then the space in-between are implicitly filled with zero bytes.

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"`
	Length    int32 `json:"length"`
	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
	RawEdgeMap        map[Id][]RawItem
}

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"`
	End  Range `json:"end"`
}

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 cacheMem 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 Source added in v0.10.1

type Source struct {
	WorkspaceRoot string `json:"workspaceRoot"`
}

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