Documentation
¶
Index ¶
- Constants
- type Contains
- type DefinitionResult
- type Document
- type Edge
- type EdgeLabel
- type Element
- type ElementType
- type Event
- type HoverResult
- type Item
- func NewItem(id, outV string, inVs []string, document string) *Item
- func NewItemOfDefinitions(id, outV string, inVs []string, document string) *Item
- func NewItemOfReferences(id, outV string, inVs []string, document string) *Item
- func NewItemWithProperty(id, outV string, inVs []string, document, property string) *Item
- type JSONWriter
- type MarkedString
- type MetaData
- type Moniker
- type MonikerEdge
- type Next
- type NextMonikerEdge
- type PackageInformation
- type PackageInformationEdge
- type Pos
- type Project
- type Range
- type ReferenceResult
- type ResultSet
- type TextDocumentDefinition
- type TextDocumentHover
- type TextDocumentReferences
- type ToolInfo
- type Vertex
- type VertexLabel
- type Writer
- func (w *Writer) EmitBeginEvent(scope string, data string) (string, error)
- func (w *Writer) EmitContains(outV string, inVs []string) (string, error)
- func (w *Writer) EmitDefinitionResult() (string, error)
- func (w *Writer) EmitDocument(languageID, path string) (string, error)
- func (w *Writer) EmitEndEvent(scope string, data string) (string, error)
- func (w *Writer) EmitHoverResult(contents []MarkedString) (string, error)
- func (w *Writer) EmitItem(outV string, inVs []string, docID string) (string, error)
- func (w *Writer) EmitItemOfDefinitions(outV string, inVs []string, docID string) (string, error)
- func (w *Writer) EmitItemOfReferences(outV string, inVs []string, docID string) (string, error)
- func (w *Writer) EmitMetaData(root string, info ToolInfo) (string, error)
- func (w *Writer) EmitMoniker(kind, scheme, identifier string) (string, error)
- func (w *Writer) EmitMonikerEdge(outV, inV string) (string, error)
- func (w *Writer) EmitNext(outV, inV string) (string, error)
- func (w *Writer) EmitPackageInformation(packageName, scheme, version string) (string, error)
- func (w *Writer) EmitPackageInformationEdge(outV, inV string) (string, error)
- func (w *Writer) EmitProject(languageID string) (string, error)
- func (w *Writer) EmitRange(start, end Pos) (string, error)
- func (w *Writer) EmitReferenceResult() (string, error)
- func (w *Writer) EmitResultSet() (string, error)
- func (w *Writer) EmitTextDocumentDefinition(outV, inV string) (string, error)
- func (w *Writer) EmitTextDocumentHover(outV, inV string) (string, error)
- func (w *Writer) EmitTextDocumentReferences(outV, inV string) (string, error)
- func (w *Writer) NextID() string
- func (w *Writer) NumElements() int
Constants ¶
const ( // Version represnets the current LSIF version of implementation. Version = "0.4.3" // PositionEncoding is the encoding used to compute line and character values in positions and ranges. PositionEncoding = "utf-16" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contains ¶
Contains is an edge object that represents 1:n "contains" relation.
func NewContains ¶
NewContains returns a new Contains object with given ID and vertices information.
type DefinitionResult ¶
type DefinitionResult struct {
Vertex
}
DefinitionResult connects a definition that is spread over multiple ranges or multiple documents.
func NewDefinitionResult ¶
func NewDefinitionResult(id string) *DefinitionResult
NewDefinitionResult returns a new DefinitionResult object with given ID.
type Document ¶
type Document struct { Vertex // The URI indicates the location of the document. URI string `json:"uri"` // The language identifier of the document. LanguageID string `json:"languageId"` // The contents of the the document. Contents string `json:"contents,omitempty"` }
Document is a vertex of document in the project.
func NewDocument ¶
NewDocument returns a new Document object with given ID, URI and contents.
type EdgeLabel ¶
type EdgeLabel string
EdgeLabel represents the purpose of an edge.
const ( EdgeContains EdgeLabel = "contains" EdgeItem EdgeLabel = "item" EdgeNext EdgeLabel = "next" EdgeMoniker EdgeLabel = "moniker" EdgeNextMoniker EdgeLabel = "nextMoniker" EdgePackageInformation EdgeLabel = "packageInformation" EdgeTextDocumentDocumentSymbol EdgeLabel = "textDocument/documentSymbol" EdgeTextDocumentFoldingRange EdgeLabel = "textDocument/foldingRange" EdgeTextDocumentDocumentLink EdgeLabel = "textDocument/documentLink" EdgeTextDocumentDiagnostic EdgeLabel = "textDocument/diagnostic" EdgeTextDocumentDefinition EdgeLabel = "textDocument/definition" EdgeTextDocumentDeclaration EdgeLabel = "textDocument/declaration" EdgeTextDocumentTypeDefinition EdgeLabel = "textDocument/typeDefinition" EdgeTextDocumentHover EdgeLabel = "textDocument/hover" EdgeTextDocumentReferences EdgeLabel = "textDocument/references" EdgeTextDocumentImplementation EdgeLabel = "textDocument/implementation" )
type Element ¶
type Element struct { // The unique identifier of this element within the scope of project. ID string `json:"id"` // The kind of element in the graph. Type ElementType `json:"type"` }
Element contains basic information of an element in the graph.
type ElementType ¶
type ElementType string
ElementType represents the kind of element.
const ( ElementVertex ElementType = "vertex" ElementEdge ElementType = "edge" )
type Event ¶
type Event struct { Vertex // The kind of event (begin or end). Kind string `json:"kind"` // The type of element this event describes (project or document). Scope string `json:"scope"` // The identifier of the data beginning or ending. Data string `json:"data"` }
Event is optional metadata emitted to give hints to consumers about the beginning and ending of new "socpes" (e.g. a project or document).
type HoverResult ¶
type HoverResult struct { Vertex // The result contents as the hover information. Result hoverResult `json:"result"` }
HoverResult connects a hover that is spread over multiple ranges or multiple documents.
func NewHoverResult ¶
func NewHoverResult(id string, contents []MarkedString) *HoverResult
NewHoverResult returns a new HoverResult object with given ID, signature and extra contents.
type Item ¶
type Item struct { Edge OutV string `json:"outV"` InVs []string `json:"inVs"` // The document the item belongs to. Document string `json:"document"` // The relationship property of the item. Property string `json:"property,omitempty"` }
Item is an edge object that represents "item" relation.
func NewItemOfDefinitions ¶
NewItemOfDefinitions returns a new Item object with given ID, vertices and document informationand in "definitions" relationship.
func NewItemOfReferences ¶
NewItemOfReferences returns a new Item object with given ID, vertices and document informationand in "references" relationship.
type JSONWriter ¶ added in v0.10.0
type JSONWriter interface {
Write(v interface{}) error
}
func NewJSONWriter ¶ added in v0.10.0
func NewJSONWriter(w io.Writer) JSONWriter
type MarkedString ¶
type MarkedString markedString
MarkedString is the object to describe marked string.
func NewMarkedString ¶
func NewMarkedString(s, languageID string) MarkedString
NewMarkedString returns a MarkedString with given string in language "go".
func RawMarkedString ¶
func RawMarkedString(s string) MarkedString
RawMarkedString returns a MarkedString consisting of only a raw string (i.e., "foo" instead of {"value":"foo", "language":"bar"}).
func (MarkedString) MarshalJSON ¶
func (m MarkedString) MarshalJSON() ([]byte, error)
func (*MarkedString) UnmarshalJSON ¶
func (m *MarkedString) UnmarshalJSON(data []byte) error
type MetaData ¶
type MetaData struct { Vertex // The version of the LSIF format using semver notation. Version string `json:"version"` // The project root (in form of an URI) used to compute this dump. ProjectRoot string `json:"projectRoot"` // The string encoding used to compute line and character values in // positions and ranges. Currently only 'utf-16' is support due to the // limitations in LSP. PositionEncoding string `json:"positionEncoding"` // The information about the tool that created the dump. ToolInfo ToolInfo `json:"toolInfo"` }
MetaData contains basic information about the dump.
func NewMetaData ¶
NewMetaData returns a new MetaData object with given ID, project root and tool information.
type Moniker ¶
type Moniker struct { Vertex // The kind of moniker (e.g. local, export, import). Kind string `json:"kind"` // The kind of moniker, usually a language or package manager. Scheme string `json:"scheme"` // The unique moniker identifier. Identifier string `json:"identifier"` }
Moniker describes a unique name for a result set or range.
func NewMoniker ¶
NewMoniker returns a new Moniker wtih the given ID, kind, scheme, and identifier.
type MonikerEdge ¶
MonikerEdge connects a moniker to a range or result set.
func NewMonikerEdge ¶
func NewMonikerEdge(id, outV, inV string) *MonikerEdge
NewMonikerEdge returns a new MonikerEdge with the given ID and vertices.
type NextMonikerEdge ¶
NextMonikerEdge connects a moniker to another moniker.
func NewNextMonikerEdge ¶
func NewNextMonikerEdge(id, outV, inV string) *NextMonikerEdge
NewNextMonikerEdge returns a new NextMonikerEdge with the given ID and vertices.
type PackageInformation ¶
type PackageInformation struct { Vertex // The name of the package. Name string `json:"name"` // The package manager. Manager string `json:"manager"` // The version of the package. Version string `json:"version"` }
PackageInformation describes a package for a moniker.
func NewPackageInformation ¶
func NewPackageInformation(id, name, manager, version string) *PackageInformation
NewPackageInformation returns a new PackageInformation with the given ID, name, manager, and version.
type PackageInformationEdge ¶
PackageInformationEdge connects a moniker and a package information vertex.
func NewPackageInformationEdge ¶
func NewPackageInformationEdge(id, outV, inV string) *PackageInformationEdge
NewPackageInformationEdge returns a new PackageInformationEdge with the given ID and vertices.
type Pos ¶
type Pos struct { // The line number (0-based index) Line int `json:"line"` // The column of the character (0-based index) Character int `json:"character"` }
Pos contains the precise position information.
type Project ¶
Project declares the language of the dump.
func NewProject ¶
NewProject returns a new Project object with given ID.
type Range ¶
type Range struct { Vertex // The start position of the range. Start Pos `json:"start"` // The end position of the range. End Pos `json:"end"` }
Range contains range information of a vertex object.
type ReferenceResult ¶
type ReferenceResult struct {
Vertex
}
ReferenceResult acts as a hub to be able to store reference information common to a set of ranges.
type ResultSet ¶
type ResultSet struct {
Vertex
}
ResultSet acts as a hub to be able to store information common to a set of ranges.
func NewReferenceResult ¶
NewReferenceResult returns a new ReferenceResult object with given ID.
func NewResultSet ¶
NewResultSet returns a new ResultSet object with given ID.
type TextDocumentDefinition ¶
TextDocumentDefinition is an edge object that represents "textDocument/definition" relation.
func NewTextDocumentDefinition ¶
func NewTextDocumentDefinition(id, outV, inV string) *TextDocumentDefinition
NewTextDocumentDefinition returns a new TextDocumentDefinition object with given ID and vertices information.
type TextDocumentHover ¶
TextDocumentHover is an edge object that represents "textDocument/hover" relation.
func NewTextDocumentHover ¶
func NewTextDocumentHover(id, outV, inV string) *TextDocumentHover
NewTextDocumentHover returns a new TextDocumentHover object with given ID and vertices information.
type TextDocumentReferences ¶
TextDocumentReferences is an edge object that represents "textDocument/references" relation.
func NewTextDocumentReferences ¶
func NewTextDocumentReferences(id, outV, inV string) *TextDocumentReferences
NewTextDocumentReferences returns a new TextDocumentReferences object with given ID and vertices information.
type ToolInfo ¶
type ToolInfo struct { // The name of the tool. Name string `json:"name"` // The version of the tool. Version string `json:"version,omitempty"` // The arguments passed to the tool. Args []string `json:"args,omitempty"` }
ToolInfo contains information about the tool that created the dump.
type Vertex ¶
type Vertex struct { Element // The kind of vertex in the graph. Label VertexLabel `json:"label"` }
Vertex contains information of a vertex in the graph.
type VertexLabel ¶
type VertexLabel string
VertexLabel represents the purpose of vertex.
const ( VertexMetaData VertexLabel = "metaData" VertexEvent VertexLabel = "$event" VertexProject VertexLabel = "project" VertexRange VertexLabel = "range" VertexLocation VertexLabel = "location" VertexDocument VertexLabel = "document" VertexMoniker VertexLabel = "moniker" VertexPackageInformation VertexLabel = "packageInformation" VertexResultSet VertexLabel = "resultSet" VertexDocumentSymbolResult VertexLabel = "documentSymbolResult" VertexFoldingRangeResult VertexLabel = "foldingRangeResult" VertexDocumentLinkResult VertexLabel = "documentLinkResult" VertexDianosticResult VertexLabel = "diagnosticResult" VertexDeclarationResult VertexLabel = "declarationResult" VertexDefinitionResult VertexLabel = "definitionResult" VertexTypeDefinitionResult VertexLabel = "typeDefinitionResult" VertexHoverResult VertexLabel = "hoverResult" VertexReferenceResult VertexLabel = "referenceResult" VertexImplementationResult VertexLabel = "implementationResult" )
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer emits vertices and edges to the underlying writer. This struct will guarantee that unique identifiers are generated for each element.
func NewWriter ¶
func NewWriter(w JSONWriter, addContents bool) *Writer
NewWriter creates a new Writer.
func (*Writer) EmitBeginEvent ¶
func (*Writer) EmitContains ¶
func (*Writer) EmitDefinitionResult ¶
func (*Writer) EmitDocument ¶
func (*Writer) EmitEndEvent ¶
func (*Writer) EmitHoverResult ¶
func (w *Writer) EmitHoverResult(contents []MarkedString) (string, error)