scip

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProtocolVersion_name = map[int32]string{
		0: "UnspecifiedProtocolVersion",
	}
	ProtocolVersion_value = map[string]int32{
		"UnspecifiedProtocolVersion": 0,
	}
)

Enum value maps for ProtocolVersion.

View Source
var (
	TextEncoding_name = map[int32]string{
		0: "UnspecifiedTextEncoding",
		1: "UTF8",
		2: "UTF16",
	}
	TextEncoding_value = map[string]int32{
		"UnspecifiedTextEncoding": 0,
		"UTF8":                    1,
		"UTF16":                   2,
	}
)

Enum value maps for TextEncoding.

View Source
var (
	PositionEncoding_name = map[int32]string{
		0: "UnspecifiedPositionEncoding",
		1: "UTF8CodeUnitOffsetFromLineStart",
		2: "UTF16CodeUnitOffsetFromLineStart",
		3: "UTF32CodeUnitOffsetFromLineStart",
	}
	PositionEncoding_value = map[string]int32{
		"UnspecifiedPositionEncoding":      0,
		"UTF8CodeUnitOffsetFromLineStart":  1,
		"UTF16CodeUnitOffsetFromLineStart": 2,
		"UTF32CodeUnitOffsetFromLineStart": 3,
	}
)

Enum value maps for PositionEncoding.

View Source
var (
	SymbolRole_name = map[int32]string{
		0:  "UnspecifiedSymbolRole",
		1:  "Definition",
		2:  "Import",
		4:  "WriteAccess",
		8:  "ReadAccess",
		16: "Generated",
		32: "Test",
		64: "ForwardDefinition",
	}
	SymbolRole_value = map[string]int32{
		"UnspecifiedSymbolRole": 0,
		"Definition":            1,
		"Import":                2,
		"WriteAccess":           4,
		"ReadAccess":            8,
		"Generated":             16,
		"Test":                  32,
		"ForwardDefinition":     64,
	}
)

Enum value maps for SymbolRole.

View Source
var (
	SyntaxKind_name = map[int32]string{
		0: "UnspecifiedSyntaxKind",
		1: "Comment",
		2: "PunctuationDelimiter",
		3: "PunctuationBracket",
		4: "Keyword",

		5:  "IdentifierOperator",
		6:  "Identifier",
		7:  "IdentifierBuiltin",
		8:  "IdentifierNull",
		9:  "IdentifierConstant",
		10: "IdentifierMutableGlobal",
		11: "IdentifierParameter",
		12: "IdentifierLocal",
		13: "IdentifierShadowed",
		14: "IdentifierNamespace",

		15: "IdentifierFunction",
		16: "IdentifierFunctionDefinition",
		17: "IdentifierMacro",
		18: "IdentifierMacroDefinition",
		19: "IdentifierType",
		20: "IdentifierBuiltinType",
		21: "IdentifierAttribute",
		22: "RegexEscape",
		23: "RegexRepeated",
		24: "RegexWildcard",
		25: "RegexDelimiter",
		26: "RegexJoin",
		27: "StringLiteral",
		28: "StringLiteralEscape",
		29: "StringLiteralSpecial",
		30: "StringLiteralKey",
		31: "CharacterLiteral",
		32: "NumericLiteral",
		33: "BooleanLiteral",
		34: "Tag",
		35: "TagAttribute",
		36: "TagDelimiter",
	}
	SyntaxKind_value = map[string]int32{
		"UnspecifiedSyntaxKind":        0,
		"Comment":                      1,
		"PunctuationDelimiter":         2,
		"PunctuationBracket":           3,
		"Keyword":                      4,
		"IdentifierKeyword":            4,
		"IdentifierOperator":           5,
		"Identifier":                   6,
		"IdentifierBuiltin":            7,
		"IdentifierNull":               8,
		"IdentifierConstant":           9,
		"IdentifierMutableGlobal":      10,
		"IdentifierParameter":          11,
		"IdentifierLocal":              12,
		"IdentifierShadowed":           13,
		"IdentifierNamespace":          14,
		"IdentifierModule":             14,
		"IdentifierFunction":           15,
		"IdentifierFunctionDefinition": 16,
		"IdentifierMacro":              17,
		"IdentifierMacroDefinition":    18,
		"IdentifierType":               19,
		"IdentifierBuiltinType":        20,
		"IdentifierAttribute":          21,
		"RegexEscape":                  22,
		"RegexRepeated":                23,
		"RegexWildcard":                24,
		"RegexDelimiter":               25,
		"RegexJoin":                    26,
		"StringLiteral":                27,
		"StringLiteralEscape":          28,
		"StringLiteralSpecial":         29,
		"StringLiteralKey":             30,
		"CharacterLiteral":             31,
		"NumericLiteral":               32,
		"BooleanLiteral":               33,
		"Tag":                          34,
		"TagAttribute":                 35,
		"TagDelimiter":                 36,
	}
)

Enum value maps for SyntaxKind.

View Source
var (
	Severity_name = map[int32]string{
		0: "UnspecifiedSeverity",
		1: "Error",
		2: "Warning",
		3: "Information",
		4: "Hint",
	}
	Severity_value = map[string]int32{
		"UnspecifiedSeverity": 0,
		"Error":               1,
		"Warning":             2,
		"Information":         3,
		"Hint":                4,
	}
)

Enum value maps for Severity.

View Source
var (
	DiagnosticTag_name = map[int32]string{
		0: "UnspecifiedDiagnosticTag",
		1: "Unnecessary",
		2: "Deprecated",
	}
	DiagnosticTag_value = map[string]int32{
		"UnspecifiedDiagnosticTag": 0,
		"Unnecessary":              1,
		"Deprecated":               2,
	}
)

Enum value maps for DiagnosticTag.

View Source
var (
	Language_name = map[int32]string{}/* 110 elements not displayed */

	Language_value = map[string]int32{}/* 110 elements not displayed */

)

Enum value maps for Language.

View Source
var (
	Descriptor_Suffix_name = map[int32]string{
		0: "UnspecifiedSuffix",
		1: "Namespace",

		2: "Type",
		3: "Term",
		4: "Method",
		5: "TypeParameter",
		6: "Parameter",
		7: "Meta",
		8: "Local",
		9: "Macro",
	}
	Descriptor_Suffix_value = map[string]int32{
		"UnspecifiedSuffix": 0,
		"Namespace":         1,
		"Package":           1,
		"Type":              2,
		"Term":              3,
		"Method":            4,
		"TypeParameter":     5,
		"Parameter":         6,
		"Meta":              7,
		"Local":             8,
		"Macro":             9,
	}
)

Enum value maps for Descriptor_Suffix.

View Source
var (
	SymbolInformation_Kind_name = map[int32]string{
		0:  "UnspecifiedKind",
		66: "AbstractMethod",
		72: "Accessor",
		1:  "Array",
		2:  "Assertion",
		3:  "AssociatedType",
		4:  "Attribute",
		5:  "Axiom",
		6:  "Boolean",
		7:  "Class",
		8:  "Constant",
		9:  "Constructor",
		62: "Contract",
		10: "DataFamily",
		73: "Delegate",
		11: "Enum",
		12: "EnumMember",
		63: "Error",
		13: "Event",
		14: "Fact",
		15: "Field",
		16: "File",
		17: "Function",
		18: "Getter",
		19: "Grammar",
		20: "Instance",
		21: "Interface",
		22: "Key",
		23: "Lang",
		24: "Lemma",
		64: "Library",
		25: "Macro",
		26: "Method",
		74: "MethodAlias",
		27: "MethodReceiver",
		67: "MethodSpecification",
		28: "Message",
		65: "Modifier",
		29: "Module",
		30: "Namespace",
		31: "Null",
		32: "Number",
		33: "Object",
		34: "Operator",
		35: "Package",
		36: "PackageObject",
		37: "Parameter",
		38: "ParameterLabel",
		39: "Pattern",
		40: "Predicate",
		41: "Property",
		42: "Protocol",
		68: "ProtocolMethod",
		69: "PureVirtualMethod",
		43: "Quasiquoter",
		44: "SelfParameter",
		45: "Setter",
		46: "Signature",
		75: "SingletonClass",
		76: "SingletonMethod",
		77: "StaticDataMember",
		78: "StaticEvent",
		79: "StaticField",
		80: "StaticMethod",
		81: "StaticProperty",
		82: "StaticVariable",
		48: "String",
		49: "Struct",
		47: "Subscript",
		50: "Tactic",
		51: "Theorem",
		52: "ThisParameter",
		53: "Trait",
		70: "TraitMethod",
		54: "Type",
		55: "TypeAlias",
		56: "TypeClass",
		71: "TypeClassMethod",
		57: "TypeFamily",
		58: "TypeParameter",
		59: "Union",
		60: "Value",
		61: "Variable",
	}
	SymbolInformation_Kind_value = map[string]int32{
		"UnspecifiedKind":     0,
		"AbstractMethod":      66,
		"Accessor":            72,
		"Array":               1,
		"Assertion":           2,
		"AssociatedType":      3,
		"Attribute":           4,
		"Axiom":               5,
		"Boolean":             6,
		"Class":               7,
		"Constant":            8,
		"Constructor":         9,
		"Contract":            62,
		"DataFamily":          10,
		"Delegate":            73,
		"Enum":                11,
		"EnumMember":          12,
		"Error":               63,
		"Event":               13,
		"Fact":                14,
		"Field":               15,
		"File":                16,
		"Function":            17,
		"Getter":              18,
		"Grammar":             19,
		"Instance":            20,
		"Interface":           21,
		"Key":                 22,
		"Lang":                23,
		"Lemma":               24,
		"Library":             64,
		"Macro":               25,
		"Method":              26,
		"MethodAlias":         74,
		"MethodReceiver":      27,
		"MethodSpecification": 67,
		"Message":             28,
		"Modifier":            65,
		"Module":              29,
		"Namespace":           30,
		"Null":                31,
		"Number":              32,
		"Object":              33,
		"Operator":            34,
		"Package":             35,
		"PackageObject":       36,
		"Parameter":           37,
		"ParameterLabel":      38,
		"Pattern":             39,
		"Predicate":           40,
		"Property":            41,
		"Protocol":            42,
		"ProtocolMethod":      68,
		"PureVirtualMethod":   69,
		"Quasiquoter":         43,
		"SelfParameter":       44,
		"Setter":              45,
		"Signature":           46,
		"SingletonClass":      75,
		"SingletonMethod":     76,
		"StaticDataMember":    77,
		"StaticEvent":         78,
		"StaticField":         79,
		"StaticMethod":        80,
		"StaticProperty":      81,
		"StaticVariable":      82,
		"String":              48,
		"Struct":              49,
		"Subscript":           47,
		"Tactic":              50,
		"Theorem":             51,
		"ThisParameter":       52,
		"Trait":               53,
		"TraitMethod":         70,
		"Type":                54,
		"TypeAlias":           55,
		"TypeClass":           56,
		"TypeClassMethod":     71,
		"TypeFamily":          57,
		"TypeParameter":       58,
		"Union":               59,
		"Value":               60,
		"Variable":            61,
	}
)

Enum value maps for SymbolInformation_Kind.

View Source
var DescriptorOnlyFormatter = SymbolFormatter{
	OnError:               func(err error) error { return err },
	IncludeScheme:         func(scheme string) bool { return scheme == "local" },
	IncludePackageManager: func(_ string) bool { return false },
	IncludePackageName:    func(_ string) bool { return false },
	IncludePackageVersion: func(_ string) bool { return false },
	IncludeDescriptor:     func(_ string) bool { return true },
	IncludeRawDescriptor:  func(_ *Descriptor) bool { return true },
	IncludeDisambiguator:  func(_ string) bool { return true },
}

DescriptorOnlyFormatter formats only the descriptor part of the symbol.

View Source
var LenientVerboseSymbolFormatter = SymbolFormatter{
	OnError:               func(_ error) error { return nil },
	IncludeScheme:         func(_ string) bool { return true },
	IncludePackageManager: func(_ string) bool { return true },
	IncludePackageName:    func(_ string) bool { return true },
	IncludePackageVersion: func(_ string) bool { return true },
	IncludeDescriptor:     func(_ string) bool { return true },
	IncludeRawDescriptor:  func(_ *Descriptor) bool { return true },
	IncludeDisambiguator:  func(_ string) bool { return true },
}

Same as VerboseSymbolFormatter but silently ignores errors.

View Source
var VerboseSymbolFormatter = SymbolFormatter{
	OnError:               func(err error) error { return err },
	IncludeScheme:         func(_ string) bool { return true },
	IncludePackageManager: func(_ string) bool { return true },
	IncludePackageName:    func(_ string) bool { return true },
	IncludePackageVersion: func(_ string) bool { return true },
	IncludeDescriptor:     func(_ string) bool { return true },
	IncludeRawDescriptor:  func(_ *Descriptor) bool { return true },
	IncludeDisambiguator:  func(_ string) bool { return true },
}

VerboseSymbolFormatter formats all parts of the symbol.

Functions

func ConvertSCIPToLSIF

func ConvertSCIPToLSIF(index *Index) ([]reader.Element, error)

ConvertSCIPToLSIF takes a SCIP index and returns the equivalent LSIF index. There doesn't exist a reliable bijection between SCIP and LSIF.

This conversion is lossy because SCIP includes metadata that has no equivalent encoding in LSIF, such as scip.SymbolRole beyond the definition role.

Also, LSIF allows encoding certain behaviors that SCIP current doesn't support, such as asymmetric references/definitions.

This conversion functionality is used by src-cli.

func ElementsToJsonElements

func ElementsToJsonElements(els []reader.Element) []jsonElement

func IsGlobalSymbol

func IsGlobalSymbol(symbol string) bool

IsGlobalSymbol returns true if the symbol is obviously not a local symbol.

CAUTION: Does not perform full validation of the symbol string's contents.

func IsLocalSymbol

func IsLocalSymbol(symbol string) bool

IsLocalSymbol returns true if the symbol is obviously not a global symbol.

CAUTION: Does not perform full validation of the symbol string's contents.

func WriteNDJSON

func WriteNDJSON(elements []jsonElement, out io.Writer) error

Types

type Descriptor

type Descriptor struct {
	Name          string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Disambiguator string            `protobuf:"bytes,2,opt,name=disambiguator,proto3" json:"disambiguator,omitempty"`
	Suffix        Descriptor_Suffix `protobuf:"varint,3,opt,name=suffix,proto3,enum=scip.Descriptor_Suffix" json:"suffix,omitempty"`
	// contains filtered or unexported fields
}

func (*Descriptor) Descriptor deprecated

func (*Descriptor) Descriptor() ([]byte, []int)

Deprecated: Use Descriptor.ProtoReflect.Descriptor instead.

func (*Descriptor) GetDisambiguator

func (x *Descriptor) GetDisambiguator() string

func (*Descriptor) GetName

func (x *Descriptor) GetName() string

func (*Descriptor) GetSuffix

func (x *Descriptor) GetSuffix() Descriptor_Suffix

func (*Descriptor) ProtoMessage

func (*Descriptor) ProtoMessage()

func (*Descriptor) ProtoReflect

func (x *Descriptor) ProtoReflect() protoreflect.Message

func (*Descriptor) Reset

func (x *Descriptor) Reset()

func (*Descriptor) String

func (x *Descriptor) String() string

type Descriptor_Suffix

type Descriptor_Suffix int32
const (
	Descriptor_UnspecifiedSuffix Descriptor_Suffix = 0
	// Unit of code abstraction and/or namespacing.
	//
	// NOTE: This corresponds to a package in Go and JVM languages.
	Descriptor_Namespace Descriptor_Suffix = 1
	// Use Namespace instead.
	//
	// Deprecated: Marked as deprecated in scip.proto.
	Descriptor_Package       Descriptor_Suffix = 1
	Descriptor_Type          Descriptor_Suffix = 2
	Descriptor_Term          Descriptor_Suffix = 3
	Descriptor_Method        Descriptor_Suffix = 4
	Descriptor_TypeParameter Descriptor_Suffix = 5
	Descriptor_Parameter     Descriptor_Suffix = 6
	// Can be used for any purpose.
	Descriptor_Meta  Descriptor_Suffix = 7
	Descriptor_Local Descriptor_Suffix = 8
	Descriptor_Macro Descriptor_Suffix = 9
)

func (Descriptor_Suffix) Descriptor

func (Descriptor_Suffix) Enum

func (Descriptor_Suffix) EnumDescriptor deprecated

func (Descriptor_Suffix) EnumDescriptor() ([]byte, []int)

Deprecated: Use Descriptor_Suffix.Descriptor instead.

func (Descriptor_Suffix) Number

func (Descriptor_Suffix) String

func (x Descriptor_Suffix) String() string

func (Descriptor_Suffix) Type

type Diagnostic

type Diagnostic struct {

	// Should this diagnostic be reported as an error, warning, info, or hint?
	Severity Severity `protobuf:"varint,1,opt,name=severity,proto3,enum=scip.Severity" json:"severity,omitempty"`
	// (optional) Code of this diagnostic, which might appear in the user interface.
	Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
	// Message of this diagnostic.
	Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	// (optional) Human-readable string describing the source of this diagnostic, e.g.
	// 'typescript' or 'super lint'.
	Source string          `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"`
	Tags   []DiagnosticTag `protobuf:"varint,5,rep,packed,name=tags,proto3,enum=scip.DiagnosticTag" json:"tags,omitempty"`
	// contains filtered or unexported fields
}

Represents a diagnostic, such as a compiler error or warning, which should be reported for a document.

func CanonicalizeDiagnostic added in v0.3.0

func CanonicalizeDiagnostic(diagnostic *Diagnostic) *Diagnostic

CanonicalizeDiagnostic deterministically re-orders the fields of the given diagnostic.

func CanonicalizeDiagnostics added in v0.3.0

func CanonicalizeDiagnostics(diagnostics []*Diagnostic) []*Diagnostic

CanonicalizeDiagnostics deterministically re-orders the fields of the given diagnostic slice.

func SanitizeDiagnostic added in v0.3.0

func SanitizeDiagnostic(diagnostic *Diagnostic) *Diagnostic

SanitizeDiagnostic ensures that all strings in the given diagnostic are valid UTF-8. This is a requirement for successful protobuf encoding.

func SanitizeDiagnostics added in v0.3.0

func SanitizeDiagnostics(diagnostics []*Diagnostic) []*Diagnostic

SanitizeDiagnostics ensures that all strings in the given diagnostic slice are valid UTF-8. The input slice is modified in-place but returned for convenience. This is a requirement for successful protobuf encoding.

func SortDiagnostics added in v0.3.0

func SortDiagnostics(diagnostics []*Diagnostic) []*Diagnostic

SortDiagnostics sorts the given diagnostics slice (in-place) and returns it (for convenience). Diagnostics are sorted first by severity (more severe earlier in the slice) and then by the diagnostic message.

func (*Diagnostic) Descriptor deprecated

func (*Diagnostic) Descriptor() ([]byte, []int)

Deprecated: Use Diagnostic.ProtoReflect.Descriptor instead.

func (*Diagnostic) GetCode

func (x *Diagnostic) GetCode() string

func (*Diagnostic) GetMessage

func (x *Diagnostic) GetMessage() string

func (*Diagnostic) GetSeverity

func (x *Diagnostic) GetSeverity() Severity

func (*Diagnostic) GetSource

func (x *Diagnostic) GetSource() string

func (*Diagnostic) GetTags

func (x *Diagnostic) GetTags() []DiagnosticTag

func (*Diagnostic) ProtoMessage

func (*Diagnostic) ProtoMessage()

func (*Diagnostic) ProtoReflect

func (x *Diagnostic) ProtoReflect() protoreflect.Message

func (*Diagnostic) Reset

func (x *Diagnostic) Reset()

func (*Diagnostic) String

func (x *Diagnostic) String() string

type DiagnosticTag

type DiagnosticTag int32
const (
	DiagnosticTag_UnspecifiedDiagnosticTag DiagnosticTag = 0
	DiagnosticTag_Unnecessary              DiagnosticTag = 1
	DiagnosticTag_Deprecated               DiagnosticTag = 2
)

func SortDiagnosticTags added in v0.3.0

func SortDiagnosticTags(tags []DiagnosticTag) []DiagnosticTag

SortDiagnosticTags sorts the given diagnostic tags slice (in-place) and returns it (for convenience).

func (DiagnosticTag) Descriptor

func (DiagnosticTag) Enum

func (x DiagnosticTag) Enum() *DiagnosticTag

func (DiagnosticTag) EnumDescriptor deprecated

func (DiagnosticTag) EnumDescriptor() ([]byte, []int)

Deprecated: Use DiagnosticTag.Descriptor instead.

func (DiagnosticTag) Number

func (DiagnosticTag) String

func (x DiagnosticTag) String() string

func (DiagnosticTag) Type

type Document

type Document struct {

	// The string ID for the programming language this file is written in.
	// The `Language` enum contains the names of most common programming languages.
	// This field is typed as a string to permit any programming language, including
	// ones that are not specified by the `Language` enum.
	Language string `protobuf:"bytes,4,opt,name=language,proto3" json:"language,omitempty"`
	// (Required) Unique path to the text document.
	//
	//  1. The path must be relative to the directory supplied in the associated
	//     `Metadata.project_root`.
	//  2. The path must not begin with a leading '/'.
	//  3. The path must point to a regular file, not a symbolic link.
	//  4. The path must use '/' as the separator, including on Windows.
	//  5. The path must be canonical; it cannot include empty components ('//'),
	//     or '.' or '..'.
	RelativePath string `protobuf:"bytes,1,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"`
	// Occurrences that appear in this file.
	Occurrences []*Occurrence `protobuf:"bytes,2,rep,name=occurrences,proto3" json:"occurrences,omitempty"`
	// Symbols that are "defined" within this document.
	//
	// This should include symbols which technically do not have any definition,
	// but have a reference and are defined by some other symbol (see
	// Relationship.is_definition).
	Symbols []*SymbolInformation `protobuf:"bytes,3,rep,name=symbols,proto3" json:"symbols,omitempty"`
	// (optional) Text contents of the this document. Indexers are not expected to
	// include the text by default. It's preferrable that clients read the text
	// contents from the file system by resolving the absolute path from joining
	// `Index.metadata.project_root` and `Document.relative_path`. This field was
	// introduced to support `SymbolInformation.signature_documentation`, but it
	// can be used for other purposes as well, for example testing or when working
	// with virtual/in-memory documents.
	Text string `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"`
	// Specifies the encoding used for source ranges in this Document.
	//
	// Usually, this will match the type used to index the string type
	// in the indexer's implementation language in O(1) time.
	//   - For an indexer implemented in JVM/.NET language or JavaScript/TypeScript,
	//     use UTF16CodeUnitOffsetFromLineStart.
	//   - For an indexer implemented in Python,
	//     use UTF32CodeUnitOffsetFromLineStart.
	//   - For an indexer implemented in Go, Rust or C++,
	//     use UTF8ByteOffsetFromLineStart.
	PositionEncoding PositionEncoding `` /* 137-byte string literal not displayed */
	// contains filtered or unexported fields
}

Document defines the metadata about a source file on disk.

func CanonicalizeDocument added in v0.3.0

func CanonicalizeDocument(document *Document) *Document

CanonicalizeDocument deterministically re-orders the fields of the given document.

func FlattenDocuments added in v0.3.0

func FlattenDocuments(documents []*Document) []*Document

FlattenDocuments merges elements of the given slice with the same relative path. This allows us to make the assumption post-canonicalization that each index has one representation of a given document path in the database. This function returns a new slice.

func SanitizeDocument added in v0.3.0

func SanitizeDocument(document *Document) *Document

SanitizeDocument ensures that all strings in the given document are valid UTF-8. This is a requirement for successful protobuf encoding.

func SortDocuments added in v0.3.0

func SortDocuments(documents []*Document) []*Document

SortDocuments sorts the given documents slice (in-place) and returns it (for convenience). Documents are sorted in ascending order of their relative path.

func (*Document) Descriptor deprecated

func (*Document) Descriptor() ([]byte, []int)

Deprecated: Use Document.ProtoReflect.Descriptor instead.

func (*Document) GetLanguage added in v0.2.0

func (x *Document) GetLanguage() string

func (*Document) GetOccurrences

func (x *Document) GetOccurrences() []*Occurrence

func (*Document) GetPositionEncoding added in v0.3.3

func (x *Document) GetPositionEncoding() PositionEncoding

func (*Document) GetRelativePath

func (x *Document) GetRelativePath() string

func (*Document) GetSymbols

func (x *Document) GetSymbols() []*SymbolInformation

func (*Document) GetText added in v0.3.0

func (x *Document) GetText() string

func (*Document) ProtoMessage

func (*Document) ProtoMessage()

func (*Document) ProtoReflect

func (x *Document) ProtoReflect() protoreflect.Message

func (*Document) Reset

func (x *Document) Reset()

func (*Document) String

func (x *Document) String() string

func (*Document) SymbolTable

func (x *Document) SymbolTable() map[string]*SymbolInformation

SymbolTable returns a map of SymbolInformation values keyed by the symbol field.

type Index

type Index struct {

	// Metadata about this index.
	Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// Documents that belong to this index.
	Documents []*Document `protobuf:"bytes,2,rep,name=documents,proto3" json:"documents,omitempty"`
	// (optional) Symbols that are referenced from this index but are defined in
	// an external package (a separate `Index` message). Leave this field empty
	// if you assume the external package will get indexed separately. If the
	// external package won't get indexed for some reason then you can use this
	// field to provide hover documentation for those external symbols.
	ExternalSymbols []*SymbolInformation `protobuf:"bytes,3,rep,name=external_symbols,json=externalSymbols,proto3" json:"external_symbols,omitempty"`
	// contains filtered or unexported fields
}

Index represents a complete SCIP index for a workspace this is rooted at a single directory. An Index message payload can have a large memory footprint and it's therefore recommended to emit and consume an Index payload one field value at a time. To permit streaming consumption of an Index payload, the `metadata` field must appear at the start of the stream and must only appear once in the stream. Other field values may appear in any order.

func (*Index) Descriptor deprecated

func (*Index) Descriptor() ([]byte, []int)

Deprecated: Use Index.ProtoReflect.Descriptor instead.

func (*Index) GetDocuments

func (x *Index) GetDocuments() []*Document

func (*Index) GetExternalSymbols

func (x *Index) GetExternalSymbols() []*SymbolInformation

func (*Index) GetMetadata

func (x *Index) GetMetadata() *Metadata

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) ProtoReflect

func (x *Index) ProtoReflect() protoreflect.Message

func (*Index) Reset

func (x *Index) Reset()

func (*Index) String

func (x *Index) String() string

type IndexVisitor added in v0.3.0

type IndexVisitor struct {
	VisitMetadata       func(*Metadata)
	VisitDocument       func(*Document)
	VisitExternalSymbol func(*SymbolInformation)
}

IndexVisitor is a struct of functions rather than an interface since Go doesn't support adding new functions to interfaces with default implementations, so adding new functions here for new fields in the SCIP schema would break clients. Individual functions may be nil.

func (*IndexVisitor) ParseStreaming added in v0.3.0

func (pi *IndexVisitor) ParseStreaming(r io.Reader) error

ParseStreaming processes an index by incrementally reading input from the io.Reader.

Parsing takes place at Document granularity for ease of use.

type Language added in v0.2.0

type Language int32

Language standardises names of common programming languages that can be used for the `Document.language` field. The primary purpose of this enum is to prevent a situation where we have a single programming language ends up with multiple string representations. For example, the C++ language uses the name "CPP" in this enum and other names such as "cpp" are incompatible. Feel free to send a pull-request to add missing programming languages.

const (
	Language_UnspecifiedLanguage Language = 0
	Language_ABAP                Language = 60
	Language_Apex                Language = 96
	Language_APL                 Language = 49
	Language_Ada                 Language = 39
	Language_Agda                Language = 45
	Language_AsciiDoc            Language = 86
	Language_Assembly            Language = 58
	Language_Awk                 Language = 66
	Language_Bat                 Language = 68
	Language_BibTeX              Language = 81
	Language_C                   Language = 34
	Language_COBOL               Language = 59
	Language_CPP                 Language = 35 // C++ (the name "CPP" was chosen for consistency with LSP)
	Language_CSS                 Language = 26
	Language_CSharp              Language = 1
	Language_Clojure             Language = 8
	Language_Coffeescript        Language = 21
	Language_CommonLisp          Language = 9
	Language_Coq                 Language = 47
	Language_CUDA                Language = 97
	Language_Dart                Language = 3
	Language_Delphi              Language = 57
	Language_Diff                Language = 88
	Language_Dockerfile          Language = 80
	Language_Dyalog              Language = 50
	Language_Elixir              Language = 17
	Language_Erlang              Language = 18
	Language_FSharp              Language = 42
	Language_Fish                Language = 65
	Language_Flow                Language = 24
	Language_Fortran             Language = 56
	Language_Git_Commit          Language = 91
	Language_Git_Config          Language = 89
	Language_Git_Rebase          Language = 92
	Language_Go                  Language = 33
	Language_GraphQL             Language = 98
	Language_Groovy              Language = 7
	Language_HTML                Language = 30
	Language_Hack                Language = 20
	Language_Handlebars          Language = 90
	Language_Haskell             Language = 44
	Language_Idris               Language = 46
	Language_Ini                 Language = 72
	Language_J                   Language = 51
	Language_JSON                Language = 75
	Language_Java                Language = 6
	Language_JavaScript          Language = 22
	Language_JavaScriptReact     Language = 93
	Language_Jsonnet             Language = 76
	Language_Julia               Language = 55
	Language_Justfile            Language = 109
	Language_Kotlin              Language = 4
	Language_LaTeX               Language = 83
	Language_Lean                Language = 48
	Language_Less                Language = 27
	Language_Lua                 Language = 12
	Language_Luau                Language = 108
	Language_Makefile            Language = 79
	Language_Markdown            Language = 84
	Language_Matlab              Language = 52
	Language_Nickel              Language = 110 // https://nickel-lang.org/
	Language_Nix                 Language = 77
	Language_OCaml               Language = 41
	Language_Objective_C         Language = 36
	Language_Objective_CPP       Language = 37
	Language_Pascal              Language = 99
	Language_PHP                 Language = 19
	Language_PLSQL               Language = 70
	Language_Perl                Language = 13
	Language_PowerShell          Language = 67
	Language_Prolog              Language = 71
	Language_Protobuf            Language = 100
	Language_Python              Language = 15
	Language_R                   Language = 54
	Language_Racket              Language = 11
	Language_Raku                Language = 14
	Language_Razor               Language = 62
	Language_Repro               Language = 102 // Internal language for testing SCIP
	Language_ReST                Language = 85
	Language_Ruby                Language = 16
	Language_Rust                Language = 40
	Language_SAS                 Language = 61
	Language_SCSS                Language = 29
	Language_SML                 Language = 43
	Language_SQL                 Language = 69
	Language_Sass                Language = 28
	Language_Scala               Language = 5
	Language_Scheme              Language = 10
	Language_ShellScript         Language = 64 // Bash
	Language_Skylark             Language = 78
	Language_Slang               Language = 107
	Language_Solidity            Language = 95
	Language_Svelte              Language = 106
	Language_Swift               Language = 2
	Language_Tcl                 Language = 101
	Language_TOML                Language = 73
	Language_TeX                 Language = 82
	Language_Thrift              Language = 103
	Language_TypeScript          Language = 23
	Language_TypeScriptReact     Language = 94
	Language_Verilog             Language = 104
	Language_VHDL                Language = 105
	Language_VisualBasic         Language = 63
	Language_Vue                 Language = 25
	Language_Wolfram             Language = 53
	Language_XML                 Language = 31
	Language_XSL                 Language = 32
	Language_YAML                Language = 74
	Language_Zig                 Language = 38
)

func (Language) Descriptor added in v0.2.0

func (Language) Descriptor() protoreflect.EnumDescriptor

func (Language) Enum added in v0.2.0

func (x Language) Enum() *Language

func (Language) EnumDescriptor deprecated added in v0.2.0

func (Language) EnumDescriptor() ([]byte, []int)

Deprecated: Use Language.Descriptor instead.

func (Language) Number added in v0.2.0

func (x Language) Number() protoreflect.EnumNumber

func (Language) String added in v0.2.0

func (x Language) String() string

func (Language) Type added in v0.2.0

type Metadata

type Metadata struct {

	// Which version of this protocol was used to generate this index?
	Version ProtocolVersion `protobuf:"varint,1,opt,name=version,proto3,enum=scip.ProtocolVersion" json:"version,omitempty"`
	// Information about the tool that produced this index.
	ToolInfo *ToolInfo `protobuf:"bytes,2,opt,name=tool_info,json=toolInfo,proto3" json:"tool_info,omitempty"`
	// URI-encoded absolute path to the root directory of this index. All
	// documents in this index must appear in a subdirectory of this root
	// directory.
	ProjectRoot string `protobuf:"bytes,3,opt,name=project_root,json=projectRoot,proto3" json:"project_root,omitempty"`
	// Text encoding of the source files on disk that are referenced from
	// `Document.relative_path`. This value is unrelated to the `Document.text`
	// field, which is a Protobuf string and hence must be UTF-8 encoded.
	TextDocumentEncoding TextEncoding `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Metadata) Descriptor deprecated

func (*Metadata) Descriptor() ([]byte, []int)

Deprecated: Use Metadata.ProtoReflect.Descriptor instead.

func (*Metadata) GetProjectRoot

func (x *Metadata) GetProjectRoot() string

func (*Metadata) GetTextDocumentEncoding

func (x *Metadata) GetTextDocumentEncoding() TextEncoding

func (*Metadata) GetToolInfo

func (x *Metadata) GetToolInfo() *ToolInfo

func (*Metadata) GetVersion

func (x *Metadata) GetVersion() ProtocolVersion

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) ProtoReflect

func (x *Metadata) ProtoReflect() protoreflect.Message

func (*Metadata) Reset

func (x *Metadata) Reset()

func (*Metadata) String

func (x *Metadata) String() string

type Occurrence

type Occurrence struct {

	// Source position of this occurrence. Must be exactly three or four
	// elements:
	//
	//   - Four elements: `[startLine, startCharacter, endLine, endCharacter]`
	//   - Three elements: `[startLine, startCharacter, endCharacter]`. The end line
	//     is inferred to have the same value as the start line.
	//
	// Line numbers and characters are always 0-based. Make sure to increment the
	// line/character values before displaying them in an editor-like UI because
	// editors conventionally use 1-based numbers.
	//
	// The 'character' value is interpreted based on the PositionEncoding for
	// the Document.
	//
	// Historical note: the original draft of this schema had a `Range` message
	// type with `start` and `end` fields of type `Position`, mirroring LSP.
	// Benchmarks revealed that this encoding was inefficient and that we could
	// reduce the total payload size of an index by 50% by using `repeated int32`
	// instead. The `repeated int32` encoding is admittedly more embarrassing to
	// work with in some programming languages but we hope the performance
	// improvements make up for it.
	Range []int32 `protobuf:"varint,1,rep,packed,name=range,proto3" json:"range,omitempty"`
	// (optional) The symbol that appears at this position. See
	// `SymbolInformation.symbol` for how to format symbols as strings.
	Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty"`
	// (optional) Bitset containing `SymbolRole`s in this occurrence.
	// See `SymbolRole`'s documentation for how to read and write this field.
	SymbolRoles int32 `protobuf:"varint,3,opt,name=symbol_roles,json=symbolRoles,proto3" json:"symbol_roles,omitempty"`
	// (optional) CommonMark-formatted documentation for this specific range. If
	// empty, the `Symbol.documentation` field is used instead. One example
	// where this field might be useful is when the symbol represents a generic
	// function (with abstract type parameters such as `List<T>`) and at this
	// occurrence we know the exact values (such as `List<String>`).
	//
	// This field can also be used for dynamically or gradually typed languages,
	// which commonly allow for type-changing assignment.
	OverrideDocumentation []string `protobuf:"bytes,4,rep,name=override_documentation,json=overrideDocumentation,proto3" json:"override_documentation,omitempty"`
	// (optional) What syntax highlighting class should be used for this range?
	SyntaxKind SyntaxKind `protobuf:"varint,5,opt,name=syntax_kind,json=syntaxKind,proto3,enum=scip.SyntaxKind" json:"syntax_kind,omitempty"`
	// (optional) Diagnostics that have been reported for this specific range.
	Diagnostics []*Diagnostic `protobuf:"bytes,6,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"`
	// (optional) Using the same encoding as the sibling `range` field, source
	// position of the nearest non-trivial enclosing AST node. This range must
	// enclose the `range` field. Example applications that make use of the
	// enclosing_range field:
	//
	//   - Call hierarchies: to determine what symbols are references from the body
	//     of a function
	//   - Symbol outline: to display breadcrumbs from the cursor position to the
	//     root of the file
	//   - Expand selection: to select the nearest enclosing AST node.
	//   - Highlight range: to indicate the AST expression that is associated with a
	//     hover popover
	//
	// For definition occurrences, the enclosing range should indicate the
	// start/end bounds of the entire definition AST node, including
	// documentation.
	// “`
	// const n = 3
	//
	//	^ range
	//
	// ^^^^^^^^^^^ enclosing_range
	//
	// /** Parses the string into something */
	// ^ enclosing_range start --------------------------------------|
	// function parse(input string): string {                        |
	//
	//	         ^^^^^ range                                          |
	//	    return input.slice(n)                                     |
	//	}                                                             |
	//
	// ^ enclosing_range end <---------------------------------------|
	// “`
	//
	// Any attributes/decorators/attached macros should also be part of the
	// enclosing range.
	//
	// “`python
	// @cache
	// ^ enclosing_range start---------------------|
	// def factorial(n):                           |
	//
	//	return n * factorial(n-1) if n else 1   |
	//
	// < enclosing_range end-----------------------|
	//
	// “`
	//
	// For reference occurrences, the enclosing range should indicate the start/end
	// bounds of the parent expression.
	// “`
	// const a = a.b
	//
	//	  ^ range
	//	^^^ enclosing_range
	//
	// const b = a.b(41).f(42).g(43)
	//
	//	        ^ range
	//	^^^^^^^^^^^^^ enclosing_range
	//
	// “`
	EnclosingRange []int32 `protobuf:"varint,7,rep,packed,name=enclosing_range,json=enclosingRange,proto3" json:"enclosing_range,omitempty"`
	// contains filtered or unexported fields
}

Occurrence associates a source position with a symbol and/or highlighting information.

If possible, indexers should try to bundle logically related information across occurrences into a single occurrence to reduce payload sizes.

func CanonicalizeOccurrence added in v0.3.0

func CanonicalizeOccurrence(occurrence *Occurrence) *Occurrence

CanonicalizeOccurrence deterministically re-orders the fields of the given occurrence.

func CanonicalizeOccurrences added in v0.3.0

func CanonicalizeOccurrences(occurrences []*Occurrence) []*Occurrence

CanonicalizeOccurrences deterministically re-orders the fields of the given occurrence slice.

func FindOccurrences added in v0.3.0

func FindOccurrences(occurrences []*Occurrence, targetLine, targetCharacter int32) []*Occurrence

FindOccurrences filters the given slice of occurrences and returns those that contain the position represented by line and character. The order of the output slice is "inside-out", so that earlier occurrences are properly enclosed by later occurrences.

func FlattenOccurrences added in v0.3.0

func FlattenOccurrences(occurrences []*Occurrence) []*Occurrence

FlattenOccurrences merges elements of the given slice with equivalent bounds. This function returns a new slice.

func RemoveIllegalOccurrences added in v0.3.1

func RemoveIllegalOccurrences(occurrences []*Occurrence) []*Occurrence

RemoveIllegalOccurrences removes all occurrences that do not include a range. This is emitted by some indexers and will silently crash a downstream process, including further canonicalization, when trying to convert an empty slice into a valid range.

func SanitizeOccurrence added in v0.3.0

func SanitizeOccurrence(occurrence *Occurrence) *Occurrence

SanitizeOccurrence ensures that all strings in the given occurrence are valid UTF-8. This is a requirement for successful protobuf encoding.

func SanitizeOccurrences added in v0.3.0

func SanitizeOccurrences(occurrences []*Occurrence) []*Occurrence

SanitizeOccurrences ensures that all strings in the given occurrence slice are valid UTF-8. The input slice is modified in-place but returned for convenience. This is a requirement for successful protobuf encoding.

func SortOccurrences added in v0.3.0

func SortOccurrences(occurrences []*Occurrence) []*Occurrence

SortOccurrences sorts the given occurrence slice (in-place) and returns it (for convenience). Occurrences sorted in ascending order of their range's starting position, where enclosing ranges come before the enclosed. If there are multiple occurrences with the exact same range, then the occurrences are sorted by symbol name.

func (*Occurrence) Descriptor deprecated

func (*Occurrence) Descriptor() ([]byte, []int)

Deprecated: Use Occurrence.ProtoReflect.Descriptor instead.

func (*Occurrence) GetDiagnostics

func (x *Occurrence) GetDiagnostics() []*Diagnostic

func (*Occurrence) GetEnclosingRange added in v0.3.0

func (x *Occurrence) GetEnclosingRange() []int32

func (*Occurrence) GetOverrideDocumentation

func (x *Occurrence) GetOverrideDocumentation() []string

func (*Occurrence) GetRange

func (x *Occurrence) GetRange() []int32

func (*Occurrence) GetSymbol

func (x *Occurrence) GetSymbol() string

func (*Occurrence) GetSymbolRoles

func (x *Occurrence) GetSymbolRoles() int32

func (*Occurrence) GetSyntaxKind

func (x *Occurrence) GetSyntaxKind() SyntaxKind

func (*Occurrence) ProtoMessage

func (*Occurrence) ProtoMessage()

func (*Occurrence) ProtoReflect

func (x *Occurrence) ProtoReflect() protoreflect.Message

func (*Occurrence) Reset

func (x *Occurrence) Reset()

func (*Occurrence) String

func (x *Occurrence) String() string

type Package

type Package struct {
	Manager string `protobuf:"bytes,1,opt,name=manager,proto3" json:"manager,omitempty"`
	Name    string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

Unit of packaging and distribution.

NOTE: This corresponds to a module in Go and JVM languages.

func (*Package) Descriptor deprecated

func (*Package) Descriptor() ([]byte, []int)

Deprecated: Use Package.ProtoReflect.Descriptor instead.

func (*Package) GetManager

func (x *Package) GetManager() string

func (*Package) GetName

func (x *Package) GetName() string

func (*Package) GetVersion

func (x *Package) GetVersion() string

func (*Package) ID

func (x *Package) ID() string

func (*Package) ProtoMessage

func (*Package) ProtoMessage()

func (*Package) ProtoReflect

func (x *Package) ProtoReflect() protoreflect.Message

func (*Package) Reset

func (x *Package) Reset()

func (*Package) String

func (x *Package) String() string

type Position

type Position struct {
	Line      int32
	Character int32
}

Position represents an offset position.

type PositionEncoding added in v0.3.3

type PositionEncoding int32

Encoding used to interpret the 'character' value in source ranges.

const (
	// Default value. This value should not be used by new SCIP indexers
	// so that a consumer can process the SCIP index without ambiguity.
	PositionEncoding_UnspecifiedPositionEncoding PositionEncoding = 0
	// The 'character' value is interpreted as an offset in terms
	// of UTF-8 code units (i.e. bytes).
	//
	// Example: For the string "🚀 Woo" in UTF-8, the bytes are
	// [240, 159, 154, 128, 32, 87, 111, 111], so the offset for 'W'
	// would be 5.
	PositionEncoding_UTF8CodeUnitOffsetFromLineStart PositionEncoding = 1
	// The 'character' value is interpreted as an offset in terms
	// of UTF-16 code units (each is 2 bytes).
	//
	// Example: For the string "🚀 Woo", the UTF-16 code units are
	// ['\ud83d', '\ude80', ' ', 'W', 'o', 'o'], so the offset for 'W'
	// would be 3.
	PositionEncoding_UTF16CodeUnitOffsetFromLineStart PositionEncoding = 2
	// The 'character' value is interpreted as an offset in terms
	// of UTF-32 code units (each is 4 bytes).
	//
	// Example: For the string "🚀 Woo", the UTF-32 code units are
	// ['🚀', ' ', 'W', 'o', 'o'], so the offset for 'W' would be 2.
	PositionEncoding_UTF32CodeUnitOffsetFromLineStart PositionEncoding = 3
)

func (PositionEncoding) Descriptor added in v0.3.3

func (PositionEncoding) Enum added in v0.3.3

func (PositionEncoding) EnumDescriptor deprecated added in v0.3.3

func (PositionEncoding) EnumDescriptor() ([]byte, []int)

Deprecated: Use PositionEncoding.Descriptor instead.

func (PositionEncoding) Number added in v0.3.3

func (PositionEncoding) String added in v0.3.3

func (x PositionEncoding) String() string

func (PositionEncoding) Type added in v0.3.3

type ProtocolVersion

type ProtocolVersion int32
const (
	ProtocolVersion_UnspecifiedProtocolVersion ProtocolVersion = 0
)

func (ProtocolVersion) Descriptor

func (ProtocolVersion) Enum

func (x ProtocolVersion) Enum() *ProtocolVersion

func (ProtocolVersion) EnumDescriptor deprecated

func (ProtocolVersion) EnumDescriptor() ([]byte, []int)

Deprecated: Use ProtocolVersion.Descriptor instead.

func (ProtocolVersion) Number

func (ProtocolVersion) String

func (x ProtocolVersion) String() string

func (ProtocolVersion) Type

type Range

type Range struct {
	Start Position
	End   Position
}

Range represents a range between two offset positions. NOTE: the github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol package contains similarly shaped structs but this one exists primarily to make it easier to work with SCIP encoded positions, which have the type []int32 in Protobuf payloads.

func NewRange

func NewRange(scipRange []int32) *Range

NewRange converts an SCIP range into `Range`

func SortRanges added in v0.3.0

func SortRanges(ranges []*Range) []*Range

SortRanges sorts the given range slice (in-place) and returns it (for convenience). Ranges are sorted in ascending order of starting position, where enclosing ranges come before the enclosed.

func (Range) IsSingleLine

func (r Range) IsSingleLine() bool

func (Range) SCIPRange

func (r Range) SCIPRange() []int32

type Relationship

type Relationship struct {
	Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
	// When resolving "Find references", this field documents what other symbols
	// should be included together with this symbol. For example, consider the
	// following TypeScript code that defines two symbols `Animal#sound()` and
	// `Dog#sound()`:
	// “`ts
	//
	//	interface Animal {
	//	          ^^^^^^ definition Animal#
	//	  sound(): string
	//	  ^^^^^ definition Animal#sound()
	//	}
	//
	//	class Dog implements Animal {
	//	      ^^^ definition Dog#, relationships = [{symbol: "Animal#", is_implementation: true}]
	//	  public sound(): string { return "woof" }
	//	         ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), relationships = [{symbol: "Animal#sound()", is_implementation:true, is_reference: true}]
	//	}
	//
	// const animal: Animal = new Dog()
	//
	//	^^^^^^ reference Animal#
	//
	// console.log(animal.sound())
	//
	//	^^^^^ reference Animal#sound()
	//
	// “`
	// Doing "Find references" on the symbol `Animal#sound()` should return
	// references to the `Dog#sound()` method as well. Vice-versa, doing "Find
	// references" on the `Dog#sound()` method should include references to the
	// `Animal#sound()` method as well.
	IsReference bool `protobuf:"varint,2,opt,name=is_reference,json=isReference,proto3" json:"is_reference,omitempty"`
	// Similar to `is_reference` but for "Find implementations".
	// It's common for `is_implementation` and `is_reference` to both be true but
	// it's not always the case.
	// In the TypeScript example above, observe that `Dog#` has an
	// `is_implementation` relationship with `"Animal#"` but not `is_reference`.
	// This is because "Find references" on the "Animal#" symbol should not return
	// "Dog#". We only want "Dog#" to return as a result for "Find
	// implementations" on the "Animal#" symbol.
	IsImplementation bool `protobuf:"varint,3,opt,name=is_implementation,json=isImplementation,proto3" json:"is_implementation,omitempty"`
	// Similar to `references_symbols` but for "Go to type definition".
	IsTypeDefinition bool `protobuf:"varint,4,opt,name=is_type_definition,json=isTypeDefinition,proto3" json:"is_type_definition,omitempty"`
	// Allows overriding the behavior of "Go to definition" and "Find references"
	// for symbols which do not have a definition of their own or could
	// potentially have multiple definitions.
	//
	// For example, in a language with single inheritance and no field overriding,
	// inherited fields can reuse the same symbol as the ancestor which declares
	// the field. In such a situation, is_definition is not needed.
	//
	// On the other hand, in languages with single inheritance and some form
	// of mixins, you can use is_definition to relate the symbol to the
	// matching symbol in ancestor classes, and is_reference to relate the
	// symbol to the matching symbol in mixins.
	//
	// NOTE: At the moment, due to limitations of the SCIP to LSIF conversion,
	// only global symbols in an index are allowed to use is_definition.
	// The relationship may not get recorded if either symbol is local.
	IsDefinition bool `protobuf:"varint,5,opt,name=is_definition,json=isDefinition,proto3" json:"is_definition,omitempty"` // Update registerInverseRelationships on adding a new field here.
	// contains filtered or unexported fields
}

func CanonicalizeRelationships added in v0.3.0

func CanonicalizeRelationships(relationships []*Relationship) []*Relationship

CanonicalizeRelationships deterministically re-orders the fields of the given relationship slice.

func FlattenRelationship added in v0.3.0

func FlattenRelationship(relationships []*Relationship) []*Relationship

FlattenRelationship merges elements of the given slice with equivalent symbol names. This function returns a new slice.

func SortRelationships added in v0.3.0

func SortRelationships(relationships []*Relationship) []*Relationship

SortRelationships sorts the given symbol relationships slice (in-place) and returns it (for convenience).

func (*Relationship) Descriptor deprecated

func (*Relationship) Descriptor() ([]byte, []int)

Deprecated: Use Relationship.ProtoReflect.Descriptor instead.

func (*Relationship) GetIsDefinition added in v0.2.1

func (x *Relationship) GetIsDefinition() bool

func (*Relationship) GetIsImplementation

func (x *Relationship) GetIsImplementation() bool

func (*Relationship) GetIsReference

func (x *Relationship) GetIsReference() bool

func (*Relationship) GetIsTypeDefinition

func (x *Relationship) GetIsTypeDefinition() bool

func (*Relationship) GetSymbol

func (x *Relationship) GetSymbol() string

func (*Relationship) ProtoMessage

func (*Relationship) ProtoMessage()

func (*Relationship) ProtoReflect

func (x *Relationship) ProtoReflect() protoreflect.Message

func (*Relationship) Reset

func (x *Relationship) Reset()

func (*Relationship) String

func (x *Relationship) String() string

type Severity

type Severity int32
const (
	Severity_UnspecifiedSeverity Severity = 0
	Severity_Error               Severity = 1
	Severity_Warning             Severity = 2
	Severity_Information         Severity = 3
	Severity_Hint                Severity = 4
)

func (Severity) Descriptor

func (Severity) Descriptor() protoreflect.EnumDescriptor

func (Severity) Enum

func (x Severity) Enum() *Severity

func (Severity) EnumDescriptor deprecated

func (Severity) EnumDescriptor() ([]byte, []int)

Deprecated: Use Severity.Descriptor instead.

func (Severity) Number

func (x Severity) Number() protoreflect.EnumNumber

func (Severity) String

func (x Severity) String() string

func (Severity) Type

type SourceFile

type SourceFile struct {
	AbsolutePath string
	RelativePath string
	Text         string
	Lines        []string
}

SourceFile includes helper methods to deal with source files.

func NewSourceFile

func NewSourceFile(absolutePath, relativePath, code string) *SourceFile

func NewSourceFileFromPath

func NewSourceFileFromPath(absolutePath, relativePath string) (*SourceFile, error)

NewSourceFileFromPath reads the provided absolute path from disk and returns a SourceFile.

func NewSourcesFromDirectory

func NewSourcesFromDirectory(directory string) ([]*SourceFile, error)

NewSourcesFromDirectory recursively walks the provided directory and creates a SourceFile for every regular file.

func (*SourceFile) RangeText

func (d *SourceFile) RangeText(position Range) string

RangeText returns the substring of the source file contents that enclose the provided range.

func (*SourceFile) String

func (d *SourceFile) String() string

type Symbol

type Symbol struct {
	Scheme      string        `protobuf:"bytes,1,opt,name=scheme,proto3" json:"scheme,omitempty"`
	Package     *Package      `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"`
	Descriptors []*Descriptor `protobuf:"bytes,3,rep,name=descriptors,proto3" json:"descriptors,omitempty"`
	// contains filtered or unexported fields
}

Symbol is similar to a URI, it identifies a class, method, or a local variable. `SymbolInformation` contains rich metadata about symbols such as the docstring.

Symbol has a standardized string representation, which can be used interchangeably with `Symbol`. The syntax for Symbol is the following: ``` # (<x>)+ stands for one or more repetitions of <x> <symbol> ::= <scheme> ' ' <package> ' ' (<descriptor>)+ | 'local ' <local-id> <package> ::= <manager> ' ' <package-name> ' ' <version> <scheme> ::= any UTF-8, escape spaces with double space. <manager> ::= same as above, use the placeholder '.' to indicate an empty value <package-name> ::= same as above <version> ::= same as above <descriptor> ::= <namespace> | <type> | <term> | <method> | <type-parameter> | <parameter> | <meta> | <macro> <namespace> ::= <name> '/' <type> ::= <name> '#' <term> ::= <name> '.' <meta> ::= <name> ':' <macro> ::= <name> '!' <method> ::= <name> '(' <method-disambiguator> ').' <type-parameter> ::= '[' <name> ']' <parameter> ::= '(' <name> ')' <name> ::= <identifier> <method-disambiguator> ::= <simple-identifier> <identifier> ::= <simple-identifier> | <escaped-identifier> <simple-identifier> ::= (<identifier-character>)+ <identifier-character> ::= '_' | '+' | '-' | '$' | ASCII letter or digit <escaped-identifier> ::= '`' (<escaped-character>)+ '`' <escaped-characters> ::= any UTF-8 character, escape backticks with double backtick. <local-id> ::= <simple-identifier> ```

The list of descriptors for a symbol should together form a fully qualified name for the symbol. That is, it should serve as a unique identifier across the package. Typically, it will include one descriptor for every node in the AST (along the ancestry path) between the root of the file and the node corresponding to the symbol.

Local symbols MUST only be used for entities which are local to a Document, and cannot be accessed from outside the Document.

func ParsePartialSymbol

func ParsePartialSymbol(symbol string, includeDescriptors bool) (*Symbol, error)

ParsePartialSymbol parses an SCIP string into the Symbol message with the option to exclude the `.Descriptor` field.

func ParseSymbol

func ParseSymbol(symbol string) (*Symbol, error)

ParseSymbol parses an SCIP string into the Symbol message.

func (*Symbol) Descriptor deprecated

func (*Symbol) Descriptor() ([]byte, []int)

Deprecated: Use Symbol.ProtoReflect.Descriptor instead.

func (*Symbol) GetDescriptors

func (x *Symbol) GetDescriptors() []*Descriptor

func (*Symbol) GetPackage

func (x *Symbol) GetPackage() *Package

func (*Symbol) GetScheme

func (x *Symbol) GetScheme() string

func (*Symbol) ProtoMessage

func (*Symbol) ProtoMessage()

func (*Symbol) ProtoReflect

func (x *Symbol) ProtoReflect() protoreflect.Message

func (*Symbol) Reset

func (x *Symbol) Reset()

func (*Symbol) String

func (x *Symbol) String() string

type SymbolFormatter

type SymbolFormatter struct {
	OnError               func(err error) error
	IncludeScheme         func(scheme string) bool
	IncludePackageManager func(manager string) bool
	IncludePackageName    func(name string) bool
	IncludePackageVersion func(version string) bool
	IncludeDescriptor     func(descriptor string) bool
	IncludeRawDescriptor  func(descriptor *Descriptor) bool
	IncludeDisambiguator  func(disambiguator string) bool
}

SymbolFormatter configures how to format an SCIP symbol. Excluding parts of the symbol can be helpful for testing purposes. For example, snapshot tests may hardcode the package version number so it's easier to read the snapshot tests if the version is excluded.

func (*SymbolFormatter) Format

func (f *SymbolFormatter) Format(symbol string) (string, error)

func (*SymbolFormatter) FormatDescriptors added in v0.3.1

func (f *SymbolFormatter) FormatDescriptors(descriptors []*Descriptor) string

func (*SymbolFormatter) FormatSymbol

func (f *SymbolFormatter) FormatSymbol(symbol *Symbol) string

type SymbolInformation

type SymbolInformation struct {

	// Identifier of this symbol, which can be referenced from `Occurence.symbol`.
	// The string must be formatted according to the grammar in `Symbol`.
	Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
	// (optional, but strongly recommended) The markdown-formatted documentation
	// for this symbol. Use `SymbolInformation.signature_documentation` to
	// document the method/class/type signature of this symbol.
	// Due to historical reasons, indexers may include signature documentation in
	// this field by rendering markdown code blocks. New indexers should only
	// include non-code documentation in this field, for example docstrings.
	Documentation []string `protobuf:"bytes,3,rep,name=documentation,proto3" json:"documentation,omitempty"`
	// (optional) Relationships to other symbols (e.g., implements, type definition).
	Relationships []*Relationship `protobuf:"bytes,4,rep,name=relationships,proto3" json:"relationships,omitempty"`
	// The kind of this symbol. Use this field instead of
	// `SymbolDescriptor.Suffix` to determine whether something is, for example, a
	// class or a method.
	Kind SymbolInformation_Kind `protobuf:"varint,5,opt,name=kind,proto3,enum=scip.SymbolInformation_Kind" json:"kind,omitempty"`
	// (optional) The name of this symbol as it should be displayed to the user.
	// For example, the symbol "com/example/MyClass#myMethod(+1)." should have the
	// display name "myMethod". The `symbol` field is not a reliable source of
	// the display name for several reasons:
	//
	//   - Local symbols don't encode the name.
	//   - Some languages have case-insensitive names, so the symbol is all-lowercase.
	//   - The symbol may encode names with special characters that should not be
	//     displayed to the user.
	DisplayName string `protobuf:"bytes,6,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	// (optional) The signature of this symbol as it's displayed in API
	// documentation or in hover tooltips. For example, a Java method that adds
	// two numbers this would have `Document.language = "java"` and `Document.text
	// = "void add(int a, int b)". The `language` and `text` fields are required
	// while other fields such as `Documentation.occurrences` can be optionally
	// included to support hyperlinking referenced symbols in the signature.
	SignatureDocumentation *Document `` /* 127-byte string literal not displayed */
	// (optional) The enclosing symbol if this is a local symbol.  For non-local
	// symbols, the enclosing symbol should be parsed from the `symbol` field
	// using the `Descriptor` grammar.
	//
	// The primary use-case for this field is to allow local symbol to be displayed
	// in a symbol hierarchy for API documentation. It's OK to leave this field
	// empty for local variables since local variables usually don't belong in API
	// documentation. However, in the situation that you wish to include a local
	// symbol in the hierarchy, then you can use `enclosing_symbol` to locate the
	// "parent" or "owner" of this local symbol. For example, a Java indexer may
	// choose to use local symbols for private class fields while providing an
	// `enclosing_symbol` to reference the enclosing class to allow the field to
	// be part of the class documentation hierarchy. From the perspective of an
	// author of an indexer, the decision to use a local symbol or global symbol
	// should exclusively be determined whether the local symbol is accessible
	// outside the document, not by the capability to find the enclosing
	// symbol.
	EnclosingSymbol string `protobuf:"bytes,8,opt,name=enclosing_symbol,json=enclosingSymbol,proto3" json:"enclosing_symbol,omitempty"`
	// contains filtered or unexported fields
}

SymbolInformation defines metadata about a symbol, such as the symbol's docstring or what package it's defined it.

func CanonicalizeSymbol added in v0.3.0

func CanonicalizeSymbol(symbol *SymbolInformation) *SymbolInformation

CanonicalizeSymbol deterministically re-orders the fields of the given symbol.

func CanonicalizeSymbols added in v0.3.0

func CanonicalizeSymbols(symbols []*SymbolInformation) []*SymbolInformation

CanonicalizeSymbols deterministically re-orders the fields of the given symbols slice.

func FindSymbol added in v0.3.0

func FindSymbol(document *Document, symbolName string) *SymbolInformation

FindSymbol returns the symbol with the given name in the given document. If there is no symbol by that name, this function returns nil.

func FlattenSymbols added in v0.3.0

func FlattenSymbols(symbols []*SymbolInformation) []*SymbolInformation

FlattenSymbol merges elements of the given slice with the same symbol name. This allows us to make the assumption post-canonicalization that each index and document refer to one symbol metadata object uniquely. This function returns a new slice.

func SanitizeSymbol added in v0.3.0

func SanitizeSymbol(symbol *SymbolInformation) *SymbolInformation

SanitizeSymbol ensures that all strings in the given symbol are valid UTF-8. This is a requirement for successful protobuf encoding.

func SanitizeSymbols added in v0.3.0

func SanitizeSymbols(symbols []*SymbolInformation) []*SymbolInformation

SanitizeSymbols ensures that all strings in the given symbols slice are valid UTF-8. The input slice is modified in-place but returned for convenience. This is a requirement for successful protobuf encoding.

func SortSymbols added in v0.3.0

func SortSymbols(symbols []*SymbolInformation) []*SymbolInformation

SortSymbols sorts the given symbols slice (in-place) and returns it (for convenience). Symbol information objects are sorted in ascending order by name.

func (*SymbolInformation) Descriptor deprecated

func (*SymbolInformation) Descriptor() ([]byte, []int)

Deprecated: Use SymbolInformation.ProtoReflect.Descriptor instead.

func (*SymbolInformation) GetDisplayName added in v0.3.0

func (x *SymbolInformation) GetDisplayName() string

func (*SymbolInformation) GetDocumentation

func (x *SymbolInformation) GetDocumentation() []string

func (*SymbolInformation) GetEnclosingSymbol added in v0.3.0

func (x *SymbolInformation) GetEnclosingSymbol() string

func (*SymbolInformation) GetKind added in v0.3.0

func (*SymbolInformation) GetRelationships

func (x *SymbolInformation) GetRelationships() []*Relationship

func (*SymbolInformation) GetSignatureDocumentation added in v0.3.0

func (x *SymbolInformation) GetSignatureDocumentation() *Document

func (*SymbolInformation) GetSymbol

func (x *SymbolInformation) GetSymbol() string

func (*SymbolInformation) ProtoMessage

func (*SymbolInformation) ProtoMessage()

func (*SymbolInformation) ProtoReflect

func (x *SymbolInformation) ProtoReflect() protoreflect.Message

func (*SymbolInformation) Reset

func (x *SymbolInformation) Reset()

func (*SymbolInformation) String

func (x *SymbolInformation) String() string

type SymbolInformation_Kind added in v0.3.0

type SymbolInformation_Kind int32

(optional) Kind represents the fine-grained category of a symbol, suitable for presenting information about the symbol's meaning in the language.

For example:

  • A Java method would have the kind `Method` while a Go function would have the kind `Function`, even if the symbols for these use the same syntax for the descriptor `SymbolDescriptor.Suffix.Method`.
  • A Go struct has the symbol kind `Struct` while a Java class has the symbol kind `Class` even if they both have the same descriptor: `SymbolDescriptor.Suffix.Type`.

Since Kind is more fine-grained than Suffix: - If two symbols have the same Kind, they should share the same Suffix. - If two symbols have different Suffixes, they should have different Kinds.

const (
	SymbolInformation_UnspecifiedKind SymbolInformation_Kind = 0
	// A method which may or may not have a body. For Java, Kotlin etc.
	SymbolInformation_AbstractMethod SymbolInformation_Kind = 66
	// For Ruby's attr_accessor
	SymbolInformation_Accessor SymbolInformation_Kind = 72
	SymbolInformation_Array    SymbolInformation_Kind = 1
	// For Alloy
	SymbolInformation_Assertion      SymbolInformation_Kind = 2
	SymbolInformation_AssociatedType SymbolInformation_Kind = 3
	// For C++
	SymbolInformation_Attribute SymbolInformation_Kind = 4
	// For Lean
	SymbolInformation_Axiom       SymbolInformation_Kind = 5
	SymbolInformation_Boolean     SymbolInformation_Kind = 6
	SymbolInformation_Class       SymbolInformation_Kind = 7
	SymbolInformation_Constant    SymbolInformation_Kind = 8
	SymbolInformation_Constructor SymbolInformation_Kind = 9
	// For Solidity
	SymbolInformation_Contract SymbolInformation_Kind = 62
	// For Haskell
	SymbolInformation_DataFamily SymbolInformation_Kind = 10
	// For C# and F#
	SymbolInformation_Delegate   SymbolInformation_Kind = 73
	SymbolInformation_Enum       SymbolInformation_Kind = 11
	SymbolInformation_EnumMember SymbolInformation_Kind = 12
	SymbolInformation_Error      SymbolInformation_Kind = 63
	SymbolInformation_Event      SymbolInformation_Kind = 13
	// For Alloy
	SymbolInformation_Fact     SymbolInformation_Kind = 14
	SymbolInformation_Field    SymbolInformation_Kind = 15
	SymbolInformation_File     SymbolInformation_Kind = 16
	SymbolInformation_Function SymbolInformation_Kind = 17
	// For 'get' in Swift, 'attr_reader' in Ruby
	SymbolInformation_Getter SymbolInformation_Kind = 18
	// For Raku
	SymbolInformation_Grammar SymbolInformation_Kind = 19
	// For Purescript and Lean
	SymbolInformation_Instance  SymbolInformation_Kind = 20
	SymbolInformation_Interface SymbolInformation_Kind = 21
	SymbolInformation_Key       SymbolInformation_Kind = 22
	// For Racket
	SymbolInformation_Lang SymbolInformation_Kind = 23
	// For Lean
	SymbolInformation_Lemma SymbolInformation_Kind = 24
	// For solidity
	SymbolInformation_Library SymbolInformation_Kind = 64
	SymbolInformation_Macro   SymbolInformation_Kind = 25
	SymbolInformation_Method  SymbolInformation_Kind = 26
	// For Ruby
	SymbolInformation_MethodAlias SymbolInformation_Kind = 74
	// Analogous to 'ThisParameter' and 'SelfParameter', but for languages
	// like Go where the receiver doesn't have a conventional name.
	SymbolInformation_MethodReceiver SymbolInformation_Kind = 27
	// Analogous to 'AbstractMethod', for Go.
	SymbolInformation_MethodSpecification SymbolInformation_Kind = 67
	// For Protobuf
	SymbolInformation_Message SymbolInformation_Kind = 28
	// For Solidity
	SymbolInformation_Modifier       SymbolInformation_Kind = 65
	SymbolInformation_Module         SymbolInformation_Kind = 29
	SymbolInformation_Namespace      SymbolInformation_Kind = 30
	SymbolInformation_Null           SymbolInformation_Kind = 31
	SymbolInformation_Number         SymbolInformation_Kind = 32
	SymbolInformation_Object         SymbolInformation_Kind = 33
	SymbolInformation_Operator       SymbolInformation_Kind = 34
	SymbolInformation_Package        SymbolInformation_Kind = 35
	SymbolInformation_PackageObject  SymbolInformation_Kind = 36
	SymbolInformation_Parameter      SymbolInformation_Kind = 37
	SymbolInformation_ParameterLabel SymbolInformation_Kind = 38
	// For Haskell's PatternSynonyms
	SymbolInformation_Pattern SymbolInformation_Kind = 39
	// For Alloy
	SymbolInformation_Predicate SymbolInformation_Kind = 40
	SymbolInformation_Property  SymbolInformation_Kind = 41
	// Analogous to 'Trait' and 'TypeClass', for Swift and Objective-C
	SymbolInformation_Protocol SymbolInformation_Kind = 42
	// Analogous to 'AbstractMethod', for Swift and Objective-C.
	SymbolInformation_ProtocolMethod SymbolInformation_Kind = 68
	// Analogous to 'AbstractMethod', for C++.
	SymbolInformation_PureVirtualMethod SymbolInformation_Kind = 69
	// For Haskell
	SymbolInformation_Quasiquoter SymbolInformation_Kind = 43
	// 'self' in Python, Rust, Swift etc.
	SymbolInformation_SelfParameter SymbolInformation_Kind = 44
	// For 'set' in Swift, 'attr_writer' in Ruby
	SymbolInformation_Setter SymbolInformation_Kind = 45
	// For Alloy, analogous to 'Struct'.
	SymbolInformation_Signature SymbolInformation_Kind = 46
	// For Ruby
	SymbolInformation_SingletonClass SymbolInformation_Kind = 75
	// Analogous to 'StaticMethod', for Ruby.
	SymbolInformation_SingletonMethod SymbolInformation_Kind = 76
	// Analogous to 'StaticField', for C++
	SymbolInformation_StaticDataMember SymbolInformation_Kind = 77
	// For C#
	SymbolInformation_StaticEvent SymbolInformation_Kind = 78
	// For C#
	SymbolInformation_StaticField SymbolInformation_Kind = 79
	// For Java, C#, C++ etc.
	SymbolInformation_StaticMethod SymbolInformation_Kind = 80
	// For C#, TypeScript etc.
	SymbolInformation_StaticProperty SymbolInformation_Kind = 81
	// For C, C++
	SymbolInformation_StaticVariable SymbolInformation_Kind = 82
	SymbolInformation_String         SymbolInformation_Kind = 48
	SymbolInformation_Struct         SymbolInformation_Kind = 49
	// For Swift
	SymbolInformation_Subscript SymbolInformation_Kind = 47
	// For Lean
	SymbolInformation_Tactic SymbolInformation_Kind = 50
	// For Lean
	SymbolInformation_Theorem SymbolInformation_Kind = 51
	// Method receiver for languages
	// 'this' in JavaScript, C++, Java etc.
	SymbolInformation_ThisParameter SymbolInformation_Kind = 52
	// Analogous to 'Protocol' and 'TypeClass', for Rust, Scala etc.
	SymbolInformation_Trait SymbolInformation_Kind = 53
	// Analogous to 'AbstractMethod', for Rust, Scala etc.
	SymbolInformation_TraitMethod SymbolInformation_Kind = 70
	// Data type definition for languages like OCaml which use `type`
	// rather than separate keywords like `struct` and `enum`.
	SymbolInformation_Type      SymbolInformation_Kind = 54
	SymbolInformation_TypeAlias SymbolInformation_Kind = 55
	// Analogous to 'Trait' and 'Protocol', for Haskell, Purescript etc.
	SymbolInformation_TypeClass SymbolInformation_Kind = 56
	// Analogous to 'AbstractMethod', for Haskell, Purescript etc.
	SymbolInformation_TypeClassMethod SymbolInformation_Kind = 71
	// For Haskell
	SymbolInformation_TypeFamily    SymbolInformation_Kind = 57
	SymbolInformation_TypeParameter SymbolInformation_Kind = 58
	// For C, C++, Capn Proto
	SymbolInformation_Union    SymbolInformation_Kind = 59
	SymbolInformation_Value    SymbolInformation_Kind = 60
	SymbolInformation_Variable SymbolInformation_Kind = 61
)

func (SymbolInformation_Kind) Descriptor added in v0.3.0

func (SymbolInformation_Kind) Enum added in v0.3.0

func (SymbolInformation_Kind) EnumDescriptor deprecated added in v0.3.0

func (SymbolInformation_Kind) EnumDescriptor() ([]byte, []int)

Deprecated: Use SymbolInformation_Kind.Descriptor instead.

func (SymbolInformation_Kind) Number added in v0.3.0

func (SymbolInformation_Kind) String added in v0.3.0

func (x SymbolInformation_Kind) String() string

func (SymbolInformation_Kind) Type added in v0.3.0

type SymbolRole

type SymbolRole int32

SymbolRole declares what "role" a symbol has in an occurrence. A role is encoded as a bitset where each bit represents a different role. For example, to determine if the `Import` role is set, test whether the second bit of the enum value is defined. In pseudocode, this can be implemented with the logic: `const isImportRole = (role.value & SymbolRole.Import.value) > 0`.

const (
	// This case is not meant to be used; it only exists to avoid an error
	// from the Protobuf code generator.
	SymbolRole_UnspecifiedSymbolRole SymbolRole = 0
	// Is the symbol defined here? If not, then this is a symbol reference.
	SymbolRole_Definition SymbolRole = 1
	// Is the symbol imported here?
	SymbolRole_Import SymbolRole = 2
	// Is the symbol written here?
	SymbolRole_WriteAccess SymbolRole = 4
	// Is the symbol read here?
	SymbolRole_ReadAccess SymbolRole = 8
	// Is the symbol in generated code?
	SymbolRole_Generated SymbolRole = 16
	// Is the symbol in test code?
	SymbolRole_Test SymbolRole = 32
	// Is this a signature for a symbol that is defined elsewhere?
	//
	// Applies to forward declarations for languages like C, C++
	// and Objective-C, as well as `val` declarations in interface
	// files in languages like SML and OCaml.
	SymbolRole_ForwardDefinition SymbolRole = 64
)

func (SymbolRole) Descriptor

func (SymbolRole) Descriptor() protoreflect.EnumDescriptor

func (SymbolRole) Enum

func (x SymbolRole) Enum() *SymbolRole

func (SymbolRole) EnumDescriptor deprecated

func (SymbolRole) EnumDescriptor() ([]byte, []int)

Deprecated: Use SymbolRole.Descriptor instead.

func (SymbolRole) Matches

func (r SymbolRole) Matches(occ *Occurrence) bool

func (SymbolRole) Number

func (x SymbolRole) Number() protoreflect.EnumNumber

func (SymbolRole) String

func (x SymbolRole) String() string

func (SymbolRole) Type

type SyntaxKind

type SyntaxKind int32
const (
	SyntaxKind_UnspecifiedSyntaxKind SyntaxKind = 0
	// Comment, including comment markers and text
	SyntaxKind_Comment SyntaxKind = 1
	// `;` `.` `,`
	SyntaxKind_PunctuationDelimiter SyntaxKind = 2
	// (), {}, [] when used syntactically
	SyntaxKind_PunctuationBracket SyntaxKind = 3
	// `if`, `else`, `return`, `class`, etc.
	SyntaxKind_Keyword SyntaxKind = 4
	// Deprecated: Marked as deprecated in scip.proto.
	SyntaxKind_IdentifierKeyword SyntaxKind = 4
	// `+`, `*`, etc.
	SyntaxKind_IdentifierOperator SyntaxKind = 5
	// non-specific catch-all for any identifier not better described elsewhere
	SyntaxKind_Identifier SyntaxKind = 6
	// Identifiers builtin to the language: `min`, `print` in Python.
	SyntaxKind_IdentifierBuiltin SyntaxKind = 7
	// Identifiers representing `null`-like values: `None` in Python, `nil` in Go.
	SyntaxKind_IdentifierNull SyntaxKind = 8
	// `xyz` in `const xyz = "hello"`
	SyntaxKind_IdentifierConstant SyntaxKind = 9
	// `var X = "hello"` in Go
	SyntaxKind_IdentifierMutableGlobal SyntaxKind = 10
	// Parameter definition and references
	SyntaxKind_IdentifierParameter SyntaxKind = 11
	// Identifiers for variable definitions and references within a local scope
	SyntaxKind_IdentifierLocal SyntaxKind = 12
	// Identifiers that shadow other identifiers in an outer scope
	SyntaxKind_IdentifierShadowed SyntaxKind = 13
	// Identifier representing a unit of code abstraction and/or namespacing.
	//
	// NOTE: This corresponds to a package in Go and JVM languages,
	// and a module in languages like Python and JavaScript.
	SyntaxKind_IdentifierNamespace SyntaxKind = 14
	// Deprecated: Marked as deprecated in scip.proto.
	SyntaxKind_IdentifierModule SyntaxKind = 14
	// Function references, including calls
	SyntaxKind_IdentifierFunction SyntaxKind = 15
	// Function definition only
	SyntaxKind_IdentifierFunctionDefinition SyntaxKind = 16
	// Macro references, including invocations
	SyntaxKind_IdentifierMacro SyntaxKind = 17
	// Macro definition only
	SyntaxKind_IdentifierMacroDefinition SyntaxKind = 18
	// non-builtin types
	SyntaxKind_IdentifierType SyntaxKind = 19
	// builtin types only, such as `str` for Python or `int` in Go
	SyntaxKind_IdentifierBuiltinType SyntaxKind = 20
	// Python decorators, c-like __attribute__
	SyntaxKind_IdentifierAttribute SyntaxKind = 21
	// `\b`
	SyntaxKind_RegexEscape SyntaxKind = 22
	// `*`, `+`
	SyntaxKind_RegexRepeated SyntaxKind = 23
	// `.`
	SyntaxKind_RegexWildcard SyntaxKind = 24
	// `(`, `)`, `[`, `]`
	SyntaxKind_RegexDelimiter SyntaxKind = 25
	// `|`, `-`
	SyntaxKind_RegexJoin SyntaxKind = 26
	// Literal strings: "Hello, world!"
	SyntaxKind_StringLiteral SyntaxKind = 27
	// non-regex escapes: "\t", "\n"
	SyntaxKind_StringLiteralEscape SyntaxKind = 28
	// datetimes within strings, special words within a string, `{}` in format strings
	SyntaxKind_StringLiteralSpecial SyntaxKind = 29
	// "key" in { "key": "value" }, useful for example in JSON
	SyntaxKind_StringLiteralKey SyntaxKind = 30
	// 'c' or similar, in languages that differentiate strings and characters
	SyntaxKind_CharacterLiteral SyntaxKind = 31
	// Literal numbers, both floats and integers
	SyntaxKind_NumericLiteral SyntaxKind = 32
	// `true`, `false`
	SyntaxKind_BooleanLiteral SyntaxKind = 33
	// Used for XML-like tags
	SyntaxKind_Tag SyntaxKind = 34
	// Attribute name in XML-like tags
	SyntaxKind_TagAttribute SyntaxKind = 35
	// Delimiters for XML-like tags
	SyntaxKind_TagDelimiter SyntaxKind = 36
)

func (SyntaxKind) Descriptor

func (SyntaxKind) Descriptor() protoreflect.EnumDescriptor

func (SyntaxKind) Enum

func (x SyntaxKind) Enum() *SyntaxKind

func (SyntaxKind) EnumDescriptor deprecated

func (SyntaxKind) EnumDescriptor() ([]byte, []int)

Deprecated: Use SyntaxKind.Descriptor instead.

func (SyntaxKind) Number

func (x SyntaxKind) Number() protoreflect.EnumNumber

func (SyntaxKind) String

func (x SyntaxKind) String() string

func (SyntaxKind) Type

type TextEncoding

type TextEncoding int32
const (
	TextEncoding_UnspecifiedTextEncoding TextEncoding = 0
	TextEncoding_UTF8                    TextEncoding = 1
	TextEncoding_UTF16                   TextEncoding = 2
)

func (TextEncoding) Descriptor

func (TextEncoding) Enum

func (x TextEncoding) Enum() *TextEncoding

func (TextEncoding) EnumDescriptor deprecated

func (TextEncoding) EnumDescriptor() ([]byte, []int)

Deprecated: Use TextEncoding.Descriptor instead.

func (TextEncoding) Number

func (TextEncoding) String

func (x TextEncoding) String() string

func (TextEncoding) Type

type ToolInfo

type ToolInfo struct {

	// Name of the indexer that produced this index.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Version of the indexer that produced this index.
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// Command-line arguments that were used to invoke this indexer.
	Arguments []string `protobuf:"bytes,3,rep,name=arguments,proto3" json:"arguments,omitempty"`
	// contains filtered or unexported fields
}

func (*ToolInfo) Descriptor deprecated

func (*ToolInfo) Descriptor() ([]byte, []int)

Deprecated: Use ToolInfo.ProtoReflect.Descriptor instead.

func (*ToolInfo) GetArguments

func (x *ToolInfo) GetArguments() []string

func (*ToolInfo) GetName

func (x *ToolInfo) GetName() string

func (*ToolInfo) GetVersion

func (x *ToolInfo) GetVersion() string

func (*ToolInfo) ProtoMessage

func (*ToolInfo) ProtoMessage()

func (*ToolInfo) ProtoReflect

func (x *ToolInfo) ProtoReflect() protoreflect.Message

func (*ToolInfo) Reset

func (x *ToolInfo) Reset()

func (*ToolInfo) String

func (x *ToolInfo) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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