mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:31:54 +00:00
Remove unused LSIF Typed code (#35791)
* Add diff for a TypeScript file to trigger CI job * Rename job * Delete unnecessary TypeScript file after validating CI job * Remove unused "LSIF Typed" code This code got moved to a separate repo github.com/sourcegraph/scip.
This commit is contained in:
parent
f20d216af0
commit
9dcdfb95d9
@ -1,6 +1,5 @@
|
||||
.bin/
|
||||
*.bundle.*
|
||||
lib/codeintel/lsiftyped
|
||||
client/phabricator/scripts/loader.js
|
||||
client/browser/build
|
||||
**/package.json
|
||||
|
||||
@ -18,16 +18,18 @@ import (
|
||||
otlog "github.com/opentracing/opentracing-go/log"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/sourcegraph/sourcegraph/internal/honey"
|
||||
"golang.org/x/net/html"
|
||||
"golang.org/x/net/html/atom"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/honey"
|
||||
|
||||
"github.com/sourcegraph/scip/bindings/go/scip"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/env"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gosyntect"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
"github.com/sourcegraph/sourcegraph/internal/trace/ot"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -126,7 +128,7 @@ type HighlightedCode struct {
|
||||
// Formatted HTML. This is generally from syntect, as LSIF documents
|
||||
// will be formatted on the fly using HighlightedCode.document
|
||||
//
|
||||
// Can be an empty string if we have an lsiftyped.Document instead.
|
||||
// Can be an empty string if we have an scip.Document instead.
|
||||
// Access via HighlightedCode.HTML()
|
||||
html template.HTML
|
||||
|
||||
@ -134,8 +136,8 @@ type HighlightedCode struct {
|
||||
// to generate formatted HTML.
|
||||
//
|
||||
// This is optional because not every language has a treesitter parser
|
||||
// and queries that can send back an lsiftyped.Document
|
||||
document *lsiftyped.Document
|
||||
// and queries that can send back an scip.Document
|
||||
document *scip.Document
|
||||
}
|
||||
|
||||
func (h *HighlightedCode) HTML() (template.HTML, error) {
|
||||
@ -152,7 +154,7 @@ func NewHighlightedCodeWithHTML(html template.HTML) HighlightedCode {
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HighlightedCode) LSIF() *lsiftyped.Document {
|
||||
func (h *HighlightedCode) LSIF() *scip.Document {
|
||||
return h.document
|
||||
}
|
||||
|
||||
@ -206,7 +208,7 @@ func (h *HighlightedCode) SplitHighlightedLines(includeLineNumbers bool) ([]temp
|
||||
// LinesForRanges returns a list of list of strings (which are valid HTML). Each list of strings is a set
|
||||
// of HTML lines correspond to the range passed in ranges.
|
||||
//
|
||||
// This is the corresponding function for SplitLineRanges, but uses lsiftyped.
|
||||
// This is the corresponding function for SplitLineRanges, but uses SCIP.
|
||||
//
|
||||
// TODO(tjdevries): The call heirarchy could be reversed later to only have one entry point
|
||||
func (h *HighlightedCode) LinesForRanges(ranges []LineRange) ([][]string, error) {
|
||||
@ -252,7 +254,7 @@ func (h *HighlightedCode) LinesForRanges(ranges []LineRange) ([][]string, error)
|
||||
currentCell = cell
|
||||
}
|
||||
|
||||
addText := func(kind lsiftyped.SyntaxKind, line string) {
|
||||
addText := func(kind scip.SyntaxKind, line string) {
|
||||
appendTextToNode(currentCell, kind, line)
|
||||
}
|
||||
|
||||
@ -474,7 +476,7 @@ func Code(ctx context.Context, p Params) (response *HighlightedCode, aborted boo
|
||||
}
|
||||
|
||||
if filetypeQuery.Engine == EngineTreeSitter {
|
||||
document := new(lsiftyped.Document)
|
||||
document := new(scip.Document)
|
||||
data, err := base64.StdEncoding.DecodeString(resp.Data)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@ -10,8 +10,9 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/sourcegraph/scip/bindings/go/scip"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/gosyntect"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -26,15 +27,15 @@ func TestIdentifyError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeserialize(t *testing.T) {
|
||||
original := new(lsiftyped.Document)
|
||||
original.Occurrences = append(original.Occurrences, &lsiftyped.Occurrence{
|
||||
SyntaxKind: lsiftyped.SyntaxKind_IdentifierAttribute,
|
||||
original := new(scip.Document)
|
||||
original.Occurrences = append(original.Occurrences, &scip.Occurrence{
|
||||
SyntaxKind: scip.SyntaxKind_IdentifierAttribute,
|
||||
})
|
||||
|
||||
marshaled, _ := proto.Marshal(original)
|
||||
data, _ := base64.StdEncoding.DecodeString(base64.StdEncoding.EncodeToString(marshaled))
|
||||
|
||||
roundtrip := new(lsiftyped.Document)
|
||||
roundtrip := new(scip.Document)
|
||||
err := proto.Unmarshal(data, roundtrip)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@ -9,11 +9,11 @@ import (
|
||||
"golang.org/x/net/html"
|
||||
"golang.org/x/net/html/atom"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/scip/bindings/go/scip"
|
||||
)
|
||||
|
||||
// DocumentToSplitHTML returns a list of each line of HTML.
|
||||
func DocumentToSplitHTML(code string, document *lsiftyped.Document, includeLineNumbers bool) ([]template.HTML, error) {
|
||||
func DocumentToSplitHTML(code string, document *scip.Document, includeLineNumbers bool) ([]template.HTML, error) {
|
||||
rows := []*html.Node{}
|
||||
var currentCell *html.Node
|
||||
|
||||
@ -27,7 +27,7 @@ func DocumentToSplitHTML(code string, document *lsiftyped.Document, includeLineN
|
||||
currentCell = cell
|
||||
}
|
||||
|
||||
addText := func(kind lsiftyped.SyntaxKind, line string) {
|
||||
addText := func(kind scip.SyntaxKind, line string) {
|
||||
appendTextToNode(currentCell, kind, line)
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ func DocumentToSplitHTML(code string, document *lsiftyped.Document, includeLineN
|
||||
}
|
||||
|
||||
// DocumentToHTML creates one HTML blob for the entire document
|
||||
func DocumentToHTML(code string, document *lsiftyped.Document) (template.HTML, error) {
|
||||
func DocumentToHTML(code string, document *scip.Document) (template.HTML, error) {
|
||||
table := &html.Node{Type: html.ElementNode, DataAtom: atom.Table, Data: atom.Table.String()}
|
||||
var currentCell *html.Node
|
||||
|
||||
@ -62,7 +62,7 @@ func DocumentToHTML(code string, document *lsiftyped.Document) (template.HTML, e
|
||||
currentCell = cell
|
||||
}
|
||||
|
||||
addText := func(kind lsiftyped.SyntaxKind, line string) {
|
||||
addText := func(kind scip.SyntaxKind, line string) {
|
||||
appendTextToNode(currentCell, kind, line)
|
||||
}
|
||||
|
||||
@ -100,9 +100,9 @@ func safeSlice(text []rune, start, finish int32) string {
|
||||
// which can be used to generate different kinds of HTML.
|
||||
func lsifToHTML(
|
||||
code string,
|
||||
document *lsiftyped.Document,
|
||||
document *scip.Document,
|
||||
addRow func(row int32),
|
||||
addText func(kind lsiftyped.SyntaxKind, line string),
|
||||
addText func(kind scip.SyntaxKind, line string),
|
||||
validLines map[int32]bool,
|
||||
) {
|
||||
splitStringLines := strings.Split(code, "\n")
|
||||
@ -152,7 +152,7 @@ func lsifToHTML(
|
||||
occ := occurences[occIndex]
|
||||
occIndex += 1
|
||||
|
||||
startRow, startCharacter, endRow, endCharacter := normalizeLsifTypedRange(occ.Range)
|
||||
startRow, startCharacter, endRow, endCharacter := normalizeSCIPRange(occ.Range)
|
||||
|
||||
addText(occ.SyntaxKind, safeSlice(line, lineCharacter, startCharacter))
|
||||
|
||||
@ -179,7 +179,7 @@ func lsifToHTML(
|
||||
lineCharacter = endCharacter
|
||||
}
|
||||
|
||||
addText(lsiftyped.SyntaxKind_UnspecifiedSyntaxKind, safeSlice(line, lineCharacter, int32(len(line))))
|
||||
addText(scip.SyntaxKind_UnspecifiedSyntaxKind, safeSlice(line, lineCharacter, int32(len(line))))
|
||||
|
||||
row += 1
|
||||
}
|
||||
@ -187,14 +187,14 @@ func lsifToHTML(
|
||||
|
||||
// appendTextToNode formats the text to the right css class and appends to the current
|
||||
// html node
|
||||
func appendTextToNode(tr *html.Node, kind lsiftyped.SyntaxKind, text string) {
|
||||
func appendTextToNode(tr *html.Node, kind scip.SyntaxKind, text string) {
|
||||
if text == "" {
|
||||
return
|
||||
}
|
||||
|
||||
var class string
|
||||
if kind != lsiftyped.SyntaxKind_UnspecifiedSyntaxKind {
|
||||
class = "hl-typed-" + lsiftyped.SyntaxKind_name[int32(kind)]
|
||||
if kind != scip.SyntaxKind_UnspecifiedSyntaxKind {
|
||||
class = "hl-typed-" + scip.SyntaxKind_name[int32(kind)]
|
||||
}
|
||||
|
||||
span := &html.Node{Type: html.ElementNode, DataAtom: atom.Span, Data: atom.Span.String()}
|
||||
@ -224,7 +224,7 @@ func newHtmlRow(row int32, includeLineNumbers bool) (htmlRow, htmlCode *html.Nod
|
||||
return tr, codeCell
|
||||
}
|
||||
|
||||
func normalizeLsifTypedRange(r []int32) (int32, int32, int32, int32) {
|
||||
func normalizeSCIPRange(r []int32) (int32, int32, int32, int32) {
|
||||
if len(r) == 3 {
|
||||
return r[0], r[1], r[0], r[2]
|
||||
} else {
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.." # cd to repo root dir
|
||||
|
||||
echo "--- yarn in root"
|
||||
# mutex is necessary since CI runs various yarn installs in parallel
|
||||
yarn --mutex network --frozen-lockfile --network-timeout 60000
|
||||
|
||||
echo "--- cargo install rust-protobuf"
|
||||
which ./.bin/bin/protoc-gen-rust || cargo install --root .bin protobuf-codegen --version 2.27.1
|
||||
|
||||
echo "--- buf"
|
||||
|
||||
GOBIN="$PWD/.bin" go install github.com/bufbuild/buf/cmd/buf
|
||||
GOBIN="$PWD/.bin" go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
|
||||
GOBIN="$PWD/.bin" go install golang.org/x/tools/cmd/goimports
|
||||
GOBIN="$PWD/.bin" go install google.golang.org/protobuf/cmd/protoc-gen-go
|
||||
|
||||
GOBIN="$PWD/.bin" ./.bin/buf generate
|
||||
./.bin/goimports -w ./lib/codeintel/lsiftyped/lsif.pb.go
|
||||
|
||||
echo "======================"
|
||||
echo "NOTE:"
|
||||
echo "If updating SyntaxKind, make sure to update: client/web/src/lsif/spec.ts"
|
||||
echo "======================"
|
||||
@ -19,11 +19,4 @@ import (
|
||||
_ "golang.org/x/tools/cmd/goimports"
|
||||
// used in many places
|
||||
_ "golang.org/x/tools/cmd/stringer"
|
||||
|
||||
// used for protoc generation
|
||||
_ "github.com/bufbuild/buf/cmd/buf"
|
||||
_ "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc"
|
||||
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
|
||||
|
||||
_ "github.com/sourcegraph/sourcegraph/lib/codeintel/reprolang/bindings/golang"
|
||||
)
|
||||
|
||||
@ -6,4 +6,3 @@
|
||||
- [Sourcegraph recommended indexers](indexers.md)
|
||||
- [Environment variables](envvars.md)
|
||||
- <span class="badge badge-experimental">Experimental</span> [Auto-indexing configuration](auto_indexing_configuration.md)
|
||||
- <span class="badge badge-experimental">Experimental</span> [LSIF Typed specification](lsif.md)
|
||||
|
||||
332
doc/code_intelligence/references/lsif.md
generated
332
doc/code_intelligence/references/lsif.md
generated
@ -1,332 +0,0 @@
|
||||
<!-- DO NOT EDIT DIRECTLY -->
|
||||
<!-- Generated by protoc-gen-doc. Regenerate using `./dev/proto-generate.sh`. -->
|
||||
|
||||
# LSIF Typed protocol reference
|
||||
|
||||
|
||||
### Descriptor
|
||||
|
||||
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **name** | string |
|
||||
| **disambiguator** | string |
|
||||
| **suffix** | Suffix |
|
||||
|
||||
|
||||
|
||||
#### Suffix
|
||||
|
||||
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedSuffix |
|
||||
| 1 | Package |
|
||||
| 2 | Type |
|
||||
| 3 | Term |
|
||||
| 4 | Method |
|
||||
| 5 | TypeParameter |
|
||||
| 6 | Parameter |
|
||||
| 7 | Meta | Can be used for any purpose.
|
||||
| 8 | Local |
|
||||
### Diagnostic
|
||||
|
||||
Represents a diagnostic, such as a compiler error or warning, which should be
|
||||
reported for a document.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **severity** | Severity | Should this diagnostic be reported as an error, warning, info, or hint?
|
||||
| **code** | string | Code of this diagnostic, which might appear in the user interface.
|
||||
| **message** | string | Message of this diagnostic.
|
||||
| **source** | string | Human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'.
|
||||
| repeated **tags** | DiagnosticTag |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Document
|
||||
|
||||
Document defines the metadata about a source file on disk.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **relative_path** | string | (Required) Path to the text document relative to the directory supplied in the associated `Metadata.project_root`. Not URI-encoded. This value should not begin with a directory separator.
|
||||
| repeated **occurrences** | Occurrence | Occurrences that appear in this file.
|
||||
| repeated **symbols** | SymbolInformation | Symbols that are defined within this document.
|
||||
|
||||
|
||||
|
||||
### Index
|
||||
|
||||
Index represents a complete LSIF 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.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **metadata** | Metadata | Metadata about this index.
|
||||
| repeated **documents** | Document | Documents that belong to this index.
|
||||
| repeated **external_symbols** | SymbolInformation | (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.
|
||||
|
||||
|
||||
|
||||
### Metadata
|
||||
|
||||
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **version** | ProtocolVersion | Which version of this protocol was used to generate this index?
|
||||
| **tool_info** | ToolInfo | Information about the tool that produced this index.
|
||||
| **project_root** | string | 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.
|
||||
| **text_document_encoding** | TextEncoding | Text encoding of the source files on disk that are referenced from `Document.relative_path`.
|
||||
|
||||
|
||||
|
||||
|
||||
### Occurrence
|
||||
|
||||
Occurrence associates a source position with a symbol and/or highlighting
|
||||
information.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| repeated **range** | int32 | Source position of this occurrence. Must be exactly three or four elements:
|
||||
| **symbol** | string | (optional) The symbol that appears at this position. See `SymbolInformation.symbol` for how to format symbols as strings.
|
||||
| **symbol_roles** | int32 | (optional) Bitmask for what `SymbolRole` apply to this occurrence. See `SymbolRole` for how to read and write this field.
|
||||
| repeated **override_documentation** | string | (optional) Markdown-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>`).
|
||||
| **syntax_kind** | SyntaxKind | (optional) What syntax highlighting class should be used for this range?
|
||||
| repeated **diagnostics** | Diagnostic | Diagnostics that have been reported for this specific range.
|
||||
|
||||
Additional notes on **range**:
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Package
|
||||
|
||||
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **manager** | string |
|
||||
| **name** | string |
|
||||
| **version** | string |
|
||||
|
||||
|
||||
|
||||
### Relationship
|
||||
|
||||
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **symbol** | string |
|
||||
| **is_reference** | bool | 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#, implementation_symbols = Animal# public sound(): string { return "woof" } ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), implementation_symbols = Animal#sound() } 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.
|
||||
| **is_implementation** | bool | Similar to `references_symbols` but for "Go to implementation". It's common for the `implementation_symbols` and `references_symbols` fields have the same values but that's not always the case. In the TypeScript example above, observe that `implementation_symbols` has the value `"Animal#"` for the "Dog#" symbol while `references_symbols` is empty. When requesting "Find references" on the "Animal#" symbol we don't want to include references to "Dog#" even if "Go to implementation" on the "Animal#" symbol should navigate to the "Dog#" symbol.
|
||||
| **is_type_definition** | bool | Similar to `references_symbols` but for "Go to type definition".
|
||||
|
||||
|
||||
|
||||
|
||||
### Symbol
|
||||
|
||||
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:
|
||||
```
|
||||
<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> ::= <package> | <type> | <term> | <method> | <type-parameter> | <parameter> | <meta>
|
||||
<package> ::= <name> '/'
|
||||
<type> ::= <name> '#'
|
||||
<term> ::= <name> '.'
|
||||
<meta> ::= <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.
|
||||
```
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **scheme** | string |
|
||||
| **package** | Package |
|
||||
| repeated **descriptors** | Descriptor |
|
||||
|
||||
|
||||
|
||||
### SymbolInformation
|
||||
|
||||
SymbolInformation defines metadata about a symbol, such as the symbol's
|
||||
docstring or what package it's defined it.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **symbol** | string | Identifier of this symbol, which can be referenced from `Occurence.symbol`. The string must be formatted according to the grammar in `Symbol`.
|
||||
| repeated **documentation** | string | (optional, but strongly recommended) The markdown-formatted documentation for this symbol. This field is repeated to allow different kinds of documentation. For example, it's nice to include both the signature of a method (parameters and return type) along with the accompanying docstring.
|
||||
| repeated **relationships** | Relationship | (optional) Relationships to other symbols (e.g., implements, type definition).
|
||||
|
||||
|
||||
|
||||
### ToolInfo
|
||||
|
||||
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **name** | string | Name of the indexer that produced this index.
|
||||
| **version** | string | Version of the indexer that produced this index.
|
||||
| repeated **arguments** | string | Command-line arguments that were used to invoke this indexer.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### DiagnosticTag
|
||||
|
||||
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedDiagnosticTag |
|
||||
| 1 | Unnecessary |
|
||||
| 2 | Deprecated |
|
||||
|
||||
|
||||
### ProtocolVersion
|
||||
|
||||
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedProtocolVersion |
|
||||
|
||||
|
||||
### Severity
|
||||
|
||||
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedSeverity |
|
||||
| 1 | Error |
|
||||
| 2 | Warning |
|
||||
| 3 | Information |
|
||||
| 4 | Hint |
|
||||
|
||||
|
||||
### SymbolRole
|
||||
|
||||
SymbolRole declares what "role" a symbol has in an occurrence. A role is
|
||||
encoded as a bitmask 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 psuedo-code, this can be implemented with the
|
||||
logic: `const isImportRole = (role.value & SymbolRole.Import.value) > 0`.
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedSymbolRole |
|
||||
| 1 | Definition | Is the symbol defined here? If not, then this is a symbol reference.
|
||||
| 2 | Import | Is the symbol imported here?
|
||||
| 4 | WriteAccess | Is the symbol written here?
|
||||
| 8 | ReadAccess | Is the symbol read here?
|
||||
| 16 | Generated | Is the symbol in generated code?
|
||||
| 32 | Test | Is the symbol in test code?
|
||||
|
||||
|
||||
### SyntaxKind
|
||||
|
||||
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedSyntaxKind |
|
||||
| 1 | Comment | Comment, including comment markers and text
|
||||
| 2 | PunctuationDelimiter | `;` `.` `,`
|
||||
| 3 | PunctuationBracket | (), {}, [] when used syntactically
|
||||
| 4 | IdentifierKeyword | `if`, `else`, `return`, `class`, etc.
|
||||
| 5 | IdentifierOperator | `+`, `*`, etc.
|
||||
| 6 | Identifier | non-specific catch-all for any identifier not better described elsewhere
|
||||
| 7 | IdentifierBuiltin | Identifiers builtin to the language: `min`, `print` in Python.
|
||||
| 8 | IdentifierNull | Identifiers representing `null`-like values: `None` in Python, `nil` in Go.
|
||||
| 9 | IdentifierConstant | `xyz` in `const xyz = "hello"`
|
||||
| 10 | IdentifierMutableGlobal | `var X = "hello"` in Go
|
||||
| 11 | IdentifierParameter | both parameter definition and references
|
||||
| 12 | IdentifierLocal | identifiers for variable definitions and references within a local scope
|
||||
| 13 | IdentifierShadowed | Used when identifier shadowes some other identifier within the scope
|
||||
| 14 | IdentifierModule | `package main`
|
||||
| 15 | IdentifierFunction | Function call/reference
|
||||
| 16 | IdentifierFunctionDefinition | Function definition only
|
||||
| 17 | IdentifierMacro | Macro call/reference
|
||||
| 18 | IdentifierMacroDefinition | Macro definition only
|
||||
| 19 | IdentifierType | non-builtin types, including namespaces
|
||||
| 20 | IdentifierBuiltinType | builtin types only, such as `str` for Python or `int` in Go
|
||||
| 21 | IdentifierAttribute | Python decorators, c-like __attribute__
|
||||
| 22 | RegexEscape | `\b`
|
||||
| 23 | RegexRepeated | `*`, `+`
|
||||
| 24 | RegexWildcard | `.`
|
||||
| 25 | RegexDelimiter | `(`, `)`, `[`, `]`
|
||||
| 26 | RegexJoin | `|`, `-`
|
||||
| 27 | StringLiteral | Literal strings: "Hello, world!"
|
||||
| 28 | StringLiteralEscape | non-regex escapes: "\t", "\n"
|
||||
| 29 | StringLiteralSpecial | datetimes within strings, special words within a string, `{}` in format strings
|
||||
| 30 | StringLiteralKey | "key" in { "key": "value" }, useful for example in JSON
|
||||
| 31 | CharacterLiteral | 'c' or similar, in languages that differentiate strings and characters
|
||||
| 32 | NumericLiteral | Literal numbers, both floats and integers
|
||||
| 33 | BooleanLiteral | `true`, `false`
|
||||
| 34 | Tag | Used for XML-like tags
|
||||
| 35 | TagAttribute | Attribute name in XML-like tags
|
||||
| 36 | TagDelimiter | Delimiters for XML-like tags
|
||||
|
||||
|
||||
### TextEncoding
|
||||
|
||||
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
| 0 | UnspecifiedTextEncoding |
|
||||
| 1 | UTF8 |
|
||||
| 2 | UTF16 |
|
||||
@ -1,84 +0,0 @@
|
||||
<!-- DO NOT EDIT DIRECTLY -->
|
||||
<!-- Generated by protoc-gen-doc. Regenerate using `./dev/proto-generate.sh`. -->
|
||||
|
||||
# LSIF Typed protocol reference
|
||||
|
||||
{{ range .Files -}}
|
||||
{{ .Description }}
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Files -}}
|
||||
{{ $Enums := .Enums -}}
|
||||
{{ range .Messages -}}
|
||||
{{ $MessageName := .LongName -}}
|
||||
|
||||
##{{ repeat (splitList "." $MessageName | len) "#" }} {{ splitList "." $MessageName | last }}
|
||||
|
||||
{{ .Description }}
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
{{ range .Fields -}}
|
||||
| {{ .Label }} **{{ .Name }}** | {{ .Type }} | {{ splitList "\n\n" .Description | first | replace "\n" " " }}
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Fields -}}
|
||||
{{ if ne (splitList "\n\n" .Description | len) 1 }}
|
||||
Additional notes on **{{ .Name }}**:
|
||||
|
||||
{{ .Description }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{ range $Enums -}}
|
||||
{{ $EnumName := .LongName -}}
|
||||
{{ if eq (nospace (cat $MessageName "." .Name)) $EnumName -}}
|
||||
|
||||
##{{ repeat (splitList "." $EnumName | len) "#" }} {{ splitList "." $EnumName | last }}
|
||||
|
||||
{{ .Description }}
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
{{ range .Values -}}
|
||||
| {{ .Number }} | {{ .Name }} | {{ splitList "\n\n" .Description | first | replace "\n" " " }}
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Values -}}
|
||||
{{ if ne (splitList "\n\n" .Description | len) 1 }}
|
||||
Additional notes on **{{ .Name }}**:
|
||||
|
||||
{{ .Description }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Enums -}}
|
||||
{{ $EnumName := .LongName -}}
|
||||
{{ if eq (splitList "." $EnumName | len) 1 }}
|
||||
|
||||
##{{ repeat (splitList "." $EnumName | len) "#" }} {{ splitList "." $EnumName | last }}
|
||||
|
||||
{{ .Description }}
|
||||
|
||||
| Number | Name | Description |
|
||||
| ------ | ---- | ----------- |
|
||||
{{ range .Values -}}
|
||||
| {{ .Number }} | {{ .Name }} | {{ splitList "\n\n" .Description | first | replace "\n" " " }}
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Values -}}
|
||||
{{ if ne (splitList "\n\n" .Description | len) 1 }}
|
||||
Additional notes on **{{ .Name }}**:
|
||||
|
||||
{{ .Description }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ end -}}
|
||||
24
go.mod
24
go.mod
@ -117,7 +117,6 @@ require (
|
||||
github.com/prometheus/alertmanager v0.23.0
|
||||
github.com/prometheus/client_golang v1.12.2
|
||||
github.com/prometheus/common v0.32.1
|
||||
github.com/pseudomuto/protoc-gen-doc v1.5.0
|
||||
github.com/qustavo/sqlhooks/v2 v2.1.0
|
||||
github.com/rjeczalik/notify v0.9.2
|
||||
github.com/russellhaering/gosaml2 v0.6.0
|
||||
@ -141,8 +140,9 @@ require (
|
||||
github.com/sourcegraph/go-rendezvous v0.0.0-20210910070954-ef39ade5591d
|
||||
github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf
|
||||
github.com/sourcegraph/run v0.7.0
|
||||
github.com/sourcegraph/scip v0.0.0-20220518222722-74aaacf8e4fb
|
||||
github.com/sourcegraph/sourcegraph/enterprise/dev/ci/images v0.0.0-20220203145655-4d2a39d3038a
|
||||
github.com/sourcegraph/sourcegraph/lib v0.0.0-20220203145655-4d2a39d3038a
|
||||
github.com/sourcegraph/sourcegraph/lib v0.0.0-20220511160847-5a43d3ea24eb
|
||||
github.com/stretchr/testify v1.7.1
|
||||
github.com/stripe/stripe-go v70.15.0+incompatible
|
||||
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203
|
||||
@ -210,6 +210,8 @@ require (
|
||||
github.com/huandu/xstrings v1.3.2 // indirect
|
||||
github.com/itchyny/gojq v0.12.7 // indirect
|
||||
github.com/itchyny/timefmt-go v0.1.3 // indirect
|
||||
github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a // indirect
|
||||
github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
@ -218,6 +220,8 @@ require (
|
||||
github.com/mwitkow/go-proto-validators v0.3.2 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/philhofer/fwd v1.1.1 // indirect
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
||||
github.com/pseudomuto/protoc-gen-doc v1.5.1 // indirect
|
||||
github.com/pseudomuto/protokit v0.2.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.6 // indirect
|
||||
@ -227,17 +231,15 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
||||
github.com/bufbuild/buf v0.56.0
|
||||
github.com/bufbuild/buf v1.4.0 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/gofrs/uuid v4.0.0+incompatible
|
||||
github.com/gofrs/uuid v4.2.0+incompatible
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/jhump/protoreflect v1.9.1-0.20210817181203-db1a327a393e // indirect
|
||||
github.com/jhump/protoreflect v1.12.1-0.20220417024638-438db461d753 // indirect
|
||||
github.com/klauspost/pgzip v1.2.5 // indirect
|
||||
github.com/pkg/profile v1.6.0 // indirect
|
||||
github.com/spf13/cobra v1.2.1 // indirect
|
||||
github.com/twitchtv/twirp v8.1.1+incompatible // indirect
|
||||
go.uber.org/multierr v1.7.0 // indirect
|
||||
github.com/spf13/cobra v1.4.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.21.0
|
||||
)
|
||||
|
||||
@ -314,7 +316,7 @@ require (
|
||||
github.com/jpillora/backoff v1.0.0 // indirect
|
||||
github.com/karlseguin/typed v1.1.8 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.14.2 // indirect
|
||||
github.com/klauspost/compress v1.15.1 // indirect
|
||||
github.com/kr/pretty v0.3.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
|
||||
@ -363,7 +365,7 @@ require (
|
||||
go.mongodb.org/mongo-driver v1.8.3 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
|
||||
71
go.sum
71
go.sum
@ -186,14 +186,12 @@ github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKz
|
||||
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
|
||||
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
|
||||
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
|
||||
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
|
||||
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
||||
@ -275,7 +273,6 @@ github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/apex/log v1.1.4/go.mod h1:AlpoD9aScyQfJDVHmLMEcx4oU6LqzkWp4Mg9GdAcEvQ=
|
||||
github.com/apex/log v1.3.0/go.mod h1:jd8Vpsr46WAe3EZSQ/IUMs2qQD/GOycT5rPWCO1yGcs=
|
||||
@ -368,15 +365,13 @@ github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd3
|
||||
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
|
||||
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
|
||||
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
||||
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
|
||||
@ -403,8 +398,8 @@ github.com/bradfitz/gomemcache v0.0.0-20170208213004-1952afaa557d/go.mod h1:PmM6
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
|
||||
github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
|
||||
github.com/bufbuild/buf v0.56.0 h1:oBx0OPMc62HE73dXLQWu6AH+WzA0h0p8/TyA1JeVhks=
|
||||
github.com/bufbuild/buf v0.56.0/go.mod h1:IGK996ntty37odzh5iWRUrK7G16Y8GYE8484mhXZxak=
|
||||
github.com/bufbuild/buf v1.4.0 h1:GqE3a8CMmcFvWPzuY3Mahf9Kf3S9XgZ/ORpfYFzO+90=
|
||||
github.com/bufbuild/buf v1.4.0/go.mod h1:mwHG7klTHnX+rM/ym8LXGl7vYpVmnwT96xWoRB4H5QI=
|
||||
github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
|
||||
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50=
|
||||
@ -620,7 +615,6 @@ github.com/dave/kerr v0.0.0-20170318121727-bc25dd6abe8e/go.mod h1:qZqlPyPvfsDJt+
|
||||
github.com/dave/patsy v0.0.0-20210517141501-957256f50cba/go.mod h1:qfR88CgEGLoiqDaE+xxDCi5QA5v4vUoW0UCX2Nd5Tlc=
|
||||
github.com/dave/rebecca v0.9.1/go.mod h1:N6XYdMD/OKw3lkF3ywh8Z6wPGuwNFDNtWYEMFWEmXBA=
|
||||
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -726,7 +720,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
|
||||
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.6.3 h1:HkntewfZJ9RofA/FX38zBCeIAqlLDFLbAI6eTpZqFJw=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.6.3/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo=
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
||||
@ -1048,8 +1041,9 @@ github.com/gofrs/flock v0.7.3/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14j
|
||||
github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
|
||||
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0=
|
||||
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
|
||||
github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU=
|
||||
github.com/gogo/googleapis v1.3.2/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
|
||||
@ -1223,7 +1217,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
|
||||
github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
||||
github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
|
||||
github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
@ -1253,7 +1246,6 @@ github.com/gopherjs/gopherjs v0.0.0-20220104163920-15ed2e8cf2bd h1:D/H64OK+VY7O0
|
||||
github.com/gopherjs/gopherjs v0.0.0-20220104163920-15ed2e8cf2bd/go.mod h1:cz9oNYuRUWGdHmLF2IodMLkAhcPtXeULvcBNagUrxTI=
|
||||
github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ=
|
||||
github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI=
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
|
||||
github.com/goreleaser/goreleaser v0.136.0/go.mod h1:wiKrPUeSNh6Wu8nUHxZydSOVQ/OZvOaO7DTtFqie904=
|
||||
github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w=
|
||||
github.com/goreleaser/nfpm v1.3.0/go.mod h1:w0p7Kc9TAUgWMyrub63ex3M2Mgw88M4GZXoTq5UCb40=
|
||||
@ -1394,7 +1386,6 @@ github.com/hexops/valast v1.4.1/go.mod h1:G+D6TExWuKs5he+hYlPMfYyhQ8w8qbc2vm4gDW
|
||||
github.com/honeycombio/libhoney-go v1.15.8 h1:TECEltZ48K6J4NG1JVYqmi0vCJNnHYooFor83fgKesA=
|
||||
github.com/honeycombio/libhoney-go v1.15.8/go.mod h1:+tnL2etFnJmVx30yqmoUkVyQjp7uRJw0a2QGu48lSyY=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo=
|
||||
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
|
||||
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE=
|
||||
@ -1403,7 +1394,6 @@ github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
|
||||
github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
@ -1500,10 +1490,18 @@ github.com/jaguilar/vt100 v0.0.0-20150826170717-2703a27b14ea/go.mod h1:QMdK4dGB3
|
||||
github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a h1:d4+I1YEKVmWZrgkt6jpXBnLgV2ZjO0YxEtLDdfIZfH4=
|
||||
github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||
github.com/jhump/protoreflect v1.9.1-0.20210817181203-db1a327a393e h1:Yb4fEGk+GtBSNuvy5rs0ZJt/jtopc/z9azQaj3xbies=
|
||||
github.com/jhump/protoreflect v1.9.1-0.20210817181203-db1a327a393e/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
|
||||
github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
|
||||
github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
|
||||
github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ=
|
||||
github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f h1:BNuUg9k2EiJmlMwjoef3e8vZLHplbVw6DrjGFjLL+Yo=
|
||||
github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f/go.mod h1:qr2b5kx4HbFS7/g4uYO5qv9ei8303JMsC7ESbYiqr2Q=
|
||||
github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
|
||||
github.com/jhump/protoreflect v1.12.1-0.20220417024638-438db461d753 h1:uFlcJKZPLQd7rmOY/RrvBuUaYmAFnlFHKLivhO6cOy8=
|
||||
github.com/jhump/protoreflect v1.12.1-0.20220417024638-438db461d753/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
|
||||
github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a/go.mod h1:xRskid8CManxVta/ALEhJha/pweKBaVG6fWgc0yH25s=
|
||||
github.com/jinzhu/gorm v1.9.1/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
@ -1600,10 +1598,10 @@ github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdY
|
||||
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=
|
||||
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A=
|
||||
github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
@ -1822,7 +1820,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo=
|
||||
github.com/mwitkow/go-proto-validators v0.3.2 h1:qRlmpTzm2pstMKKzTdvwPCF5QfBNURSlAgN/R+qbKos=
|
||||
github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA7a5VarXUOUxD+oeD30w=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
|
||||
@ -1841,7 +1838,6 @@ github.com/neelance/parallel v0.0.0-20160708114440-4de9ce63d14c/go.mod h1:eTBvSI
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nightlyone/lockfile v1.0.0 h1:RHep2cFKK4PonZJDdEl4GmkabuhbsRMgk/k3uAmxBiA=
|
||||
github.com/nightlyone/lockfile v1.0.0/go.mod h1:rywoIealpdNse2r832aiD9jRk8ErCatROs6LzC841CI=
|
||||
github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
@ -1947,6 +1943,8 @@ github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
|
||||
github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@ -2019,8 +2017,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
|
||||
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/pseudomuto/protoc-gen-doc v1.5.0 h1:pHZp0MEiT68jrZV8js8BS7E9ZEnlSLegoQbbtXj5lfo=
|
||||
github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg=
|
||||
github.com/pseudomuto/protoc-gen-doc v1.5.1 h1:Ah259kcrio7Ix1Rhb6u8FCaOkzf9qRBqXnvAufg061w=
|
||||
github.com/pseudomuto/protoc-gen-doc v1.5.1/go.mod h1:XpMKYg6zkcpgfpCfQ8GcWBDRtRxOmMR5w7pz4Xo+dYM=
|
||||
github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM=
|
||||
github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q=
|
||||
github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI=
|
||||
@ -2170,6 +2168,8 @@ github.com/sourcegraph/oauth2 v0.0.0-20210825125341-77c1d99ece3c h1:HGa4iJr6MGKn
|
||||
github.com/sourcegraph/oauth2 v0.0.0-20210825125341-77c1d99ece3c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
github.com/sourcegraph/run v0.7.0 h1:DSUJvcuezqKOhEVHJv+0j9MH4sYqGkDEeyQyDdNuZVk=
|
||||
github.com/sourcegraph/run v0.7.0/go.mod h1:j6Do38ccF+w/rSWgOuu4Ou/eOIDiU6pC87BZmq0DXDY=
|
||||
github.com/sourcegraph/scip v0.0.0-20220518222722-74aaacf8e4fb h1:E4sBHcgNB09NkTw7dokfZ7st7qQbsvaYKm0gN1meN2U=
|
||||
github.com/sourcegraph/scip v0.0.0-20220518222722-74aaacf8e4fb/go.mod h1:vaoij7+8gIg/qTDwvGIHtJY8j3zU5EFMfBsRuACze8I=
|
||||
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8=
|
||||
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
|
||||
github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152 h1:z/MpntplPaW6QW95pzcAR/72Z5TWDyDnSo0EOcyij9o=
|
||||
@ -2191,8 +2191,9 @@ github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKv
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw=
|
||||
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
|
||||
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
|
||||
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
|
||||
github.com/spf13/jwalterweatherman v0.0.0-20170901151539-12bd96e66386/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
@ -2218,7 +2219,6 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH
|
||||
github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As=
|
||||
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
@ -2294,8 +2294,6 @@ github.com/tonistiigi/go-actions-cache v0.0.0-20211002214948-4d48f2ff622a/go.mod
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
|
||||
github.com/tonistiigi/vt100 v0.0.0-20210615222946-8066bb97264f/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/twitchtv/twirp v8.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A=
|
||||
github.com/twitchtv/twirp v8.1.1+incompatible h1:s5WnVKMhC4Xz1jOfNAqTg85iguOWAvsrCJoPiezlLFA=
|
||||
github.com/twitchtv/twirp v8.1.1+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A=
|
||||
github.com/uber/gonduit v0.13.0 h1:rP4TE8ZWChXDIkExuPMvB1TLWZWBrBQfY5qhIvJwKhk=
|
||||
github.com/uber/gonduit v0.13.0/go.mod h1:Xdc+0mRcnAOS7dzz9RDFwzHN3AEkMDn2ATgTPDBCrCU=
|
||||
@ -2473,8 +2471,8 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/
|
||||
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
|
||||
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
|
||||
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
|
||||
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
|
||||
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
|
||||
go.uber.org/ratelimit v0.2.0/go.mod h1:YYBV4e4naJvhpitQrWJu1vCpgB7CboMe0qhltKt6mUg=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
@ -2482,14 +2480,12 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||
go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
|
||||
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
|
||||
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||
gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI=
|
||||
golang.org/x/build v0.0.0-20190314133821-5284462c4bec/go.mod h1:atTaCNAy0f16Ah5aV1gMSwgiKVHwu/JncqDpuRr7lS4=
|
||||
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
@ -2657,7 +2653,6 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx
|
||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
@ -2806,13 +2801,13 @@ golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210908143011-c212e7322662/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -2836,8 +2831,9 @@ golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 h1:EH1Deb8WZJ0xc0WK//leUHXcX9aLE5SymusoTmMZye8=
|
||||
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -2944,12 +2940,10 @@ golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770/go.mod h1:EkVYQZoAsY45+roY
|
||||
golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200527183253-8e7acdbce89d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200624163319-25775e59acb7/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
@ -3052,7 +3046,6 @@ google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoA
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
@ -3183,7 +3176,6 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
|
||||
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.41.0-dev.0.20210907181116-2f3355d2244e/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
|
||||
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
|
||||
google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8=
|
||||
@ -3199,9 +3191,9 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
@ -3216,6 +3208,7 @@ gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||
|
||||
@ -1,480 +0,0 @@
|
||||
package reader
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/writer"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
// ConvertTypedIndexToGraphIndex takes an LSIF Typed index and returns the equivalent LSIF Graph index.
|
||||
// There doesn't exist a reliable bijection between LSIF Typed and LSIF Typed.
|
||||
// This conversion is lossy because LSIF Typed includes metadata that has no equivalent encoding in
|
||||
// LSIF Graph, such as lsiftyped.SymbolRole beyond the definition role.
|
||||
// Also, LSIF Graph allows encoding certain behaviors that LSIF Typed current doesn't support,
|
||||
// such as asymmetric references/definitions.
|
||||
func ConvertTypedIndexToGraphIndex(index *lsiftyped.Index) ([]Element, error) {
|
||||
g := newGraph()
|
||||
|
||||
if index.Metadata == nil {
|
||||
return nil, errors.New(".Metadata is nil")
|
||||
}
|
||||
if index.Metadata.ToolInfo == nil {
|
||||
return nil, errors.New(".Metadata.ToolInfo is nil")
|
||||
}
|
||||
|
||||
positionEncoding := ""
|
||||
switch index.Metadata.TextDocumentEncoding {
|
||||
case lsiftyped.TextEncoding_UTF8:
|
||||
positionEncoding = "utf-8"
|
||||
case lsiftyped.TextEncoding_UTF16:
|
||||
positionEncoding = "utf-16"
|
||||
default:
|
||||
return nil, errors.New(".Metadata.TextDocumentEncoding does not have value utf-8 or utf-16")
|
||||
}
|
||||
|
||||
g.emitVertex(
|
||||
"metaData",
|
||||
MetaData{
|
||||
Version: "0.4.3", // Hardcoded LSIF Graph version.
|
||||
ProjectRoot: index.Metadata.ProjectRoot,
|
||||
PositionEncoding: positionEncoding,
|
||||
ToolInfo: ToolInfo{
|
||||
Name: index.Metadata.ToolInfo.Name,
|
||||
Version: index.Metadata.ToolInfo.Version,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
// Pass 1: create result sets for global symbols.
|
||||
for _, importedSymbol := range index.ExternalSymbols {
|
||||
g.symbolToResultSet[importedSymbol.Symbol] = g.emitResultSet(importedSymbol, "import")
|
||||
}
|
||||
for _, document := range index.Documents {
|
||||
for _, exportedSymbol := range document.Symbols {
|
||||
g.registerInverseRelationships(exportedSymbol)
|
||||
if lsiftyped.IsGlobalSymbol(exportedSymbol.Symbol) {
|
||||
// Local symbols are skipped here because we handle them in the
|
||||
// second pass when processing individual documents.
|
||||
g.symbolToResultSet[exportedSymbol.Symbol] = g.emitResultSet(exportedSymbol, "export")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pass 2: emit ranges for all documents.
|
||||
for _, document := range index.Documents {
|
||||
g.emitDocument(index, document)
|
||||
}
|
||||
|
||||
return g.Elements, nil
|
||||
}
|
||||
|
||||
// graph is a helper struct to emit an LSIF Graph.
|
||||
type graph struct {
|
||||
ID int
|
||||
Elements []Element
|
||||
symbolToResultSet map[string]symbolInformationIDs
|
||||
inverseRelationships map[string][]*lsiftyped.Relationship
|
||||
packageToGraphID map[string]int
|
||||
}
|
||||
|
||||
// symbolInformationIDs is a container for LSIF Graph IDs corresponding to an lsiftyped.SymbolInformation.
|
||||
type symbolInformationIDs struct {
|
||||
ResultSet int
|
||||
DefinitionResult int
|
||||
ReferenceResult int
|
||||
ImplementationResult int
|
||||
HoverResult int
|
||||
}
|
||||
|
||||
func newGraph() graph {
|
||||
return graph{
|
||||
ID: 0,
|
||||
Elements: []Element{},
|
||||
symbolToResultSet: map[string]symbolInformationIDs{},
|
||||
packageToGraphID: map[string]int{},
|
||||
inverseRelationships: map[string][]*lsiftyped.Relationship{},
|
||||
}
|
||||
}
|
||||
|
||||
func (g *graph) emitPackage(pkg *lsiftyped.Package) int {
|
||||
id := pkg.ID()
|
||||
graphID, ok := g.packageToGraphID[id]
|
||||
if ok {
|
||||
return graphID
|
||||
}
|
||||
|
||||
graphID = g.emitVertex("packageInformation", PackageInformation{
|
||||
Name: pkg.Name,
|
||||
Version: pkg.Version,
|
||||
Manager: pkg.Manager,
|
||||
})
|
||||
g.packageToGraphID[pkg.ID()] = graphID
|
||||
return graphID
|
||||
}
|
||||
|
||||
// emitResultSet emits the associated resultSet, definitionResult, referenceResult, implementationResult and hoverResult
|
||||
// for the provided lsiftyped.SymbolInformation.
|
||||
func (g *graph) emitResultSet(info *lsiftyped.SymbolInformation, monikerKind string) symbolInformationIDs {
|
||||
if ids, ok := g.symbolToResultSet[info.Symbol]; ok {
|
||||
return ids
|
||||
}
|
||||
// NOTE: merge separate documentation sections with a horizontal Markdown rule. Indexers that emit LSIF graph
|
||||
// directly need to emit this separator directly while with LSIF Typed we render the horizontal rule here.
|
||||
hover := strings.Join(info.Documentation, "\n\n---\n\n")
|
||||
definitionResult := -1
|
||||
hasDefinition := monikerKind == "export" || monikerKind == "local"
|
||||
if hasDefinition {
|
||||
definitionResult = g.emitVertex("definitionResult", nil)
|
||||
}
|
||||
ids := symbolInformationIDs{
|
||||
ResultSet: g.emitVertex("resultSet", ResultSet{}),
|
||||
DefinitionResult: definitionResult,
|
||||
ReferenceResult: g.emitVertex("referenceResult", nil),
|
||||
ImplementationResult: -1,
|
||||
HoverResult: g.emitVertex("hoverResult", hover),
|
||||
}
|
||||
if hasDefinition {
|
||||
g.emitEdge("textDocument/definition", Edge{OutV: ids.ResultSet, InV: ids.DefinitionResult})
|
||||
}
|
||||
g.emitEdge("textDocument/references", Edge{OutV: ids.ResultSet, InV: ids.ReferenceResult})
|
||||
g.emitEdge("textDocument/hover", Edge{OutV: ids.ResultSet, InV: ids.HoverResult})
|
||||
if monikerKind == "export" || monikerKind == "import" {
|
||||
g.emitMonikerVertex(info.Symbol, monikerKind, ids.ResultSet)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// emitDocument emits all range vertices for the `lsiftyped.Occurrence` in the provided document, along with
|
||||
// associated `item` edges to link ranges with result sets.
|
||||
func (g *graph) emitDocument(index *lsiftyped.Index, doc *lsiftyped.Document) {
|
||||
uri := filepath.Join(index.Metadata.ProjectRoot, doc.RelativePath)
|
||||
documentID := g.emitVertex("document", uri)
|
||||
|
||||
documentSymbolTable := map[string]*lsiftyped.SymbolInformation{}
|
||||
localSymbolInformationTable := map[string]symbolInformationIDs{}
|
||||
for _, info := range doc.Symbols {
|
||||
documentSymbolTable[info.Symbol] = info
|
||||
|
||||
// Build symbol information table for Document-local symbols only.
|
||||
if lsiftyped.IsLocalSymbol(info.Symbol) {
|
||||
localSymbolInformationTable[info.Symbol] = g.emitResultSet(info, "local")
|
||||
}
|
||||
|
||||
// Emit "implementation" monikers for external symbols (monikers with kind "import")
|
||||
for _, relationship := range info.Relationships {
|
||||
if relationship.IsImplementation {
|
||||
relationshipIDs := g.getOrInsertSymbolInformationIDs(relationship.Symbol, localSymbolInformationTable)
|
||||
if relationshipIDs.DefinitionResult > 0 {
|
||||
// Not an imported symbol
|
||||
continue
|
||||
}
|
||||
infoIDs := g.getOrInsertSymbolInformationIDs(info.Symbol, localSymbolInformationTable)
|
||||
g.emitMonikerVertex(relationship.Symbol, "implementation", infoIDs.ResultSet)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var rangeIDs []int
|
||||
for _, occ := range doc.Occurrences {
|
||||
rangeID, err := g.emitRange(occ.Range)
|
||||
if err != nil {
|
||||
// Silently skip invalid ranges.
|
||||
// TODO: add option to print a warning or fail fast here https://github.com/sourcegraph/sourcegraph/issues/31415
|
||||
continue
|
||||
}
|
||||
rangeIDs = append(rangeIDs, rangeID)
|
||||
resultIDs := g.getOrInsertSymbolInformationIDs(occ.Symbol, localSymbolInformationTable)
|
||||
g.emitEdge("next", Edge{OutV: rangeID, InV: resultIDs.ResultSet})
|
||||
isDefinition := occ.SymbolRoles&int32(lsiftyped.SymbolRole_Definition) != 0
|
||||
if isDefinition && resultIDs.DefinitionResult > 0 {
|
||||
g.emitEdge("item", Edge{OutV: resultIDs.DefinitionResult, InVs: []int{rangeID}, Document: documentID})
|
||||
symbolInfo, ok := documentSymbolTable[occ.Symbol]
|
||||
if ok {
|
||||
g.emitRelationships(rangeID, documentID, resultIDs, localSymbolInformationTable, symbolInfo)
|
||||
}
|
||||
}
|
||||
// reference
|
||||
g.emitEdge("item", Edge{OutV: resultIDs.ReferenceResult, InVs: []int{rangeID}, Document: documentID})
|
||||
}
|
||||
g.emitEdge("contains", Edge{OutV: documentID, InVs: rangeIDs})
|
||||
}
|
||||
|
||||
// emitRelationships emits "referenceResults" and "implementationResult" based on the value of lsiftyped.SymbolInformation.Relationships
|
||||
func (g *graph) emitRelationships(rangeID, documentID int, resultIDs symbolInformationIDs, localResultIDs map[string]symbolInformationIDs, info *lsiftyped.SymbolInformation) {
|
||||
var allReferenceResultIds []int
|
||||
relationships := g.inverseRelationships[info.Symbol]
|
||||
for _, relationship := range relationships {
|
||||
allReferenceResultIds = append(allReferenceResultIds, g.emitRelationship(relationship, rangeID, documentID, localResultIDs)...)
|
||||
}
|
||||
for _, relationship := range info.Relationships {
|
||||
allReferenceResultIds = append(allReferenceResultIds, g.emitRelationship(relationship, rangeID, documentID, localResultIDs)...)
|
||||
}
|
||||
if len(allReferenceResultIds) > 0 {
|
||||
g.emitEdge("item", Edge{
|
||||
OutV: resultIDs.ReferenceResult,
|
||||
InVs: allReferenceResultIds,
|
||||
Document: documentID,
|
||||
// According to the LSIF Graph spec, the 'property' field is required but it's not present in the reader.Element struct.
|
||||
// Property: "referenceResults",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (g *graph) emitRelationship(relationship *lsiftyped.Relationship, rangeID, documentID int, localResultIDs map[string]symbolInformationIDs) []int {
|
||||
relationshipIDs := g.getOrInsertSymbolInformationIDs(relationship.Symbol, localResultIDs)
|
||||
|
||||
if relationship.IsImplementation {
|
||||
if relationshipIDs.ImplementationResult < 0 {
|
||||
relationshipIDs.ImplementationResult = g.emitVertex("implementationResult", nil)
|
||||
g.emitEdge("textDocument/implementation", Edge{OutV: relationshipIDs.ResultSet, InV: relationshipIDs.ImplementationResult})
|
||||
}
|
||||
g.emitEdge("item", Edge{OutV: relationshipIDs.ImplementationResult, InVs: []int{rangeID}, Document: documentID})
|
||||
}
|
||||
|
||||
if relationship.IsReference {
|
||||
g.emitEdge("item", Edge{
|
||||
OutV: relationshipIDs.ReferenceResult,
|
||||
InVs: []int{rangeID},
|
||||
Document: documentID,
|
||||
// The 'property' field is included in the LSIF Graph JSON but it's not present in reader.Element
|
||||
// Property: "referenceResults",
|
||||
})
|
||||
return []int{relationshipIDs.ReferenceResult}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// emitMonikerVertex emits the "moniker" vertex and optionally the accompanying "packageInformation" vertex.
|
||||
func (g *graph) emitMonikerVertex(symbolID string, kind string, resultSetID int) {
|
||||
symbol, err := lsiftyped.ParsePartialSymbol(symbolID, false)
|
||||
if err != nil || symbol == nil || symbol.Scheme == "" {
|
||||
// Silently ignore symbols that are missing the scheme. The entire symbol does not have to be formatted
|
||||
// according to the BNF grammar in lsiftyped.Symbol, we only reject symbols that are missing the scheme.
|
||||
// TODO: add option to print a warning or fail fast here https://github.com/sourcegraph/sourcegraph/issues/31415
|
||||
return
|
||||
}
|
||||
// Accept the symbol as long as it has a non-empty scheme. We ignore
|
||||
// parse errors because we can still provide accurate
|
||||
// definition/references/hover within a repo.
|
||||
scheme := symbol.Scheme
|
||||
if symbol.Package != nil {
|
||||
// NOTE: these special cases are needed since the Sourcegraph backend uses the "scheme" field of monikers where
|
||||
// it should use the "manager" field of packageInformation instead.
|
||||
switch symbol.Scheme {
|
||||
case "lsif-java", "scip-java":
|
||||
scheme = "semanticdb"
|
||||
case "lsif-typescript", "scip-typescript":
|
||||
scheme = "npm"
|
||||
}
|
||||
}
|
||||
monikerID := g.emitVertex("moniker", Moniker{
|
||||
Kind: kind,
|
||||
Scheme: scheme,
|
||||
Identifier: symbolID,
|
||||
})
|
||||
g.emitEdge("moniker", Edge{OutV: resultSetID, InV: monikerID})
|
||||
if symbol.Package != nil &&
|
||||
symbol.Package.Manager != "" &&
|
||||
symbol.Package.Name != "" &&
|
||||
symbol.Package.Version != "" {
|
||||
packageID := g.emitPackage(symbol.Package)
|
||||
g.emitEdge("packageInformation", Edge{OutV: monikerID, InV: packageID})
|
||||
}
|
||||
}
|
||||
|
||||
func (g *graph) emitRange(lsifRange []int32) (int, error) {
|
||||
startLine, startCharacter, endLine, endCharacter, err := interpretLsifRange(lsifRange)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return g.emit("vertex", "range", Range{
|
||||
RangeData: protocol.RangeData{
|
||||
Start: protocol.Pos{
|
||||
Line: int(startLine),
|
||||
Character: int(startCharacter),
|
||||
},
|
||||
End: protocol.Pos{
|
||||
Line: int(endLine),
|
||||
Character: int(endCharacter),
|
||||
},
|
||||
},
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (g *graph) emitVertex(label string, payload any) int {
|
||||
return g.emit("vertex", label, payload)
|
||||
}
|
||||
|
||||
func (g *graph) emitEdge(label string, payload Edge) {
|
||||
if payload.InV == 0 && len(payload.InVs) == 0 {
|
||||
panic("no inVs")
|
||||
}
|
||||
g.emit("edge", label, payload)
|
||||
}
|
||||
|
||||
func (g *graph) emit(ty, label string, payload any) int {
|
||||
g.ID++
|
||||
g.Elements = append(g.Elements, Element{
|
||||
ID: g.ID,
|
||||
Type: ty,
|
||||
Label: label,
|
||||
Payload: payload,
|
||||
})
|
||||
return g.ID
|
||||
}
|
||||
|
||||
// registerInverseRelationships records symbol relationships from parent symbols to children symbols.
|
||||
// For example, a struct (child) that implements an interface A (parent) encodes that child->parent
|
||||
// relationship with LSIF Typed via the field `SymbolInformation.Relationships`.
|
||||
// registerInverseRelationships method records the relationship in the opposite direction: parent->child.
|
||||
func (g *graph) registerInverseRelationships(info *lsiftyped.SymbolInformation) {
|
||||
for _, relationship := range info.Relationships {
|
||||
inverseRelationships := g.inverseRelationships[relationship.Symbol]
|
||||
g.inverseRelationships[relationship.Symbol] = append(inverseRelationships, &lsiftyped.Relationship{
|
||||
Symbol: info.Symbol,
|
||||
IsReference: relationship.IsReference,
|
||||
IsImplementation: relationship.IsImplementation,
|
||||
IsTypeDefinition: relationship.IsTypeDefinition,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// interpretLsifRange handles the difference between single-line and multi-line encoding of range positions.
|
||||
func interpretLsifRange(lsifRange []int32) (startLine, startCharacter, endLine, endCharacter int32, err error) {
|
||||
if len(lsifRange) == 3 {
|
||||
return lsifRange[0], lsifRange[1], lsifRange[0], lsifRange[2], nil
|
||||
}
|
||||
if len(lsifRange) == 4 {
|
||||
return lsifRange[0], lsifRange[1], lsifRange[2], lsifRange[3], nil
|
||||
}
|
||||
return 0, 0, 0, 0, errors.Newf("invalid LSIF range %v", lsifRange)
|
||||
}
|
||||
|
||||
func (g *graph) getOrInsertSymbolInformationIDs(symbol string, localResultSetTable map[string]symbolInformationIDs) symbolInformationIDs {
|
||||
resultSetTable := g.symbolToResultSet
|
||||
if lsiftyped.IsLocalSymbol(symbol) {
|
||||
resultSetTable = localResultSetTable
|
||||
}
|
||||
ids, ok := resultSetTable[symbol]
|
||||
if !ok {
|
||||
ids = g.emitResultSet(&lsiftyped.SymbolInformation{Symbol: symbol}, "import")
|
||||
resultSetTable[symbol] = ids
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
func WriteNDJSON(elements []jsonElement, out io.Writer) error {
|
||||
w := writer.NewJSONWriter(out)
|
||||
for _, e := range elements {
|
||||
w.Write(e)
|
||||
}
|
||||
return w.Flush()
|
||||
}
|
||||
|
||||
type jsonHoverContent struct {
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
type jsonHoverResult struct {
|
||||
Contents jsonHoverContent `json:"contents"`
|
||||
}
|
||||
type jsonToolInfo struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// jsonElement is similar to Element but it can be serialized to JSON to emit valid LSIF Graph output.
|
||||
type jsonElement struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Manager string `json:"manager,omitempty"`
|
||||
ProjectRoot string `json:"projectRoot,omitempty"`
|
||||
PositionEncoding string `json:"positionEncoding,omitempty"`
|
||||
ToolInfo *jsonToolInfo `json:"toolInfo,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Result *jsonHoverResult `json:"result,omitempty"`
|
||||
Uri string `json:"uri,omitempty"`
|
||||
Start *protocol.Pos `json:"start,omitempty"`
|
||||
End *protocol.Pos `json:"end,omitempty"`
|
||||
InV int `json:"inV,omitempty"`
|
||||
InVs []int `json:"inVs,omitempty"`
|
||||
OutV int `json:"outV,omitempty"`
|
||||
Document int `json:"document,omitempty"`
|
||||
Identifier string `json:"identifier,omitempty"`
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
}
|
||||
|
||||
func ElementsToJsonElements(els []Element) []jsonElement {
|
||||
var r []jsonElement
|
||||
for _, el := range els {
|
||||
object := jsonElement{
|
||||
ID: el.ID,
|
||||
Type: el.Type,
|
||||
Label: el.Label,
|
||||
}
|
||||
if el.Type == "edge" {
|
||||
edge := el.Payload.(Edge)
|
||||
object.OutV = edge.OutV
|
||||
object.InV = edge.InV
|
||||
object.InVs = edge.InVs
|
||||
object.Document = edge.Document
|
||||
} else if el.Type == "vertex" {
|
||||
switch el.Label {
|
||||
case "hoverResult":
|
||||
object.Result = &jsonHoverResult{Contents: jsonHoverContent{
|
||||
Kind: "markdown",
|
||||
Value: el.Payload.(string),
|
||||
}}
|
||||
case "document":
|
||||
object.Uri = el.Payload.(string)
|
||||
case "range":
|
||||
rng := el.Payload.(Range)
|
||||
object.Start = &rng.Start
|
||||
object.End = &rng.End
|
||||
case "metaData":
|
||||
metaData := el.Payload.(MetaData)
|
||||
object.Version = metaData.Version
|
||||
object.ProjectRoot = metaData.ProjectRoot
|
||||
object.PositionEncoding = metaData.PositionEncoding
|
||||
object.ToolInfo = &jsonToolInfo{
|
||||
Name: metaData.ToolInfo.Name,
|
||||
Version: metaData.ToolInfo.Version,
|
||||
}
|
||||
case "moniker":
|
||||
moniker := el.Payload.(Moniker)
|
||||
object.Identifier = moniker.Identifier
|
||||
object.Kind = moniker.Kind
|
||||
object.Scheme = moniker.Scheme
|
||||
case "packageInformation":
|
||||
pkg := el.Payload.(PackageInformation)
|
||||
object.Name = pkg.Name
|
||||
object.Version = pkg.Version
|
||||
object.Manager = pkg.Manager
|
||||
case "definitionResult",
|
||||
"implementationResult",
|
||||
"referenceResult",
|
||||
"referenceResults",
|
||||
"resultSet",
|
||||
"textDocument/references",
|
||||
"textDocument/hover",
|
||||
"textDocument/definition":
|
||||
default:
|
||||
panic(fmt.Sprintf("unexpected LSIF element: %+v", el))
|
||||
}
|
||||
} else {
|
||||
panic(el.Type)
|
||||
}
|
||||
r = append(r, object)
|
||||
}
|
||||
return r
|
||||
}
|
||||
1
lib/codeintel/lsiftyped/.gitattributes
vendored
1
lib/codeintel/lsiftyped/.gitattributes
vendored
@ -1 +0,0 @@
|
||||
lsif.ts linguist-generated=true
|
||||
1884
lib/codeintel/lsiftyped/lsif.pb.go
generated
1884
lib/codeintel/lsiftyped/lsif.pb.go
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@sourcegraph/lsif-typed",
|
||||
"version": "0.0.1",
|
||||
"description": "Schema for LSIF typed",
|
||||
"sideEffects": false,
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
package lsiftyped
|
||||
|
||||
// Range represents a range between two offset positions.
|
||||
// NOTE: the lsif/protocol package contains similarly shaped structs but this
|
||||
// one exists primarily to make it easier to work with LSIF Typed encoded positions,
|
||||
// which have the type []int32 in Protobuf payloads.
|
||||
type Range struct {
|
||||
Start Position
|
||||
End Position
|
||||
}
|
||||
|
||||
// Position represents an offset position.
|
||||
type Position struct {
|
||||
Line int32
|
||||
Character int32
|
||||
}
|
||||
|
||||
// NewRange converts an LSIF Typed range into `Range`
|
||||
func NewRange(lsifRange []int32) *Range {
|
||||
var endLine int32
|
||||
var endCharacter int32
|
||||
if len(lsifRange) == 3 { // single line
|
||||
endLine = lsifRange[0]
|
||||
endCharacter = lsifRange[2]
|
||||
} else if len(lsifRange) == 4 { // multi-line
|
||||
endLine = lsifRange[2]
|
||||
endCharacter = lsifRange[3]
|
||||
}
|
||||
return &Range{
|
||||
Start: Position{
|
||||
Line: lsifRange[0],
|
||||
Character: lsifRange[1],
|
||||
},
|
||||
End: Position{
|
||||
Line: endLine,
|
||||
Character: endCharacter,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r Range) IsSingleLine() bool {
|
||||
return r.Start.Line == r.End.Line
|
||||
}
|
||||
|
||||
func (r Range) LsifRange() []int32 {
|
||||
if r.Start.Line == r.End.Line {
|
||||
return []int32{r.Start.Line, r.Start.Character, r.End.Character}
|
||||
}
|
||||
return []int32{r.Start.Line, r.Start.Character, r.End.Line, r.End.Character}
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
package lsiftyped
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SourceFile includes helper methods to deal with source files.
|
||||
type SourceFile struct {
|
||||
AbsolutePath string
|
||||
RelativePath string
|
||||
Text string
|
||||
Lines []string
|
||||
}
|
||||
|
||||
func NewSourceFile(absolutePath, relativePath, code string) *SourceFile {
|
||||
return &SourceFile{
|
||||
AbsolutePath: absolutePath,
|
||||
RelativePath: relativePath,
|
||||
Text: code,
|
||||
Lines: strings.Split(code, "\n"),
|
||||
}
|
||||
}
|
||||
|
||||
// NewSourcesFromDirectory recursively walks the provided directory and creates a SourceFile for every regular file.
|
||||
func NewSourcesFromDirectory(directory string) ([]*SourceFile, error) {
|
||||
var result []*SourceFile
|
||||
err := filepath.Walk(directory, func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
relativePath, err := filepath.Rel(directory, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sourceFile, err := NewSourceFileFromPath(path, relativePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result = append(result, sourceFile)
|
||||
return nil
|
||||
})
|
||||
return result, err
|
||||
}
|
||||
|
||||
// NewSourceFileFromPath reads the provided absolute path from disk and returns a SourceFile.
|
||||
func NewSourceFileFromPath(absolutePath, relativePath string) (*SourceFile, error) {
|
||||
text, err := os.ReadFile(absolutePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewSourceFile(absolutePath, relativePath, string(text)), nil
|
||||
}
|
||||
|
||||
func (d *SourceFile) String() string {
|
||||
data, err := json.Marshal(&d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return string(data)
|
||||
}
|
||||
|
||||
// RangeText returns the substring of the source file contents that enclose the provided range.
|
||||
func (d *SourceFile) RangeText(position Range) string {
|
||||
result := strings.Builder{}
|
||||
for line := position.Start.Line; line < position.End.Line; line++ {
|
||||
start := position.Start.Character
|
||||
if line > position.Start.Line {
|
||||
result.WriteString("\n")
|
||||
start = 0
|
||||
}
|
||||
end := position.End.Character
|
||||
if line < position.End.Line {
|
||||
end = int32(len(d.Lines[line]))
|
||||
}
|
||||
result.WriteString(d.Lines[line][start:end])
|
||||
}
|
||||
return result.String()
|
||||
}
|
||||
@ -1,226 +0,0 @@
|
||||
package lsiftyped
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
func IsGlobalSymbol(symbol string) bool {
|
||||
return !IsLocalSymbol(symbol)
|
||||
}
|
||||
|
||||
func IsLocalSymbol(symbol string) bool {
|
||||
return strings.HasPrefix(symbol, "local ")
|
||||
}
|
||||
|
||||
// ParseSymbol parses an LSIF Typed string into the lsiftyped.Symbol message.
|
||||
func ParseSymbol(symbol string) (*Symbol, error) {
|
||||
return ParsePartialSymbol(symbol, true)
|
||||
}
|
||||
|
||||
// ParsePartialSymbol parses an LSIF Typed string into the lsiftyped.Symbol message
|
||||
// with the option to exclude the `.Descriptor` field.
|
||||
func ParsePartialSymbol(symbol string, includeDescriptors bool) (*Symbol, error) {
|
||||
s := newSymbolParser(symbol)
|
||||
scheme, err := s.acceptSpaceEscapedIdentifier("scheme")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if scheme == "local" {
|
||||
return newLocalSymbol(string(s.Symbol[s.index:])), nil
|
||||
}
|
||||
manager, err := s.acceptSpaceEscapedIdentifier("package manager")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
packageName, err := s.acceptSpaceEscapedIdentifier("package name")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if packageName == "." {
|
||||
packageName = ""
|
||||
}
|
||||
packageVersion, err := s.acceptSpaceEscapedIdentifier("package version")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if packageVersion == "." {
|
||||
packageVersion = ""
|
||||
}
|
||||
var descriptors []*Descriptor
|
||||
if includeDescriptors {
|
||||
descriptors, err = s.parseDescriptors()
|
||||
}
|
||||
return &Symbol{
|
||||
Scheme: scheme,
|
||||
Package: &Package{
|
||||
Manager: manager,
|
||||
Name: packageName,
|
||||
Version: packageVersion,
|
||||
},
|
||||
Descriptors: descriptors,
|
||||
}, err
|
||||
}
|
||||
|
||||
func newLocalSymbol(id string) *Symbol {
|
||||
return &Symbol{
|
||||
Scheme: "local",
|
||||
Descriptors: []*Descriptor{
|
||||
{Name: id, Suffix: Descriptor_Local},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type symbolParser struct {
|
||||
Symbol []rune
|
||||
index int
|
||||
SymbolString string
|
||||
}
|
||||
|
||||
func newSymbolParser(symbol string) *symbolParser {
|
||||
return &symbolParser{
|
||||
SymbolString: symbol,
|
||||
Symbol: []rune(symbol),
|
||||
index: 0,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *symbolParser) error(message string) error {
|
||||
return errors.Newf("%s\n%s\n%s^", message, s.SymbolString, strings.Repeat("_", s.index))
|
||||
}
|
||||
|
||||
func (s *symbolParser) current() rune {
|
||||
return s.Symbol[s.index]
|
||||
}
|
||||
|
||||
func (s *symbolParser) peekNext() rune {
|
||||
if s.index+1 < len(s.Symbol) {
|
||||
return s.Symbol[s.index]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (s *symbolParser) parseDescriptors() ([]*Descriptor, error) {
|
||||
var result []*Descriptor
|
||||
for s.index < len(s.Symbol) {
|
||||
descriptor, err := s.parseDescriptor()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = append(result, descriptor)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *symbolParser) parseDescriptor() (*Descriptor, error) {
|
||||
switch s.peekNext() {
|
||||
case '(':
|
||||
s.index++
|
||||
name, err := s.acceptIdentifier("parameter name")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Descriptor{Name: name, Suffix: Descriptor_Parameter}, s.acceptCharacter(')', "closing parameter name")
|
||||
case '[':
|
||||
s.index++
|
||||
name, err := s.acceptIdentifier("type parameter name")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Descriptor{Name: name, Suffix: Descriptor_TypeParameter}, s.acceptCharacter(']', "closing type parameter name")
|
||||
default:
|
||||
name, err := s.acceptIdentifier("descriptor name")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
suffix := s.current()
|
||||
s.index++
|
||||
switch suffix {
|
||||
case '(':
|
||||
disambiguator := ""
|
||||
if s.peekNext() != ')' {
|
||||
disambiguator, err = s.acceptIdentifier("method disambiguator")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
err = s.acceptCharacter(')', "closing method")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Descriptor{Name: name, Disambiguator: disambiguator, Suffix: Descriptor_Method}, s.acceptCharacter('.', "closing method")
|
||||
case '/':
|
||||
return &Descriptor{Name: name, Suffix: Descriptor_Package}, nil
|
||||
case '.':
|
||||
return &Descriptor{Name: name, Suffix: Descriptor_Term}, nil
|
||||
case '#':
|
||||
return &Descriptor{Name: name, Suffix: Descriptor_Type}, nil
|
||||
case ':':
|
||||
return &Descriptor{Name: name, Suffix: Descriptor_Meta}, nil
|
||||
default:
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *symbolParser) acceptIdentifier(what string) (string, error) {
|
||||
if s.current() == '`' {
|
||||
s.index++
|
||||
return s.acceptBacktickEscapedIdentifier(what)
|
||||
}
|
||||
start := s.index
|
||||
for s.index < len(s.Symbol) && isIdentifierCharacter(s.current()) {
|
||||
s.index++
|
||||
}
|
||||
if start == s.index {
|
||||
return "", s.error("empty identifier")
|
||||
}
|
||||
return string(s.Symbol[start:s.index]), nil
|
||||
}
|
||||
|
||||
func isIdentifierCharacter(r rune) bool {
|
||||
return unicode.IsLetter(r) || unicode.IsDigit(r) || r == '-' || r == '+' || r == '$' || r == '_'
|
||||
}
|
||||
|
||||
func (s *symbolParser) acceptSpaceEscapedIdentifier(what string) (string, error) {
|
||||
return s.acceptEscapedIdentifier(what, ' ')
|
||||
}
|
||||
|
||||
func (s *symbolParser) acceptBacktickEscapedIdentifier(what string) (string, error) {
|
||||
return s.acceptEscapedIdentifier(what, '`')
|
||||
}
|
||||
|
||||
func (s *symbolParser) acceptEscapedIdentifier(what string, escapeCharacter rune) (string, error) {
|
||||
builder := strings.Builder{}
|
||||
for s.index < len(s.Symbol) {
|
||||
ch := s.current()
|
||||
if ch == escapeCharacter {
|
||||
s.index++
|
||||
if s.current() == escapeCharacter {
|
||||
// Escaped space character.
|
||||
builder.WriteRune(ch)
|
||||
} else {
|
||||
return builder.String(), nil
|
||||
}
|
||||
} else {
|
||||
builder.WriteRune(ch)
|
||||
}
|
||||
s.index++
|
||||
}
|
||||
return "", s.error(fmt.Sprintf("reached end of symbol while parsing <%s>, expected a '%v' character", what, string(escapeCharacter)))
|
||||
}
|
||||
|
||||
func (s *symbolParser) acceptCharacter(r rune, what string) error {
|
||||
if s.current() == r {
|
||||
s.index++
|
||||
return nil
|
||||
}
|
||||
return s.error(fmt.Sprintf("expected '%v', obtained '%v', while parsing %v", string(r), string(s.current()), what))
|
||||
}
|
||||
|
||||
func (x *Package) ID() string {
|
||||
return fmt.Sprintf("%s %s %s", x.Manager, x.Name, x.Version)
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
package lsiftyped
|
||||
|
||||
import "strings"
|
||||
|
||||
// SymbolFormatter configures how to format an LSIF Typed 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.
|
||||
type SymbolFormatter struct {
|
||||
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
|
||||
}
|
||||
|
||||
// DescriptorOnlyFormatter formats only the descriptor part of the symbol.
|
||||
var DescriptorOnlyFormatter = SymbolFormatter{
|
||||
IncludeScheme: func(scheme string) bool { return scheme == "local" },
|
||||
IncludePackageManager: func(_unused string) bool { return false },
|
||||
IncludePackageName: func(_unused string) bool { return false },
|
||||
IncludePackageVersion: func(_unused string) bool { return false },
|
||||
IncludeDescriptor: func(_unused string) bool { return true },
|
||||
}
|
||||
|
||||
func (f *SymbolFormatter) Format(symbol string) (string, error) {
|
||||
parsed, err := ParseSymbol(symbol)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return f.FormatSymbol(parsed), nil
|
||||
}
|
||||
|
||||
func (f *SymbolFormatter) FormatSymbol(symbol *Symbol) string {
|
||||
var parts []string
|
||||
if f.IncludeScheme(symbol.Scheme) { // Always include the scheme for local symbols
|
||||
parts = append(parts, symbol.Scheme)
|
||||
}
|
||||
if symbol.Package != nil && symbol.Package.Manager != "" && f.IncludePackageManager(symbol.Package.Manager) {
|
||||
parts = append(parts, symbol.Package.Manager)
|
||||
}
|
||||
if symbol.Package != nil && symbol.Package.Name != "" && f.IncludePackageName(symbol.Package.Name) {
|
||||
parts = append(parts, symbol.Package.Name)
|
||||
}
|
||||
if symbol.Package != nil && symbol.Package.Version != "" && f.IncludePackageVersion(symbol.Package.Version) {
|
||||
parts = append(parts, symbol.Package.Version)
|
||||
}
|
||||
descriptor := strings.Builder{}
|
||||
for _, desc := range symbol.Descriptors {
|
||||
switch desc.Suffix {
|
||||
case Descriptor_Package:
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune('/')
|
||||
case Descriptor_Type:
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune('#')
|
||||
case Descriptor_Term:
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune('.')
|
||||
case Descriptor_Method:
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune('(')
|
||||
descriptor.WriteString(desc.Disambiguator)
|
||||
descriptor.WriteString(").")
|
||||
case Descriptor_TypeParameter:
|
||||
descriptor.WriteRune('[')
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune(']')
|
||||
case Descriptor_Parameter:
|
||||
descriptor.WriteRune('(')
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune(')')
|
||||
case Descriptor_Meta:
|
||||
descriptor.WriteString(desc.Name)
|
||||
descriptor.WriteRune(':')
|
||||
case Descriptor_Local:
|
||||
descriptor.WriteString(desc.Name)
|
||||
}
|
||||
}
|
||||
descriptorString := descriptor.String()
|
||||
if f.IncludeDescriptor(descriptorString) {
|
||||
parts = append(parts, descriptorString)
|
||||
}
|
||||
|
||||
return strings.Join(parts, " ")
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package lsiftyped
|
||||
|
||||
// SymbolTable returns a map of SymbolInformation values keyed by the symbol field.
|
||||
func (x *Document) SymbolTable() map[string]*SymbolInformation {
|
||||
symtab := map[string]*SymbolInformation{}
|
||||
for _, info := range x.Symbols {
|
||||
symtab[info.Symbol] = info
|
||||
}
|
||||
return symtab
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
package lsiftyped
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParseSymbol(t *testing.T) {
|
||||
type test struct {
|
||||
Symbol string
|
||||
Expected *Symbol
|
||||
}
|
||||
tests := []test{
|
||||
{Symbol: "local a", Expected: newLocalSymbol("a")},
|
||||
{Symbol: "a b c d method().", Expected: &Symbol{
|
||||
Scheme: "a",
|
||||
Package: &Package{
|
||||
Manager: "b",
|
||||
Name: "c",
|
||||
Version: "d",
|
||||
},
|
||||
Descriptors: []*Descriptor{{Name: "method", Suffix: Descriptor_Method}},
|
||||
}},
|
||||
// Backtick-escaped descriptor
|
||||
{Symbol: "a b c d `e f`.", Expected: &Symbol{
|
||||
Scheme: "a",
|
||||
Package: &Package{
|
||||
Manager: "b",
|
||||
Name: "c",
|
||||
Version: "d",
|
||||
},
|
||||
Descriptors: []*Descriptor{{Name: "e f", Suffix: Descriptor_Term}},
|
||||
}},
|
||||
// Space-escaped package name
|
||||
{Symbol: "a b c d e f.", Expected: &Symbol{
|
||||
Scheme: "a",
|
||||
Package: &Package{
|
||||
Manager: "b c",
|
||||
Name: "d",
|
||||
Version: "e",
|
||||
},
|
||||
Descriptors: []*Descriptor{{Name: "f", Suffix: Descriptor_Term}},
|
||||
}},
|
||||
{
|
||||
Symbol: "scip-java maven package 1.0.0 java/io/File#Entry.method(+1).(param)[TypeParam]",
|
||||
Expected: &Symbol{
|
||||
Scheme: "scip-java",
|
||||
Package: &Package{Manager: "maven", Name: "package", Version: "1.0.0"},
|
||||
Descriptors: []*Descriptor{
|
||||
{Name: "java", Suffix: Descriptor_Package},
|
||||
{Name: "io", Suffix: Descriptor_Package},
|
||||
{Name: "File", Suffix: Descriptor_Type},
|
||||
{Name: "Entry", Suffix: Descriptor_Term},
|
||||
{Name: "method", Disambiguator: "+1", Suffix: Descriptor_Method},
|
||||
{Name: "param", Suffix: Descriptor_Parameter},
|
||||
{Name: "TypeParam", Suffix: Descriptor_TypeParameter},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.Symbol, func(t *testing.T) {
|
||||
obtained, err := ParseSymbol(test.Symbol)
|
||||
require.Nil(t, err)
|
||||
if diff := cmp.Diff(obtained.String(), test.Expected.String()); diff != "" {
|
||||
t.Fatalf("unexpected response (-want +got):\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1,158 +0,0 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
// FormatSnapshots renders the provided LSIF index into a pretty-printed text format
|
||||
// that is suitable for snapshot testing.
|
||||
func FormatSnapshots(
|
||||
index *lsiftyped.Index,
|
||||
commentSyntax string,
|
||||
symbolFormatter lsiftyped.SymbolFormatter,
|
||||
) ([]*lsiftyped.SourceFile, error) {
|
||||
var result []*lsiftyped.SourceFile
|
||||
projectRoot, err := url.Parse(index.Metadata.ProjectRoot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, document := range index.Documents {
|
||||
snapshot, err := FormatSnapshot(document, index, commentSyntax, symbolFormatter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sourceFile := lsiftyped.NewSourceFile(
|
||||
filepath.Join(projectRoot.Path, document.RelativePath),
|
||||
document.RelativePath,
|
||||
snapshot,
|
||||
)
|
||||
result = append(result, sourceFile)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// FormatSnapshot renders the provided LSIF index into a pretty-printed text format
|
||||
// that is suitable for snapshot testing.
|
||||
func FormatSnapshot(
|
||||
document *lsiftyped.Document,
|
||||
index *lsiftyped.Index,
|
||||
commentSyntax string,
|
||||
formatter lsiftyped.SymbolFormatter,
|
||||
) (string, error) {
|
||||
b := strings.Builder{}
|
||||
uri, err := url.Parse(filepath.Join(index.Metadata.ProjectRoot, document.RelativePath))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if uri.Scheme != "file" {
|
||||
return "", errors.New("expected url scheme 'file', obtained " + uri.Scheme)
|
||||
}
|
||||
data, err := os.ReadFile(uri.Path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
symtab := document.SymbolTable()
|
||||
sort.SliceStable(document.Occurrences, func(i, j int) bool {
|
||||
return isLsifRangeLess(document.Occurrences[i].Range, document.Occurrences[j].Range)
|
||||
})
|
||||
var formattingError error
|
||||
formatSymbol := func(symbol string) string {
|
||||
formatted, err := formatter.Format(symbol)
|
||||
if err != nil {
|
||||
formattingError = errors.CombineErrors(formattingError, errors.Wrapf(err, symbol))
|
||||
return err.Error()
|
||||
}
|
||||
return formatted
|
||||
}
|
||||
i := 0
|
||||
for lineNumber, line := range strings.Split(string(data), "\n") {
|
||||
line = strings.TrimSuffix(line, "\r")
|
||||
b.WriteString(strings.Repeat(" ", len(commentSyntax)))
|
||||
b.WriteString(strings.ReplaceAll(line, "\t", " "))
|
||||
b.WriteString("\n")
|
||||
for i < len(document.Occurrences) && document.Occurrences[i].Range[0] == int32(lineNumber) {
|
||||
occ := document.Occurrences[i]
|
||||
pos := lsiftyped.NewRange(occ.Range)
|
||||
if !pos.IsSingleLine() {
|
||||
continue
|
||||
}
|
||||
b.WriteString(commentSyntax)
|
||||
for indent := int32(0); indent < pos.Start.Character; indent++ {
|
||||
b.WriteRune(' ')
|
||||
}
|
||||
length := pos.End.Character - pos.Start.Character
|
||||
for caret := int32(0); caret < length; caret++ {
|
||||
b.WriteRune('^')
|
||||
}
|
||||
b.WriteRune(' ')
|
||||
role := "reference"
|
||||
isDefinition := occ.SymbolRoles&int32(lsiftyped.SymbolRole_Definition) > 0
|
||||
if isDefinition {
|
||||
role = "definition"
|
||||
}
|
||||
b.WriteString(role)
|
||||
b.WriteRune(' ')
|
||||
b.WriteString(formatSymbol(occ.Symbol))
|
||||
|
||||
if info, ok := symtab[occ.Symbol]; ok && isDefinition {
|
||||
prefix := "\n" + commentSyntax + strings.Repeat(" ", int(pos.Start.Character))
|
||||
for _, documentation := range info.Documentation {
|
||||
b.WriteString(prefix)
|
||||
b.WriteString("documentation ")
|
||||
truncatedDocumentation := documentation
|
||||
newlineIndex := strings.Index(documentation, "\n")
|
||||
if newlineIndex >= 0 {
|
||||
truncatedDocumentation = documentation[0:newlineIndex]
|
||||
}
|
||||
b.WriteString(truncatedDocumentation)
|
||||
}
|
||||
sort.SliceStable(info.Relationships, func(i, j int) bool {
|
||||
return info.Relationships[i].Symbol < info.Relationships[j].Symbol
|
||||
})
|
||||
for _, relationship := range info.Relationships {
|
||||
b.WriteString(prefix)
|
||||
b.WriteString("relationship ")
|
||||
b.WriteString(formatSymbol(relationship.Symbol))
|
||||
if relationship.IsImplementation {
|
||||
b.WriteString(" implementation")
|
||||
}
|
||||
if relationship.IsReference {
|
||||
b.WriteString(" reference")
|
||||
}
|
||||
if relationship.IsTypeDefinition {
|
||||
b.WriteString(" type_definition")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.WriteString("\n")
|
||||
i++
|
||||
}
|
||||
}
|
||||
return b.String(), formattingError
|
||||
}
|
||||
|
||||
// isRangeLess compares two LSIF ranges (which are encoded as []int32).
|
||||
func isLsifRangeLess(a []int32, b []int32) bool {
|
||||
if a[0] != b[0] { // start line
|
||||
return a[0] < b[0]
|
||||
}
|
||||
if a[1] != b[1] { // start character
|
||||
return a[1] < b[1]
|
||||
}
|
||||
if len(a) != len(b) { // is one of these multiline
|
||||
return len(a) < len(b)
|
||||
}
|
||||
if a[2] != b[2] { // end line
|
||||
return a[2] < b[1]
|
||||
}
|
||||
// end character
|
||||
return a[3] < b[2]
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/hexops/gotextdiff"
|
||||
"github.com/hexops/gotextdiff/myers"
|
||||
"github.com/hexops/gotextdiff/span"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
)
|
||||
|
||||
var updateLsifSnapshots = flag.Bool("update-lsif-snapshots", false, "update LSIF snapshots files")
|
||||
|
||||
type indexFunction = func(inputDirectory, outputDirectory string, sources []*lsiftyped.SourceFile) []*lsiftyped.SourceFile
|
||||
|
||||
func SnapshotTest(t *testing.T, indexFunction indexFunction) {
|
||||
cwd, err := os.Getwd()
|
||||
require.Nil(t, err)
|
||||
inputDirectory := filepath.Join(cwd, "snapshots-input")
|
||||
outputDirectory := filepath.Join(cwd, "snapshots-output")
|
||||
SnapshotTestDirectories(t, inputDirectory, outputDirectory, indexFunction)
|
||||
}
|
||||
|
||||
func SnapshotTestDirectories(t *testing.T, inputDirectory, outputDirectory string, indexFunction indexFunction) {
|
||||
if *updateLsifSnapshots {
|
||||
err := os.RemoveAll(outputDirectory)
|
||||
require.Nil(t, err)
|
||||
}
|
||||
testCases, err := os.ReadDir(inputDirectory)
|
||||
require.Nil(t, err)
|
||||
if len(testCases) == 0 {
|
||||
t.Fatalf("no subdirectories: %v", inputDirectory)
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
if !testCase.IsDir() {
|
||||
t.Fatalf("not a directory: %v", testCase.Name())
|
||||
}
|
||||
t.Run(testCase.Name(), func(t *testing.T) {
|
||||
baseInputDirectory := filepath.Join(inputDirectory, testCase.Name())
|
||||
baseOutputDirectory := filepath.Join(outputDirectory, testCase.Name())
|
||||
sources, err := lsiftyped.NewSourcesFromDirectory(baseInputDirectory)
|
||||
require.Nil(t, err)
|
||||
obtainedSnapshots := indexFunction(baseInputDirectory, baseOutputDirectory, sources)
|
||||
snapshotTestSources(t, baseOutputDirectory, obtainedSnapshots)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func snapshotTestSources(t *testing.T, outputDirectory string, obtainedSnapshots []*lsiftyped.SourceFile) {
|
||||
for _, document := range obtainedSnapshots {
|
||||
t.Run(document.RelativePath, func(t *testing.T) {
|
||||
obtained := document.Text
|
||||
outputFile := filepath.Join(outputDirectory, document.RelativePath)
|
||||
expected, err := os.ReadFile(outputFile)
|
||||
if err != nil {
|
||||
expected = []byte{}
|
||||
}
|
||||
if *updateLsifSnapshots {
|
||||
err = os.MkdirAll(filepath.Dir(outputFile), 0755)
|
||||
require.Nil(t, err)
|
||||
err = os.WriteFile(outputFile, []byte(obtained), 0755)
|
||||
require.Nil(t, err)
|
||||
} else {
|
||||
edits := myers.ComputeEdits(span.URIFromPath(outputFile), string(expected), obtained)
|
||||
if len(edits) > 0 {
|
||||
diff := fmt.Sprint(gotextdiff.ToUnified(
|
||||
outputFile+" (obtained)",
|
||||
outputFile+" (expected)",
|
||||
string(expected),
|
||||
edits,
|
||||
))
|
||||
t.Fatalf("\n" + diff)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
6
lib/codeintel/reprolang/.gitattributes
vendored
6
lib/codeintel/reprolang/.gitattributes
vendored
@ -1,6 +0,0 @@
|
||||
bindings/node/** linguist-generated=true
|
||||
bindings/rust/** linguist-generated=true
|
||||
src/grammar.json linguist-generated=true
|
||||
src/node-types.json linguist-generated=true
|
||||
src/parser.c linguist-generated=true
|
||||
src/tree_sitter/parser.h linguist-generated=true
|
||||
1
lib/codeintel/reprolang/.gitignore
vendored
1
lib/codeintel/reprolang/.gitignore
vendored
@ -1 +0,0 @@
|
||||
build
|
||||
@ -1,26 +0,0 @@
|
||||
[package]
|
||||
name = "tree-sitter-repro-lang"
|
||||
description = "repro-lang grammar for the tree-sitter parsing library"
|
||||
version = "0.0.1"
|
||||
keywords = ["incremental", "parsing", "repro-lang"]
|
||||
categories = ["parsing", "text-editors"]
|
||||
repository = "https://github.com/tree-sitter/tree-sitter-repro-lang"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
||||
build = "bindings/rust/build.rs"
|
||||
include = [
|
||||
"bindings/rust/*",
|
||||
"grammar.js",
|
||||
"queries/*",
|
||||
"src/*",
|
||||
]
|
||||
|
||||
[lib]
|
||||
path = "bindings/rust/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tree-sitter = "~0.20"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
@ -1,19 +0,0 @@
|
||||
{
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "tree_sitter_reprolang_binding",
|
||||
"include_dirs": [
|
||||
"<!(node -e \"require('nan')\")",
|
||||
"src"
|
||||
],
|
||||
"sources": [
|
||||
"bindings/node/binding.cc",
|
||||
"src/parser.c",
|
||||
# If your language uses an external scanner, add it here.
|
||||
],
|
||||
"cflags_c": [
|
||||
"-std=c99",
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
sitter "github.com/smacker/go-tree-sitter"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
)
|
||||
|
||||
type definitionStatement struct {
|
||||
docstring string
|
||||
name *identifier
|
||||
implementsRelation *identifier
|
||||
referencesRelation *identifier
|
||||
typeDefinesRelation *identifier
|
||||
}
|
||||
|
||||
func (s *definitionStatement) relationIdentifiers() []*identifier {
|
||||
return []*identifier{s.implementsRelation, s.referencesRelation, s.typeDefinesRelation}
|
||||
}
|
||||
|
||||
type referenceStatement struct {
|
||||
name *identifier
|
||||
}
|
||||
|
||||
type identifier struct {
|
||||
value string
|
||||
symbol string
|
||||
position *lsiftyped.Range
|
||||
}
|
||||
|
||||
func newIdentifier(s *reproSourceFile, n *sitter.Node) *identifier {
|
||||
if n == nil {
|
||||
return nil
|
||||
}
|
||||
if n.Type() != "identifier" {
|
||||
panic("expected identifier, obtained " + n.Type())
|
||||
}
|
||||
value := s.nodeText(n)
|
||||
globalIdentifier := n.ChildByFieldName("global")
|
||||
if globalIdentifier != nil {
|
||||
projectName := globalIdentifier.ChildByFieldName("project_name")
|
||||
descriptors := globalIdentifier.ChildByFieldName("descriptors")
|
||||
if projectName != nil && descriptors != nil {
|
||||
value = fmt.Sprintf("global %v %v", s.nodeText(projectName), s.nodeText(descriptors))
|
||||
}
|
||||
}
|
||||
return &identifier{
|
||||
value: value,
|
||||
position: NewRangePositionFromNode(n),
|
||||
}
|
||||
}
|
||||
|
||||
func NewRangePositionFromNode(node *sitter.Node) *lsiftyped.Range {
|
||||
return &lsiftyped.Range{
|
||||
Start: lsiftyped.Position{
|
||||
Line: int32(node.StartPoint().Row),
|
||||
Character: int32(node.StartPoint().Column),
|
||||
},
|
||||
End: lsiftyped.Position{
|
||||
Line: int32(node.EndPoint().Row),
|
||||
Character: int32(node.EndPoint().Column),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (i *identifier) resolveSymbol(localScope *reproScope, context *reproContext) {
|
||||
scope := context.globalScope
|
||||
if i.isLocalSymbol() {
|
||||
scope = localScope
|
||||
}
|
||||
symbol, ok := scope.names[i.value]
|
||||
if !ok {
|
||||
symbol = "local ERROR_UNRESOLVED_SYMBOL"
|
||||
}
|
||||
i.symbol = symbol
|
||||
}
|
||||
|
||||
func (i *identifier) isLocalSymbol() bool {
|
||||
return strings.HasPrefix(i.value, "local")
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package golang
|
||||
|
||||
import "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
|
||||
type Dependency struct {
|
||||
Package *lsiftyped.Package
|
||||
Sources []*lsiftyped.SourceFile
|
||||
}
|
||||
|
||||
type reproDependency struct {
|
||||
Package *lsiftyped.Package
|
||||
Sources []*reproSourceFile
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
)
|
||||
|
||||
// Index returns an LSIF Typed index for all of the provided source files, which should use the syntax of
|
||||
// the "reprolang" programming language. Search for files with the `*.repro` file extension to see examples
|
||||
// of how reprolang programs looks like. Search for "grammar.js" to see the tree-sitter grammar of the reprolang syntax.
|
||||
func Index(
|
||||
projectRoot, packageName string,
|
||||
sources []*lsiftyped.SourceFile,
|
||||
dependencies []*Dependency,
|
||||
) (*lsiftyped.Index, error) {
|
||||
index := &lsiftyped.Index{
|
||||
Metadata: &lsiftyped.Metadata{
|
||||
Version: 0,
|
||||
ToolInfo: &lsiftyped.ToolInfo{
|
||||
Name: "reprolang",
|
||||
Version: "1.0.0",
|
||||
Arguments: []string{"arg1", "arg2"},
|
||||
},
|
||||
ProjectRoot: projectRoot,
|
||||
TextDocumentEncoding: lsiftyped.TextEncoding_UTF8,
|
||||
},
|
||||
Documents: nil,
|
||||
ExternalSymbols: nil,
|
||||
}
|
||||
|
||||
ctx := &reproContext{
|
||||
globalScope: newScope(),
|
||||
pkg: &lsiftyped.Package{
|
||||
Manager: "repro-manager",
|
||||
Name: packageName,
|
||||
Version: "1.0.0",
|
||||
},
|
||||
}
|
||||
|
||||
// Phase 1: parse sources
|
||||
var reproSources []*reproSourceFile
|
||||
for _, source := range sources {
|
||||
reproSource, err := parseSourceFile(context.Background(), source)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reproSources = append(reproSources, reproSource)
|
||||
}
|
||||
var reproDependencies []*reproDependency
|
||||
for _, dependency := range dependencies {
|
||||
dep := &reproDependency{Package: dependency.Package}
|
||||
reproDependencies = append(reproDependencies, dep)
|
||||
for _, source := range dependency.Sources {
|
||||
reproSource, err := parseSourceFile(context.Background(), source)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dep.Sources = append(dep.Sources, reproSource)
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: resolve names for definitions
|
||||
for _, dependency := range reproDependencies {
|
||||
dependency.enterGlobalDefinitions(ctx)
|
||||
}
|
||||
for _, file := range reproSources {
|
||||
file.enterDefinitions(ctx)
|
||||
}
|
||||
|
||||
// Phase 3: resolve names for references
|
||||
for _, file := range reproSources {
|
||||
file.resolveReferences(ctx)
|
||||
}
|
||||
|
||||
// Phase 4: emit LSIF Typed
|
||||
for _, file := range reproSources {
|
||||
lsifDocument := &lsiftyped.Document{
|
||||
RelativePath: file.Source.RelativePath,
|
||||
Occurrences: file.occurrences(),
|
||||
Symbols: file.symbols(),
|
||||
}
|
||||
index.Documents = append(index.Documents, lsifDocument)
|
||||
}
|
||||
|
||||
return index, nil
|
||||
}
|
||||
|
||||
type reproContext struct {
|
||||
globalScope *reproScope
|
||||
pkg *lsiftyped.Package
|
||||
}
|
||||
|
||||
type reproScope struct {
|
||||
names map[string]string
|
||||
}
|
||||
|
||||
func newScope() *reproScope {
|
||||
return &reproScope{names: map[string]string{}}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
)
|
||||
|
||||
func (i *identifier) occurrence(roles lsiftyped.SymbolRole) *lsiftyped.Occurrence {
|
||||
return &lsiftyped.Occurrence{
|
||||
Range: i.position.LsifRange(),
|
||||
Symbol: i.symbol,
|
||||
SymbolRoles: int32(roles),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *reproSourceFile) symbols() []*lsiftyped.SymbolInformation {
|
||||
var result []*lsiftyped.SymbolInformation
|
||||
for _, def := range s.definitions {
|
||||
documentation := []string{"signature of " + def.name.value}
|
||||
if def.docstring != "" {
|
||||
documentation = append(documentation, def.docstring)
|
||||
}
|
||||
result = append(result, &lsiftyped.SymbolInformation{
|
||||
Symbol: def.name.symbol,
|
||||
Documentation: documentation,
|
||||
Relationships: def.relationships(),
|
||||
})
|
||||
}
|
||||
// Ensure a stable order of relationships
|
||||
sort.SliceStable(result, func(i, j int) bool {
|
||||
return result[i].Symbol < result[j].Symbol
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *reproSourceFile) occurrences() []*lsiftyped.Occurrence {
|
||||
var result []*lsiftyped.Occurrence
|
||||
for _, def := range s.definitions {
|
||||
result = append(result, def.name.occurrence(lsiftyped.SymbolRole_Definition))
|
||||
for _, ident := range def.relationIdentifiers() {
|
||||
if ident == nil {
|
||||
continue
|
||||
}
|
||||
result = append(result, ident.occurrence(lsiftyped.SymbolRole_UnspecifiedSymbolRole))
|
||||
}
|
||||
}
|
||||
for _, ref := range s.references {
|
||||
result = append(result, ref.name.occurrence(lsiftyped.SymbolRole_UnspecifiedSymbolRole))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *definitionStatement) relationships() []*lsiftyped.Relationship {
|
||||
bySymbol := map[string]*lsiftyped.Relationship{}
|
||||
for _, ident := range s.relationIdentifiers() {
|
||||
if ident == nil {
|
||||
continue
|
||||
}
|
||||
bySymbol[ident.symbol] = &lsiftyped.Relationship{Symbol: ident.symbol}
|
||||
}
|
||||
if s.implementsRelation != nil {
|
||||
bySymbol[s.implementsRelation.symbol].IsImplementation = true
|
||||
}
|
||||
if s.referencesRelation != nil {
|
||||
bySymbol[s.referencesRelation.symbol].IsReference = true
|
||||
}
|
||||
if s.typeDefinesRelation != nil {
|
||||
bySymbol[s.typeDefinesRelation.symbol].IsTypeDefinition = true
|
||||
}
|
||||
var result []*lsiftyped.Relationship
|
||||
for _, value := range bySymbol {
|
||||
result = append(result, value)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
)
|
||||
|
||||
// enterGlobalDefinitions inserts the names of the global symbols that are defined in this
|
||||
// dependency into the provided global scope.
|
||||
func (d *reproDependency) enterGlobalDefinitions(context *reproContext) {
|
||||
for _, file := range d.Sources {
|
||||
for _, definition := range file.definitions {
|
||||
if definition.name.isLocalSymbol() {
|
||||
continue
|
||||
}
|
||||
symbol := newGlobalSymbol(d.Package, file, definition)
|
||||
parsedSymbol, err := lsiftyped.ParseSymbol(symbol)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
name := newGlobalName(context.pkg, parsedSymbol)
|
||||
context.globalScope.names[name] = symbol
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// enterDefinitions inserts the names of the definitions into the appropriate scope (local symbols go into the local scope).
|
||||
func (s *reproSourceFile) enterDefinitions(context *reproContext) {
|
||||
for _, def := range s.definitions {
|
||||
scope := context.globalScope
|
||||
if def.name.isLocalSymbol() {
|
||||
scope = s.localScope
|
||||
}
|
||||
var symbol string
|
||||
if def.name.isLocalSymbol() {
|
||||
symbol = fmt.Sprintf("local %s", def.name.value[len("local"):])
|
||||
} else {
|
||||
symbol = newGlobalSymbol(context.pkg, s, def)
|
||||
}
|
||||
def.name.symbol = symbol
|
||||
scope.names[def.name.value] = symbol
|
||||
}
|
||||
}
|
||||
|
||||
// resolveReferences updates the .symbol field for all names of reference identifiers.
|
||||
func (s *reproSourceFile) resolveReferences(context *reproContext) {
|
||||
for _, def := range s.definitions {
|
||||
for _, ident := range def.relationIdentifiers() {
|
||||
if ident == nil {
|
||||
continue
|
||||
}
|
||||
ident.resolveSymbol(s.localScope, context)
|
||||
}
|
||||
}
|
||||
for _, ref := range s.references {
|
||||
ref.name.resolveSymbol(s.localScope, context)
|
||||
}
|
||||
}
|
||||
|
||||
// newGlobalSymbol returns an LSIF Typed symbol for the given definition.
|
||||
func newGlobalSymbol(pkg *lsiftyped.Package, document *reproSourceFile, definition *definitionStatement) string {
|
||||
return fmt.Sprintf(
|
||||
"reprolang repro_manager %v %v %v/%v",
|
||||
pkg.Name,
|
||||
pkg.Version,
|
||||
document.Source.RelativePath,
|
||||
definition.name.value,
|
||||
)
|
||||
}
|
||||
|
||||
// newGlobalName returns the name of a symbol that is used to query the scope.
|
||||
func newGlobalName(pkg *lsiftyped.Package, symbol *lsiftyped.Symbol) string {
|
||||
formatter := lsiftyped.DescriptorOnlyFormatter
|
||||
formatter.IncludePackageName = func(name string) bool { return name != pkg.Name }
|
||||
return "global " + formatter.FormatSymbol(symbol)
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sitter "github.com/smacker/go-tree-sitter"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
reproGrammar "github.com/sourcegraph/sourcegraph/lib/codeintel/reprolang/src"
|
||||
)
|
||||
|
||||
func parseSourceFile(ctx context.Context, source *lsiftyped.SourceFile) (*reproSourceFile, error) {
|
||||
tree, err := sitter.ParseCtx(ctx, []byte(source.Text), reproGrammar.GetLanguage())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reproSource := newSourceFile(source, tree)
|
||||
reproSource.loadStatements()
|
||||
return reproSource, nil
|
||||
}
|
||||
|
||||
func (s *reproSourceFile) loadStatements() {
|
||||
for i := uint32(0); i < s.node.ChildCount(); i++ {
|
||||
child := s.node.Child(int(i))
|
||||
name := child.ChildByFieldName("name")
|
||||
if name == nil {
|
||||
continue
|
||||
}
|
||||
switch child.Type() {
|
||||
case "definition_statement":
|
||||
docstring := ""
|
||||
docstringNode := child.ChildByFieldName("docstring")
|
||||
if docstringNode != nil {
|
||||
docstring = s.nodeText(docstringNode)[len("# doctring:"):]
|
||||
}
|
||||
statement := &definitionStatement{
|
||||
docstring: docstring,
|
||||
name: newIdentifier(s, child.ChildByFieldName("name")),
|
||||
}
|
||||
for i := uint32(0); i < child.NamedChildCount(); i++ {
|
||||
relation := child.NamedChild(int(i))
|
||||
switch relation.Type() {
|
||||
case "implementation_relation":
|
||||
statement.implementsRelation = newIdentifier(s, relation.ChildByFieldName("name"))
|
||||
case "type_definition_relation":
|
||||
statement.typeDefinesRelation = newIdentifier(s, relation.ChildByFieldName("name"))
|
||||
case "references_relation":
|
||||
statement.referencesRelation = newIdentifier(s, relation.ChildByFieldName("name"))
|
||||
}
|
||||
}
|
||||
s.definitions = append(s.definitions, statement)
|
||||
case "reference_statement":
|
||||
s.references = append(s.references, &referenceStatement{
|
||||
name: newIdentifier(s, child.ChildByFieldName("name")),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package golang
|
||||
|
||||
import (
|
||||
sitter "github.com/smacker/go-tree-sitter"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
)
|
||||
|
||||
type reproSourceFile struct {
|
||||
Source *lsiftyped.SourceFile
|
||||
node *sitter.Node
|
||||
definitions []*definitionStatement
|
||||
references []*referenceStatement
|
||||
localScope *reproScope
|
||||
}
|
||||
|
||||
func newSourceFile(sourceFile *lsiftyped.SourceFile, node *sitter.Node) *reproSourceFile {
|
||||
return &reproSourceFile{
|
||||
Source: sourceFile,
|
||||
node: node,
|
||||
definitions: nil,
|
||||
references: nil,
|
||||
localScope: newScope(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *reproSourceFile) nodeText(n *sitter.Node) string {
|
||||
return s.Source.Text[n.StartByte():n.EndByte()]
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
#include "tree_sitter/parser.h"
|
||||
#include <node.h>
|
||||
#include "nan.h"
|
||||
|
||||
using namespace v8;
|
||||
|
||||
extern "C" TSLanguage * tree_sitter_reprolang();
|
||||
|
||||
namespace {
|
||||
|
||||
NAN_METHOD(New) {}
|
||||
|
||||
void Init(Local<Object> exports, Local<Object> module) {
|
||||
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
|
||||
tpl->SetClassName(Nan::New("Language").ToLocalChecked());
|
||||
tpl->InstanceTemplate()->SetInternalFieldCount(1);
|
||||
|
||||
Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
|
||||
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
|
||||
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_reprolang());
|
||||
|
||||
Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("reprolang").ToLocalChecked());
|
||||
Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
|
||||
}
|
||||
|
||||
NODE_MODULE(tree_sitter_reprolang_binding, Init)
|
||||
|
||||
} // namespace
|
||||
@ -1,19 +0,0 @@
|
||||
try {
|
||||
module.exports = require("../../build/Release/tree_sitter_reprolang_binding");
|
||||
} catch (error1) {
|
||||
if (error1.code !== 'MODULE_NOT_FOUND') {
|
||||
throw error1;
|
||||
}
|
||||
try {
|
||||
module.exports = require("../../build/Debug/tree_sitter_reprolang_binding");
|
||||
} catch (error2) {
|
||||
if (error2.code !== 'MODULE_NOT_FOUND') {
|
||||
throw error2;
|
||||
}
|
||||
throw error1
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
module.exports.nodeTypeInfo = require("../../src/node-types.json");
|
||||
} catch (_) {}
|
||||
@ -1,40 +0,0 @@
|
||||
fn main() {
|
||||
let src_dir = std::path::Path::new("src");
|
||||
|
||||
let mut c_config = cc::Build::new();
|
||||
c_config.include(&src_dir);
|
||||
c_config
|
||||
.flag_if_supported("-Wno-unused-parameter")
|
||||
.flag_if_supported("-Wno-unused-but-set-variable")
|
||||
.flag_if_supported("-Wno-trigraphs");
|
||||
let parser_path = src_dir.join("parser.c");
|
||||
c_config.file(&parser_path);
|
||||
|
||||
// If your language uses an external scanner written in C,
|
||||
// then include this block of code:
|
||||
|
||||
/*
|
||||
let scanner_path = src_dir.join("scanner.c");
|
||||
c_config.file(&scanner_path);
|
||||
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
||||
*/
|
||||
|
||||
c_config.compile("parser");
|
||||
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
|
||||
|
||||
// If your language uses an external scanner written in C++,
|
||||
// then include this block of code:
|
||||
|
||||
/*
|
||||
let mut cpp_config = cc::Build::new();
|
||||
cpp_config.cpp(true);
|
||||
cpp_config.include(&src_dir);
|
||||
cpp_config
|
||||
.flag_if_supported("-Wno-unused-parameter")
|
||||
.flag_if_supported("-Wno-unused-but-set-variable");
|
||||
let scanner_path = src_dir.join("scanner.cc");
|
||||
cpp_config.file(&scanner_path);
|
||||
cpp_config.compile("scanner");
|
||||
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
||||
*/
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
//! This crate provides reprolang language support for the [tree-sitter][] parsing library.
|
||||
//!
|
||||
//! Typically, you will use the [language][language func] function to add this language to a
|
||||
//! tree-sitter [Parser][], and then use the parser to parse some code:
|
||||
//!
|
||||
//! ```
|
||||
//! let code = "";
|
||||
//! let mut parser = tree_sitter::Parser::new();
|
||||
//! parser.set_language(tree_sitter_reprolang::language()).expect("Error loading reprolang grammar");
|
||||
//! let tree = parser.parse(code, None).unwrap();
|
||||
//! ```
|
||||
//!
|
||||
//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
||||
//! [language func]: fn.language.html
|
||||
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
||||
//! [tree-sitter]: https://tree-sitter.github.io/
|
||||
|
||||
use tree_sitter::Language;
|
||||
|
||||
extern "C" {
|
||||
fn tree_sitter_reprolang() -> Language;
|
||||
}
|
||||
|
||||
/// Get the tree-sitter [Language][] for this grammar.
|
||||
///
|
||||
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
||||
pub fn language() -> Language {
|
||||
unsafe { tree_sitter_reprolang() }
|
||||
}
|
||||
|
||||
/// The content of the [`node-types.json`][] file for this grammar.
|
||||
///
|
||||
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
|
||||
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
|
||||
|
||||
// Uncomment these to include any queries that this grammar contains
|
||||
|
||||
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
|
||||
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
|
||||
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
|
||||
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_can_load_grammar() {
|
||||
let mut parser = tree_sitter::Parser::new();
|
||||
parser
|
||||
.set_language(super::language())
|
||||
.expect("Error loading reprolang language");
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
yarn install
|
||||
./node_modules/.bin/tree-sitter generate
|
||||
@ -1,29 +0,0 @@
|
||||
const { setupQunit } = require('@pollyjs/core')
|
||||
|
||||
module.exports = grammar({
|
||||
name: 'reprolang',
|
||||
extras: $ => [/\s+/],
|
||||
word: $ => $.workspace_identifier,
|
||||
|
||||
rules: {
|
||||
source_file: $ => repeat($._statement),
|
||||
_statement: $ => seq(choice($.definition_statement, $.reference_statement, $.comment), '\n'),
|
||||
definition_statement: $ =>
|
||||
seq(
|
||||
field('docstring', optional(seq($.docstring, '\n'))),
|
||||
'definition',
|
||||
field('name', $.identifier),
|
||||
field('roles', repeat($._definition_relations))
|
||||
),
|
||||
reference_statement: $ => seq('reference', field('name', $.identifier)),
|
||||
_definition_relations: $ => choice($.implementation_relation, $.type_definition_relation, $.references_relation),
|
||||
implementation_relation: $ => seq('implements', field('name', $.identifier)),
|
||||
type_definition_relation: $ => seq('type_defines', field('name', $.identifier)),
|
||||
references_relation: $ => seq('references', field('name', $.identifier)),
|
||||
comment: $ => seq('#', /.*/),
|
||||
docstring: $ => seq('# docstring:', /.*/),
|
||||
identifier: $ => choice(field('global', $.global_identifier), field('workspace', $.workspace_identifier)),
|
||||
global_identifier: $ => seq("global", field('project_name', $.workspace_identifier), field('descriptors', $.workspace_identifier)),
|
||||
workspace_identifier: $ => /[^\s]+/,
|
||||
},
|
||||
})
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "reprolang",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "bindings/node",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"nan": "^2.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tree-sitter-cli": "^0.20.4"
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package src
|
||||
|
||||
//#include "tree_sitter/parser.h"
|
||||
//TSLanguage *tree_sitter_reprolang();
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
sitter "github.com/smacker/go-tree-sitter"
|
||||
)
|
||||
|
||||
func GetLanguage() *sitter.Language {
|
||||
ptr := unsafe.Pointer(C.tree_sitter_reprolang())
|
||||
return sitter.NewLanguage(ptr)
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package src
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
sitter "github.com/smacker/go-tree-sitter"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
n, err := sitter.ParseCtx(context.Background(), []byte("definition a implements b\n"), GetLanguage())
|
||||
assert.NoError(err)
|
||||
assert.Equal(
|
||||
"(source_file (definition_statement name: (identifier workspace: (workspace_identifier)) roles: (implementation_relation name: (identifier workspace: (workspace_identifier)))))",
|
||||
n.String(),
|
||||
)
|
||||
}
|
||||
@ -1,265 +0,0 @@
|
||||
{
|
||||
"name": "reprolang",
|
||||
"word": "workspace_identifier",
|
||||
"rules": {
|
||||
"source_file": {
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_statement"
|
||||
}
|
||||
},
|
||||
"_statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "definition_statement"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "reference_statement"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"definition_statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "docstring",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "docstring"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "definition"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "roles",
|
||||
"content": {
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_definition_relations"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"reference_statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "reference"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"_definition_relations": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "implementation_relation"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "type_definition_relation"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "references_relation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"implementation_relation": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "implements"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type_definition_relation": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "type_defines"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"references_relation": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "references"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "#"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": ".*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"docstring": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "# docstring:"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": ".*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"identifier": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "global",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "global_identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "workspace",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "workspace_identifier"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"global_identifier": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "global"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "project_name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "workspace_identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "descriptors",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "workspace_identifier"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"workspace_identifier": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^\\s]+"
|
||||
}
|
||||
},
|
||||
"extras": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s+"
|
||||
}
|
||||
],
|
||||
"conflicts": [],
|
||||
"precedences": [],
|
||||
"externals": [],
|
||||
"inline": [],
|
||||
"supertypes": []
|
||||
}
|
||||
|
||||
@ -1,239 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type": "comment",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "definition_statement",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"docstring": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "\n",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "docstring",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"roles": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "implementation_relation",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "references_relation",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_definition_relation",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "docstring",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "global_identifier",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"descriptors": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "workspace_identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"project_name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "workspace_identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"global": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "global_identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"workspace": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "workspace_identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "implementation_relation",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "reference_statement",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "references_relation",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "source_file",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "definition_statement",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "reference_statement",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "type_definition_relation",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "\n",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "#",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "# docstring:",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "definition",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "global",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "implements",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "reference",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "references",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "type_defines",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "workspace_identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,224 +0,0 @@
|
||||
#ifndef TREE_SITTER_PARSER_H_
|
||||
#define TREE_SITTER_PARSER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ts_builtin_sym_error ((TSSymbol)-1)
|
||||
#define ts_builtin_sym_end 0
|
||||
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||
|
||||
typedef uint16_t TSStateId;
|
||||
|
||||
#ifndef TREE_SITTER_API_H_
|
||||
typedef uint16_t TSSymbol;
|
||||
typedef uint16_t TSFieldId;
|
||||
typedef struct TSLanguage TSLanguage;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
TSFieldId field_id;
|
||||
uint8_t child_index;
|
||||
bool inherited;
|
||||
} TSFieldMapEntry;
|
||||
|
||||
typedef struct {
|
||||
uint16_t index;
|
||||
uint16_t length;
|
||||
} TSFieldMapSlice;
|
||||
|
||||
typedef struct {
|
||||
bool visible;
|
||||
bool named;
|
||||
bool supertype;
|
||||
} TSSymbolMetadata;
|
||||
|
||||
typedef struct TSLexer TSLexer;
|
||||
|
||||
struct TSLexer {
|
||||
int32_t lookahead;
|
||||
TSSymbol result_symbol;
|
||||
void (*advance)(TSLexer *, bool);
|
||||
void (*mark_end)(TSLexer *);
|
||||
uint32_t (*get_column)(TSLexer *);
|
||||
bool (*is_at_included_range_start)(const TSLexer *);
|
||||
bool (*eof)(const TSLexer *);
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
TSParseActionTypeShift,
|
||||
TSParseActionTypeReduce,
|
||||
TSParseActionTypeAccept,
|
||||
TSParseActionTypeRecover,
|
||||
} TSParseActionType;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t type;
|
||||
TSStateId state;
|
||||
bool extra;
|
||||
bool repetition;
|
||||
} shift;
|
||||
struct {
|
||||
uint8_t type;
|
||||
uint8_t child_count;
|
||||
TSSymbol symbol;
|
||||
int16_t dynamic_precedence;
|
||||
uint16_t production_id;
|
||||
} reduce;
|
||||
uint8_t type;
|
||||
} TSParseAction;
|
||||
|
||||
typedef struct {
|
||||
uint16_t lex_state;
|
||||
uint16_t external_lex_state;
|
||||
} TSLexMode;
|
||||
|
||||
typedef union {
|
||||
TSParseAction action;
|
||||
struct {
|
||||
uint8_t count;
|
||||
bool reusable;
|
||||
} entry;
|
||||
} TSParseActionEntry;
|
||||
|
||||
struct TSLanguage {
|
||||
uint32_t version;
|
||||
uint32_t symbol_count;
|
||||
uint32_t alias_count;
|
||||
uint32_t token_count;
|
||||
uint32_t external_token_count;
|
||||
uint32_t state_count;
|
||||
uint32_t large_state_count;
|
||||
uint32_t production_id_count;
|
||||
uint32_t field_count;
|
||||
uint16_t max_alias_sequence_length;
|
||||
const uint16_t *parse_table;
|
||||
const uint16_t *small_parse_table;
|
||||
const uint32_t *small_parse_table_map;
|
||||
const TSParseActionEntry *parse_actions;
|
||||
const char * const *symbol_names;
|
||||
const char * const *field_names;
|
||||
const TSFieldMapSlice *field_map_slices;
|
||||
const TSFieldMapEntry *field_map_entries;
|
||||
const TSSymbolMetadata *symbol_metadata;
|
||||
const TSSymbol *public_symbol_map;
|
||||
const uint16_t *alias_map;
|
||||
const TSSymbol *alias_sequences;
|
||||
const TSLexMode *lex_modes;
|
||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
||||
TSSymbol keyword_capture_token;
|
||||
struct {
|
||||
const bool *states;
|
||||
const TSSymbol *symbol_map;
|
||||
void *(*create)(void);
|
||||
void (*destroy)(void *);
|
||||
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
|
||||
unsigned (*serialize)(void *, char *);
|
||||
void (*deserialize)(void *, const char *, unsigned);
|
||||
} external_scanner;
|
||||
const TSStateId *primary_state_ids;
|
||||
};
|
||||
|
||||
/*
|
||||
* Lexer Macros
|
||||
*/
|
||||
|
||||
#define START_LEXER() \
|
||||
bool result = false; \
|
||||
bool skip = false; \
|
||||
bool eof = false; \
|
||||
int32_t lookahead; \
|
||||
goto start; \
|
||||
next_state: \
|
||||
lexer->advance(lexer, skip); \
|
||||
start: \
|
||||
skip = false; \
|
||||
lookahead = lexer->lookahead;
|
||||
|
||||
#define ADVANCE(state_value) \
|
||||
{ \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
}
|
||||
|
||||
#define SKIP(state_value) \
|
||||
{ \
|
||||
skip = true; \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
}
|
||||
|
||||
#define ACCEPT_TOKEN(symbol_value) \
|
||||
result = true; \
|
||||
lexer->result_symbol = symbol_value; \
|
||||
lexer->mark_end(lexer);
|
||||
|
||||
#define END_STATE() return result;
|
||||
|
||||
/*
|
||||
* Parse Table Macros
|
||||
*/
|
||||
|
||||
#define SMALL_STATE(id) id - LARGE_STATE_COUNT
|
||||
|
||||
#define STATE(id) id
|
||||
|
||||
#define ACTIONS(id) id
|
||||
|
||||
#define SHIFT(state_value) \
|
||||
{{ \
|
||||
.shift = { \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.state = state_value \
|
||||
} \
|
||||
}}
|
||||
|
||||
#define SHIFT_REPEAT(state_value) \
|
||||
{{ \
|
||||
.shift = { \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.state = state_value, \
|
||||
.repetition = true \
|
||||
} \
|
||||
}}
|
||||
|
||||
#define SHIFT_EXTRA() \
|
||||
{{ \
|
||||
.shift = { \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.extra = true \
|
||||
} \
|
||||
}}
|
||||
|
||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
||||
{{ \
|
||||
.reduce = { \
|
||||
.type = TSParseActionTypeReduce, \
|
||||
.symbol = symbol_val, \
|
||||
.child_count = child_count_val, \
|
||||
__VA_ARGS__ \
|
||||
}, \
|
||||
}}
|
||||
|
||||
#define RECOVER() \
|
||||
{{ \
|
||||
.type = TSParseActionTypeRecover \
|
||||
}}
|
||||
|
||||
#define ACCEPT_INPUT() \
|
||||
{{ \
|
||||
.type = TSParseActionTypeAccept \
|
||||
}}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TREE_SITTER_PARSER_H_
|
||||
@ -1,9 +0,0 @@
|
||||
package src
|
||||
|
||||
// This function exists only to make lsif-go succeed
|
||||
// Without this function, lsif-go fails with the error message
|
||||
// error: failed to index: failed to load packages: packages.Load: err: exit status 1: stderr: go build github.com/sourcegraph/sourcegraph/lib/codeintel/reprolang/src: build constraints exclude all Go files in /__w/sourcegraph/sourcegraph/lib/codeintel/reprolang/src
|
||||
// The error appears related to the usage of CGO in the sibling file binding.go https://github.com/golang/go/issues/24068
|
||||
// By adding this file, there exists at least one non-test file in this package that doesn't use CGO.
|
||||
//lint:ignore U1000 This function is intentionally unused
|
||||
func lsifWorkaround() {}
|
||||
@ -1,13 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
nan@^2.15.0:
|
||||
version "2.15.0"
|
||||
resolved "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee"
|
||||
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==
|
||||
|
||||
tree-sitter-cli@^0.20.4:
|
||||
version "0.20.4"
|
||||
resolved "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.4.tgz#4b3fd16c8f1e0870bd428bcc3f2269b75ee97b96"
|
||||
integrity sha512-G42x0Ev7mxA8WLUfZY+two5LIhPf6R/m7qDZtKxOzE77zXi6didNI/vf17kHaKaRXJrWnyCxHFaVQFO2LL81yg==
|
||||
@ -1,55 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader"
|
||||
)
|
||||
|
||||
func printHelpAndExit() {
|
||||
fmt.Println(
|
||||
`usage: lsif-typed [FILE]
|
||||
|
||||
FILE path to a single file that contains a Protobuf-encoded LSIF Typed payload.`,
|
||||
)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) == 1 {
|
||||
printHelpAndExit()
|
||||
}
|
||||
switch os.Args[1] {
|
||||
case "help", "-help", "--help":
|
||||
printHelpAndExit()
|
||||
default:
|
||||
file := os.Args[1]
|
||||
if strings.HasSuffix(file, ".lsif-typed") {
|
||||
data, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
index := lsiftyped.Index{}
|
||||
err = proto.Unmarshal(data, &index)
|
||||
if err != nil {
|
||||
panic(errors.Wrapf(err, "failed to parse protobuf file '%s'", file))
|
||||
}
|
||||
els, err := reader.ConvertTypedIndexToGraphIndex(&index)
|
||||
if err != nil {
|
||||
panic(errors.Wrapf(err, "failed reader.ConvertTypedIndexToGraphIndex"))
|
||||
}
|
||||
err = reader.WriteNDJSON(reader.ElementsToJsonElements(els), os.Stdout)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("unexpected file format (must have extension .lsif-typed): %s\n", file))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped"
|
||||
"github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped/testutil"
|
||||
reproLang "github.com/sourcegraph/sourcegraph/lib/codeintel/reprolang/bindings/golang"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestLsifTypedSnapshots runs all the snapshot tests from the "snapshot-input" directory.
|
||||
func TestLsifTypedSnapshots(t *testing.T) {
|
||||
testutil.SnapshotTest(t, func(inputDirectory, outputDirectory string, sources []*lsiftyped.SourceFile) []*lsiftyped.SourceFile {
|
||||
testName := filepath.Base(inputDirectory)
|
||||
var dependencies []*reproLang.Dependency
|
||||
rootDirectory := filepath.Dir(inputDirectory)
|
||||
dirs, err := os.ReadDir(rootDirectory)
|
||||
require.Nil(t, err)
|
||||
for _, dir := range dirs {
|
||||
if !dir.IsDir() {
|
||||
continue
|
||||
}
|
||||
if dir.Name() == testName {
|
||||
continue
|
||||
}
|
||||
dependencyRoot := filepath.Join(rootDirectory, dir.Name())
|
||||
dependencySources, err := lsiftyped.NewSourcesFromDirectory(dependencyRoot)
|
||||
require.Nil(t, err)
|
||||
dependencies = append(dependencies, &reproLang.Dependency{
|
||||
Package: &lsiftyped.Package{
|
||||
Manager: "repro_manager",
|
||||
Name: dir.Name(),
|
||||
Version: "1.0.0",
|
||||
},
|
||||
Sources: dependencySources,
|
||||
})
|
||||
}
|
||||
index, err := reproLang.Index("file:/"+inputDirectory, testName, sources, dependencies)
|
||||
require.Nil(t, err)
|
||||
symbolFormatter := lsiftyped.DescriptorOnlyFormatter
|
||||
symbolFormatter.IncludePackageName = func(name string) bool { return name != testName }
|
||||
snapshots, err := testutil.FormatSnapshots(index, "#", symbolFormatter)
|
||||
require.Nil(t, err)
|
||||
index.Metadata.ProjectRoot = "file:/root"
|
||||
lsif, err := reader.ConvertTypedIndexToGraphIndex(index)
|
||||
require.Nil(t, err)
|
||||
var obtained bytes.Buffer
|
||||
err = reader.WriteNDJSON(reader.ElementsToJsonElements(lsif), &obtained)
|
||||
require.Nil(t, err)
|
||||
snapshots = append(snapshots, lsiftyped.NewSourceFile(
|
||||
filepath.Join(outputDirectory, "dump.lsif"),
|
||||
"dump.lsif",
|
||||
obtained.String(),
|
||||
))
|
||||
return snapshots
|
||||
})
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
# Test cyclic references between files.
|
||||
definition hello().
|
||||
reference hello().
|
||||
reference hello2().
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Test cyclic references between files.
|
||||
definition hello2().
|
||||
reference hello().
|
||||
reference hello2().
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
definition readFileSync.
|
||||
definition readFileSync.
|
||||
@ -1,3 +0,0 @@
|
||||
# Reference a global symbol from another workspace.
|
||||
reference global global-workspace hello.repro/hello().
|
||||
reference global duplicates duplicate.repro/readFileSync.
|
||||
@ -1,2 +0,0 @@
|
||||
# Test how to implement a symbol from an external workspace.
|
||||
definition bird# implements global implementation animal.repro/animal#
|
||||
@ -1,3 +0,0 @@
|
||||
# Test how to implement a symbol within the same workspace.
|
||||
definition animal#
|
||||
definition dog# implements animal#
|
||||
@ -1,4 +0,0 @@
|
||||
# docstring: local is a local method
|
||||
definition localExample
|
||||
reference localExample
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
reference localExample
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
definition local1
|
||||
definition local2
|
||||
definition local3
|
||||
definition local4 implements local1 references local2 type_defines local3
|
||||
@ -1,2 +0,0 @@
|
||||
definition local1
|
||||
definition local2 references local1
|
||||
@ -1,2 +0,0 @@
|
||||
definition local1
|
||||
definition local2 type_defines local1
|
||||
@ -1,10 +0,0 @@
|
||||
# Test cyclic references between files.
|
||||
definition hello().
|
||||
# ^^^^^^^^ definition cycle1.repro/hello().
|
||||
# documentation signature of hello().
|
||||
reference hello().
|
||||
# ^^^^^^^^ reference cycle1.repro/hello().
|
||||
reference hello2().
|
||||
# ^^^^^^^^^ reference cycle2.repro/hello2().
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
# Test cyclic references between files.
|
||||
definition hello2().
|
||||
# ^^^^^^^^^ definition cycle2.repro/hello2().
|
||||
# documentation signature of hello2().
|
||||
reference hello().
|
||||
# ^^^^^^^^ reference cycle1.repro/hello().
|
||||
reference hello2().
|
||||
# ^^^^^^^^^ reference cycle2.repro/hello2().
|
||||
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"definitionResult"}
|
||||
{"id":3,"type":"vertex","label":"resultSet"}
|
||||
{"id":4,"type":"vertex","label":"referenceResult"}
|
||||
{"id":5,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of hello()."}}}
|
||||
{"id":6,"type":"edge","label":"textDocument/definition","inV":2,"outV":3}
|
||||
{"id":7,"type":"edge","label":"textDocument/references","inV":4,"outV":3}
|
||||
{"id":8,"type":"edge","label":"textDocument/hover","inV":5,"outV":3}
|
||||
{"id":9,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager cyclic-reference 1.0.0 cycle1.repro/hello().","kind":"export","scheme":"reprolang"}
|
||||
{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3}
|
||||
{"id":11,"name":"cyclic-reference","version":"1.0.0","manager":"repro_manager","type":"vertex","label":"packageInformation"}
|
||||
{"id":12,"type":"edge","label":"packageInformation","inV":11,"outV":9}
|
||||
{"id":13,"type":"vertex","label":"definitionResult"}
|
||||
{"id":14,"type":"vertex","label":"resultSet"}
|
||||
{"id":15,"type":"vertex","label":"referenceResult"}
|
||||
{"id":16,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of hello2()."}}}
|
||||
{"id":17,"type":"edge","label":"textDocument/definition","inV":13,"outV":14}
|
||||
{"id":18,"type":"edge","label":"textDocument/references","inV":15,"outV":14}
|
||||
{"id":19,"type":"edge","label":"textDocument/hover","inV":16,"outV":14}
|
||||
{"id":20,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager cyclic-reference 1.0.0 cycle2.repro/hello2().","kind":"export","scheme":"reprolang"}
|
||||
{"id":21,"type":"edge","label":"moniker","inV":20,"outV":14}
|
||||
{"id":22,"type":"edge","label":"packageInformation","inV":11,"outV":20}
|
||||
{"id":23,"type":"vertex","label":"document","uri":"file:/root/cycle1.repro"}
|
||||
{"id":24,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":19}}
|
||||
{"id":25,"type":"edge","label":"next","inV":3,"outV":24}
|
||||
{"id":26,"type":"edge","label":"item","inVs":[24],"outV":2,"document":23}
|
||||
{"id":27,"type":"edge","label":"item","inVs":[24],"outV":4,"document":23}
|
||||
{"id":28,"type":"vertex","label":"range","start":{"line":2,"character":10},"end":{"line":2,"character":18}}
|
||||
{"id":29,"type":"edge","label":"next","inV":3,"outV":28}
|
||||
{"id":30,"type":"edge","label":"item","inVs":[28],"outV":4,"document":23}
|
||||
{"id":31,"type":"vertex","label":"range","start":{"line":3,"character":10},"end":{"line":3,"character":19}}
|
||||
{"id":32,"type":"edge","label":"next","inV":14,"outV":31}
|
||||
{"id":33,"type":"edge","label":"item","inVs":[31],"outV":15,"document":23}
|
||||
{"id":34,"type":"edge","label":"contains","inVs":[24,28,31],"outV":23}
|
||||
{"id":35,"type":"vertex","label":"document","uri":"file:/root/cycle2.repro"}
|
||||
{"id":36,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":20}}
|
||||
{"id":37,"type":"edge","label":"next","inV":14,"outV":36}
|
||||
{"id":38,"type":"edge","label":"item","inVs":[36],"outV":13,"document":35}
|
||||
{"id":39,"type":"edge","label":"item","inVs":[36],"outV":15,"document":35}
|
||||
{"id":40,"type":"vertex","label":"range","start":{"line":2,"character":10},"end":{"line":2,"character":18}}
|
||||
{"id":41,"type":"edge","label":"next","inV":3,"outV":40}
|
||||
{"id":42,"type":"edge","label":"item","inVs":[40],"outV":4,"document":35}
|
||||
{"id":43,"type":"vertex","label":"range","start":{"line":3,"character":10},"end":{"line":3,"character":19}}
|
||||
{"id":44,"type":"edge","label":"next","inV":14,"outV":43}
|
||||
{"id":45,"type":"edge","label":"item","inVs":[43],"outV":15,"document":35}
|
||||
{"id":46,"type":"edge","label":"contains","inVs":[36,40,43],"outV":35}
|
||||
@ -1,22 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"definitionResult"}
|
||||
{"id":3,"type":"vertex","label":"resultSet"}
|
||||
{"id":4,"type":"vertex","label":"referenceResult"}
|
||||
{"id":5,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of readFileSync."}}}
|
||||
{"id":6,"type":"edge","label":"textDocument/definition","inV":2,"outV":3}
|
||||
{"id":7,"type":"edge","label":"textDocument/references","inV":4,"outV":3}
|
||||
{"id":8,"type":"edge","label":"textDocument/hover","inV":5,"outV":3}
|
||||
{"id":9,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager duplicates 1.0.0 duplicate.repro/readFileSync.","kind":"export","scheme":"reprolang"}
|
||||
{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3}
|
||||
{"id":11,"name":"duplicates","version":"1.0.0","manager":"repro_manager","type":"vertex","label":"packageInformation"}
|
||||
{"id":12,"type":"edge","label":"packageInformation","inV":11,"outV":9}
|
||||
{"id":13,"type":"vertex","label":"document","uri":"file:/root/duplicate.repro"}
|
||||
{"id":14,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":24}}
|
||||
{"id":15,"type":"edge","label":"next","inV":3,"outV":14}
|
||||
{"id":16,"type":"edge","label":"item","inVs":[14],"outV":2,"document":13}
|
||||
{"id":17,"type":"edge","label":"item","inVs":[14],"outV":4,"document":13}
|
||||
{"id":18,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":24}}
|
||||
{"id":19,"type":"edge","label":"next","inV":3,"outV":18}
|
||||
{"id":20,"type":"edge","label":"item","inVs":[18],"outV":2,"document":13}
|
||||
{"id":21,"type":"edge","label":"item","inVs":[18],"outV":4,"document":13}
|
||||
{"id":22,"type":"edge","label":"contains","inVs":[14,18],"outV":13}
|
||||
@ -1,7 +0,0 @@
|
||||
definition readFileSync.
|
||||
# ^^^^^^^^^^^^^ definition duplicate.repro/readFileSync.
|
||||
# documentation signature of readFileSync.
|
||||
definition readFileSync.
|
||||
# ^^^^^^^^^^^^^ definition duplicate.repro/readFileSync.
|
||||
# documentation signature of readFileSync.
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"document","uri":"file:/root/reference.repro"}
|
||||
{"id":3,"type":"vertex","label":"range","start":{"line":1,"character":10},"end":{"line":1,"character":54}}
|
||||
{"id":4,"type":"vertex","label":"resultSet"}
|
||||
{"id":5,"type":"vertex","label":"referenceResult"}
|
||||
{"id":6,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}}
|
||||
{"id":7,"type":"edge","label":"textDocument/references","inV":5,"outV":4}
|
||||
{"id":8,"type":"edge","label":"textDocument/hover","inV":6,"outV":4}
|
||||
{"id":9,"type":"vertex","label":"moniker","identifier":"local ERROR_UNRESOLVED_SYMBOL","kind":"import","scheme":"local"}
|
||||
{"id":10,"type":"edge","label":"moniker","inV":9,"outV":4}
|
||||
{"id":11,"type":"edge","label":"next","inV":4,"outV":3}
|
||||
{"id":12,"type":"edge","label":"item","inVs":[3],"outV":5,"document":2}
|
||||
{"id":13,"type":"vertex","label":"range","start":{"line":2,"character":10},"end":{"line":2,"character":57}}
|
||||
{"id":14,"type":"vertex","label":"resultSet"}
|
||||
{"id":15,"type":"vertex","label":"referenceResult"}
|
||||
{"id":16,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}}
|
||||
{"id":17,"type":"edge","label":"textDocument/references","inV":15,"outV":14}
|
||||
{"id":18,"type":"edge","label":"textDocument/hover","inV":16,"outV":14}
|
||||
{"id":19,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager duplicates 1.0.0 duplicate.repro/readFileSync.","kind":"import","scheme":"reprolang"}
|
||||
{"id":20,"type":"edge","label":"moniker","inV":19,"outV":14}
|
||||
{"id":21,"name":"duplicates","version":"1.0.0","manager":"repro_manager","type":"vertex","label":"packageInformation"}
|
||||
{"id":22,"type":"edge","label":"packageInformation","inV":21,"outV":19}
|
||||
{"id":23,"type":"edge","label":"next","inV":14,"outV":13}
|
||||
{"id":24,"type":"edge","label":"item","inVs":[13],"outV":15,"document":2}
|
||||
{"id":25,"type":"edge","label":"contains","inVs":[3,13],"outV":2}
|
||||
@ -1,6 +0,0 @@
|
||||
# Reference a global symbol from another workspace.
|
||||
reference global global-workspace hello.repro/hello().
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference local ERROR_UNRESOLVED_SYMBOL
|
||||
reference global duplicates duplicate.repro/readFileSync.
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference duplicates duplicate.repro/readFileSync.
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
# Test how to implement a symbol from an external workspace.
|
||||
definition bird# implements global implementation animal.repro/animal#
|
||||
# ^^^^^ definition bird.repro/bird#
|
||||
# documentation signature of bird#
|
||||
# relationship implementation animal.repro/animal# implementation
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference implementation animal.repro/animal#
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"definitionResult"}
|
||||
{"id":3,"type":"vertex","label":"resultSet"}
|
||||
{"id":4,"type":"vertex","label":"referenceResult"}
|
||||
{"id":5,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of bird#"}}}
|
||||
{"id":6,"type":"edge","label":"textDocument/definition","inV":2,"outV":3}
|
||||
{"id":7,"type":"edge","label":"textDocument/references","inV":4,"outV":3}
|
||||
{"id":8,"type":"edge","label":"textDocument/hover","inV":5,"outV":3}
|
||||
{"id":9,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager implementation-cross-repo 1.0.0 bird.repro/bird#","kind":"export","scheme":"reprolang"}
|
||||
{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3}
|
||||
{"id":11,"name":"implementation-cross-repo","version":"1.0.0","manager":"repro_manager","type":"vertex","label":"packageInformation"}
|
||||
{"id":12,"type":"edge","label":"packageInformation","inV":11,"outV":9}
|
||||
{"id":13,"type":"vertex","label":"document","uri":"file:/root/bird.repro"}
|
||||
{"id":14,"type":"vertex","label":"resultSet"}
|
||||
{"id":15,"type":"vertex","label":"referenceResult"}
|
||||
{"id":16,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}}
|
||||
{"id":17,"type":"edge","label":"textDocument/references","inV":15,"outV":14}
|
||||
{"id":18,"type":"edge","label":"textDocument/hover","inV":16,"outV":14}
|
||||
{"id":19,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager implementation 1.0.0 animal.repro/animal#","kind":"import","scheme":"reprolang"}
|
||||
{"id":20,"type":"edge","label":"moniker","inV":19,"outV":14}
|
||||
{"id":21,"name":"implementation","version":"1.0.0","manager":"repro_manager","type":"vertex","label":"packageInformation"}
|
||||
{"id":22,"type":"edge","label":"packageInformation","inV":21,"outV":19}
|
||||
{"id":23,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager implementation 1.0.0 animal.repro/animal#","kind":"implementation","scheme":"reprolang"}
|
||||
{"id":24,"type":"edge","label":"moniker","inV":23,"outV":3}
|
||||
{"id":25,"type":"edge","label":"packageInformation","inV":21,"outV":23}
|
||||
{"id":26,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":16}}
|
||||
{"id":27,"type":"edge","label":"next","inV":3,"outV":26}
|
||||
{"id":28,"type":"edge","label":"item","inVs":[26],"outV":2,"document":13}
|
||||
{"id":29,"type":"vertex","label":"implementationResult"}
|
||||
{"id":30,"type":"edge","label":"textDocument/implementation","inV":29,"outV":14}
|
||||
{"id":31,"type":"edge","label":"item","inVs":[26],"outV":29,"document":13}
|
||||
{"id":32,"type":"edge","label":"item","inVs":[26],"outV":4,"document":13}
|
||||
{"id":33,"type":"vertex","label":"range","start":{"line":1,"character":28},"end":{"line":1,"character":70}}
|
||||
{"id":34,"type":"edge","label":"next","inV":14,"outV":33}
|
||||
{"id":35,"type":"edge","label":"item","inVs":[33],"outV":15,"document":13}
|
||||
{"id":36,"type":"edge","label":"contains","inVs":[26,33],"outV":13}
|
||||
@ -1,10 +0,0 @@
|
||||
# Test how to implement a symbol within the same workspace.
|
||||
definition animal#
|
||||
# ^^^^^^^ definition animal.repro/animal#
|
||||
# documentation signature of animal#
|
||||
definition dog# implements animal#
|
||||
# ^^^^ definition animal.repro/dog#
|
||||
# documentation signature of dog#
|
||||
# relationship animal.repro/animal# implementation
|
||||
# ^^^^^^^ reference animal.repro/animal#
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"definitionResult"}
|
||||
{"id":3,"type":"vertex","label":"resultSet"}
|
||||
{"id":4,"type":"vertex","label":"referenceResult"}
|
||||
{"id":5,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of animal#"}}}
|
||||
{"id":6,"type":"edge","label":"textDocument/definition","inV":2,"outV":3}
|
||||
{"id":7,"type":"edge","label":"textDocument/references","inV":4,"outV":3}
|
||||
{"id":8,"type":"edge","label":"textDocument/hover","inV":5,"outV":3}
|
||||
{"id":9,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager implementation 1.0.0 animal.repro/animal#","kind":"export","scheme":"reprolang"}
|
||||
{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3}
|
||||
{"id":11,"name":"implementation","version":"1.0.0","manager":"repro_manager","type":"vertex","label":"packageInformation"}
|
||||
{"id":12,"type":"edge","label":"packageInformation","inV":11,"outV":9}
|
||||
{"id":13,"type":"vertex","label":"definitionResult"}
|
||||
{"id":14,"type":"vertex","label":"resultSet"}
|
||||
{"id":15,"type":"vertex","label":"referenceResult"}
|
||||
{"id":16,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of dog#"}}}
|
||||
{"id":17,"type":"edge","label":"textDocument/definition","inV":13,"outV":14}
|
||||
{"id":18,"type":"edge","label":"textDocument/references","inV":15,"outV":14}
|
||||
{"id":19,"type":"edge","label":"textDocument/hover","inV":16,"outV":14}
|
||||
{"id":20,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager implementation 1.0.0 animal.repro/dog#","kind":"export","scheme":"reprolang"}
|
||||
{"id":21,"type":"edge","label":"moniker","inV":20,"outV":14}
|
||||
{"id":22,"type":"edge","label":"packageInformation","inV":11,"outV":20}
|
||||
{"id":23,"type":"vertex","label":"document","uri":"file:/root/animal.repro"}
|
||||
{"id":24,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":18}}
|
||||
{"id":25,"type":"edge","label":"next","inV":3,"outV":24}
|
||||
{"id":26,"type":"edge","label":"item","inVs":[24],"outV":2,"document":23}
|
||||
{"id":27,"type":"vertex","label":"implementationResult"}
|
||||
{"id":28,"type":"edge","label":"textDocument/implementation","inV":27,"outV":14}
|
||||
{"id":29,"type":"edge","label":"item","inVs":[24],"outV":27,"document":23}
|
||||
{"id":30,"type":"edge","label":"item","inVs":[24],"outV":4,"document":23}
|
||||
{"id":31,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":15}}
|
||||
{"id":32,"type":"edge","label":"next","inV":14,"outV":31}
|
||||
{"id":33,"type":"edge","label":"item","inVs":[31],"outV":13,"document":23}
|
||||
{"id":34,"type":"vertex","label":"implementationResult"}
|
||||
{"id":35,"type":"edge","label":"textDocument/implementation","inV":34,"outV":3}
|
||||
{"id":36,"type":"edge","label":"item","inVs":[31],"outV":34,"document":23}
|
||||
{"id":37,"type":"edge","label":"item","inVs":[31],"outV":15,"document":23}
|
||||
{"id":38,"type":"vertex","label":"range","start":{"line":2,"character":27},"end":{"line":2,"character":34}}
|
||||
{"id":39,"type":"edge","label":"next","inV":3,"outV":38}
|
||||
{"id":40,"type":"edge","label":"item","inVs":[38],"outV":4,"document":23}
|
||||
{"id":41,"type":"edge","label":"contains","inVs":[24,31,38],"outV":23}
|
||||
@ -1,29 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"document","uri":"file:/root/local1.repro"}
|
||||
{"id":3,"type":"vertex","label":"definitionResult"}
|
||||
{"id":4,"type":"vertex","label":"resultSet"}
|
||||
{"id":5,"type":"vertex","label":"referenceResult"}
|
||||
{"id":6,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of localExample\n\n---\n\n: local is a local method"}}}
|
||||
{"id":7,"type":"edge","label":"textDocument/definition","inV":3,"outV":4}
|
||||
{"id":8,"type":"edge","label":"textDocument/references","inV":5,"outV":4}
|
||||
{"id":9,"type":"edge","label":"textDocument/hover","inV":6,"outV":4}
|
||||
{"id":10,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":23}}
|
||||
{"id":11,"type":"edge","label":"next","inV":4,"outV":10}
|
||||
{"id":12,"type":"edge","label":"item","inVs":[10],"outV":3,"document":2}
|
||||
{"id":13,"type":"edge","label":"item","inVs":[10],"outV":5,"document":2}
|
||||
{"id":14,"type":"vertex","label":"range","start":{"line":2,"character":10},"end":{"line":2,"character":22}}
|
||||
{"id":15,"type":"edge","label":"next","inV":4,"outV":14}
|
||||
{"id":16,"type":"edge","label":"item","inVs":[14],"outV":5,"document":2}
|
||||
{"id":17,"type":"edge","label":"contains","inVs":[10,14],"outV":2}
|
||||
{"id":18,"type":"vertex","label":"document","uri":"file:/root/local2.repro"}
|
||||
{"id":19,"type":"vertex","label":"range","start":{"line":0,"character":10},"end":{"line":0,"character":22}}
|
||||
{"id":20,"type":"vertex","label":"resultSet"}
|
||||
{"id":21,"type":"vertex","label":"referenceResult"}
|
||||
{"id":22,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}}
|
||||
{"id":23,"type":"edge","label":"textDocument/references","inV":21,"outV":20}
|
||||
{"id":24,"type":"edge","label":"textDocument/hover","inV":22,"outV":20}
|
||||
{"id":25,"type":"vertex","label":"moniker","identifier":"local ERROR_UNRESOLVED_SYMBOL","kind":"import","scheme":"local"}
|
||||
{"id":26,"type":"edge","label":"moniker","inV":25,"outV":20}
|
||||
{"id":27,"type":"edge","label":"next","inV":20,"outV":19}
|
||||
{"id":28,"type":"edge","label":"item","inVs":[19],"outV":21,"document":18}
|
||||
{"id":29,"type":"edge","label":"contains","inVs":[19],"outV":18}
|
||||
@ -1,9 +0,0 @@
|
||||
# docstring: local is a local method
|
||||
definition localExample
|
||||
# ^^^^^^^^^^^^ definition local Example
|
||||
# documentation signature of localExample
|
||||
# documentation : local is a local method
|
||||
reference localExample
|
||||
# ^^^^^^^^^^^^ reference local Example
|
||||
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
reference localExample
|
||||
# ^^^^^^^^^^^^ reference local ERROR_UNRESOLVED_SYMBOL
|
||||
|
||||
|
||||
@ -1,151 +0,0 @@
|
||||
{"id":1,"version":"0.4.3","projectRoot":"file:/root","positionEncoding":"utf-8","toolInfo":{"name":"reprolang","version":"1.0.0"},"type":"vertex","label":"metaData"}
|
||||
{"id":2,"type":"vertex","label":"document","uri":"file:/root/mixed.repro"}
|
||||
{"id":3,"type":"vertex","label":"definitionResult"}
|
||||
{"id":4,"type":"vertex","label":"resultSet"}
|
||||
{"id":5,"type":"vertex","label":"referenceResult"}
|
||||
{"id":6,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local1"}}}
|
||||
{"id":7,"type":"edge","label":"textDocument/definition","inV":3,"outV":4}
|
||||
{"id":8,"type":"edge","label":"textDocument/references","inV":5,"outV":4}
|
||||
{"id":9,"type":"edge","label":"textDocument/hover","inV":6,"outV":4}
|
||||
{"id":10,"type":"vertex","label":"definitionResult"}
|
||||
{"id":11,"type":"vertex","label":"resultSet"}
|
||||
{"id":12,"type":"vertex","label":"referenceResult"}
|
||||
{"id":13,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local2"}}}
|
||||
{"id":14,"type":"edge","label":"textDocument/definition","inV":10,"outV":11}
|
||||
{"id":15,"type":"edge","label":"textDocument/references","inV":12,"outV":11}
|
||||
{"id":16,"type":"edge","label":"textDocument/hover","inV":13,"outV":11}
|
||||
{"id":17,"type":"vertex","label":"definitionResult"}
|
||||
{"id":18,"type":"vertex","label":"resultSet"}
|
||||
{"id":19,"type":"vertex","label":"referenceResult"}
|
||||
{"id":20,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local3"}}}
|
||||
{"id":21,"type":"edge","label":"textDocument/definition","inV":17,"outV":18}
|
||||
{"id":22,"type":"edge","label":"textDocument/references","inV":19,"outV":18}
|
||||
{"id":23,"type":"edge","label":"textDocument/hover","inV":20,"outV":18}
|
||||
{"id":24,"type":"vertex","label":"definitionResult"}
|
||||
{"id":25,"type":"vertex","label":"resultSet"}
|
||||
{"id":26,"type":"vertex","label":"referenceResult"}
|
||||
{"id":27,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local4"}}}
|
||||
{"id":28,"type":"edge","label":"textDocument/definition","inV":24,"outV":25}
|
||||
{"id":29,"type":"edge","label":"textDocument/references","inV":26,"outV":25}
|
||||
{"id":30,"type":"edge","label":"textDocument/hover","inV":27,"outV":25}
|
||||
{"id":31,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":17}}
|
||||
{"id":32,"type":"edge","label":"next","inV":4,"outV":31}
|
||||
{"id":33,"type":"edge","label":"item","inVs":[31],"outV":3,"document":2}
|
||||
{"id":34,"type":"vertex","label":"implementationResult"}
|
||||
{"id":35,"type":"edge","label":"textDocument/implementation","inV":34,"outV":25}
|
||||
{"id":36,"type":"edge","label":"item","inVs":[31],"outV":34,"document":2}
|
||||
{"id":37,"type":"edge","label":"item","inVs":[31],"outV":12,"document":2}
|
||||
{"id":38,"type":"edge","label":"item","inVs":[12],"outV":5,"document":2}
|
||||
{"id":39,"type":"edge","label":"item","inVs":[31],"outV":5,"document":2}
|
||||
{"id":40,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":17}}
|
||||
{"id":41,"type":"edge","label":"next","inV":11,"outV":40}
|
||||
{"id":42,"type":"edge","label":"item","inVs":[40],"outV":10,"document":2}
|
||||
{"id":43,"type":"edge","label":"item","inVs":[40],"outV":26,"document":2}
|
||||
{"id":44,"type":"edge","label":"item","inVs":[26],"outV":12,"document":2}
|
||||
{"id":45,"type":"edge","label":"item","inVs":[40],"outV":12,"document":2}
|
||||
{"id":46,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":17}}
|
||||
{"id":47,"type":"edge","label":"next","inV":18,"outV":46}
|
||||
{"id":48,"type":"edge","label":"item","inVs":[46],"outV":17,"document":2}
|
||||
{"id":49,"type":"edge","label":"item","inVs":[46],"outV":19,"document":2}
|
||||
{"id":50,"type":"vertex","label":"range","start":{"line":3,"character":11},"end":{"line":3,"character":17}}
|
||||
{"id":51,"type":"edge","label":"next","inV":25,"outV":50}
|
||||
{"id":52,"type":"edge","label":"item","inVs":[50],"outV":24,"document":2}
|
||||
{"id":53,"type":"vertex","label":"implementationResult"}
|
||||
{"id":54,"type":"edge","label":"textDocument/implementation","inV":53,"outV":4}
|
||||
{"id":55,"type":"edge","label":"item","inVs":[50],"outV":53,"document":2}
|
||||
{"id":56,"type":"edge","label":"item","inVs":[50],"outV":12,"document":2}
|
||||
{"id":57,"type":"edge","label":"item","inVs":[12],"outV":26,"document":2}
|
||||
{"id":58,"type":"edge","label":"item","inVs":[50],"outV":26,"document":2}
|
||||
{"id":59,"type":"vertex","label":"range","start":{"line":3,"character":29},"end":{"line":3,"character":35}}
|
||||
{"id":60,"type":"edge","label":"next","inV":4,"outV":59}
|
||||
{"id":61,"type":"edge","label":"item","inVs":[59],"outV":5,"document":2}
|
||||
{"id":62,"type":"vertex","label":"range","start":{"line":3,"character":47},"end":{"line":3,"character":53}}
|
||||
{"id":63,"type":"edge","label":"next","inV":11,"outV":62}
|
||||
{"id":64,"type":"edge","label":"item","inVs":[62],"outV":12,"document":2}
|
||||
{"id":65,"type":"vertex","label":"range","start":{"line":3,"character":67},"end":{"line":3,"character":73}}
|
||||
{"id":66,"type":"edge","label":"next","inV":18,"outV":65}
|
||||
{"id":67,"type":"edge","label":"item","inVs":[65],"outV":19,"document":2}
|
||||
{"id":68,"type":"edge","label":"contains","inVs":[31,40,46,50,59,62,65],"outV":2}
|
||||
{"id":69,"type":"vertex","label":"document","uri":"file:/root/references.repro"}
|
||||
{"id":70,"type":"vertex","label":"definitionResult"}
|
||||
{"id":71,"type":"vertex","label":"resultSet"}
|
||||
{"id":72,"type":"vertex","label":"referenceResult"}
|
||||
{"id":73,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local1"}}}
|
||||
{"id":74,"type":"edge","label":"textDocument/definition","inV":70,"outV":71}
|
||||
{"id":75,"type":"edge","label":"textDocument/references","inV":72,"outV":71}
|
||||
{"id":76,"type":"edge","label":"textDocument/hover","inV":73,"outV":71}
|
||||
{"id":77,"type":"vertex","label":"definitionResult"}
|
||||
{"id":78,"type":"vertex","label":"resultSet"}
|
||||
{"id":79,"type":"vertex","label":"referenceResult"}
|
||||
{"id":80,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local2"}}}
|
||||
{"id":81,"type":"edge","label":"textDocument/definition","inV":77,"outV":78}
|
||||
{"id":82,"type":"edge","label":"textDocument/references","inV":79,"outV":78}
|
||||
{"id":83,"type":"edge","label":"textDocument/hover","inV":80,"outV":78}
|
||||
{"id":84,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":17}}
|
||||
{"id":85,"type":"edge","label":"next","inV":71,"outV":84}
|
||||
{"id":86,"type":"edge","label":"item","inVs":[84],"outV":70,"document":69}
|
||||
{"id":87,"type":"vertex","label":"resultSet"}
|
||||
{"id":88,"type":"vertex","label":"referenceResult"}
|
||||
{"id":89,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}}
|
||||
{"id":90,"type":"edge","label":"textDocument/references","inV":88,"outV":87}
|
||||
{"id":91,"type":"edge","label":"textDocument/hover","inV":89,"outV":87}
|
||||
{"id":92,"type":"vertex","label":"moniker","identifier":"local 4","kind":"import","scheme":"local"}
|
||||
{"id":93,"type":"edge","label":"moniker","inV":92,"outV":87}
|
||||
{"id":94,"type":"vertex","label":"implementationResult"}
|
||||
{"id":95,"type":"edge","label":"textDocument/implementation","inV":94,"outV":87}
|
||||
{"id":96,"type":"edge","label":"item","inVs":[84],"outV":94,"document":69}
|
||||
{"id":97,"type":"edge","label":"item","inVs":[84],"outV":79,"document":69}
|
||||
{"id":98,"type":"edge","label":"item","inVs":[79],"outV":72,"document":69}
|
||||
{"id":99,"type":"edge","label":"item","inVs":[84],"outV":72,"document":69}
|
||||
{"id":100,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":17}}
|
||||
{"id":101,"type":"edge","label":"next","inV":78,"outV":100}
|
||||
{"id":102,"type":"edge","label":"item","inVs":[100],"outV":77,"document":69}
|
||||
{"id":103,"type":"edge","label":"item","inVs":[100],"outV":88,"document":69}
|
||||
{"id":104,"type":"edge","label":"item","inVs":[100],"outV":72,"document":69}
|
||||
{"id":105,"type":"edge","label":"item","inVs":[88,72],"outV":79,"document":69}
|
||||
{"id":106,"type":"edge","label":"item","inVs":[100],"outV":79,"document":69}
|
||||
{"id":107,"type":"vertex","label":"range","start":{"line":1,"character":29},"end":{"line":1,"character":35}}
|
||||
{"id":108,"type":"edge","label":"next","inV":71,"outV":107}
|
||||
{"id":109,"type":"edge","label":"item","inVs":[107],"outV":72,"document":69}
|
||||
{"id":110,"type":"edge","label":"contains","inVs":[84,100,107],"outV":69}
|
||||
{"id":111,"type":"vertex","label":"document","uri":"file:/root/type_defines.repro"}
|
||||
{"id":112,"type":"vertex","label":"definitionResult"}
|
||||
{"id":113,"type":"vertex","label":"resultSet"}
|
||||
{"id":114,"type":"vertex","label":"referenceResult"}
|
||||
{"id":115,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local1"}}}
|
||||
{"id":116,"type":"edge","label":"textDocument/definition","inV":112,"outV":113}
|
||||
{"id":117,"type":"edge","label":"textDocument/references","inV":114,"outV":113}
|
||||
{"id":118,"type":"edge","label":"textDocument/hover","inV":115,"outV":113}
|
||||
{"id":119,"type":"vertex","label":"definitionResult"}
|
||||
{"id":120,"type":"vertex","label":"resultSet"}
|
||||
{"id":121,"type":"vertex","label":"referenceResult"}
|
||||
{"id":122,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local2"}}}
|
||||
{"id":123,"type":"edge","label":"textDocument/definition","inV":119,"outV":120}
|
||||
{"id":124,"type":"edge","label":"textDocument/references","inV":121,"outV":120}
|
||||
{"id":125,"type":"edge","label":"textDocument/hover","inV":122,"outV":120}
|
||||
{"id":126,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":17}}
|
||||
{"id":127,"type":"edge","label":"next","inV":113,"outV":126}
|
||||
{"id":128,"type":"edge","label":"item","inVs":[126],"outV":112,"document":111}
|
||||
{"id":129,"type":"vertex","label":"resultSet"}
|
||||
{"id":130,"type":"vertex","label":"referenceResult"}
|
||||
{"id":131,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}}
|
||||
{"id":132,"type":"edge","label":"textDocument/references","inV":130,"outV":129}
|
||||
{"id":133,"type":"edge","label":"textDocument/hover","inV":131,"outV":129}
|
||||
{"id":134,"type":"vertex","label":"moniker","identifier":"local 4","kind":"import","scheme":"local"}
|
||||
{"id":135,"type":"edge","label":"moniker","inV":134,"outV":129}
|
||||
{"id":136,"type":"vertex","label":"implementationResult"}
|
||||
{"id":137,"type":"edge","label":"textDocument/implementation","inV":136,"outV":129}
|
||||
{"id":138,"type":"edge","label":"item","inVs":[126],"outV":136,"document":111}
|
||||
{"id":139,"type":"edge","label":"item","inVs":[126],"outV":121,"document":111}
|
||||
{"id":140,"type":"edge","label":"item","inVs":[121],"outV":114,"document":111}
|
||||
{"id":141,"type":"edge","label":"item","inVs":[126],"outV":114,"document":111}
|
||||
{"id":142,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":17}}
|
||||
{"id":143,"type":"edge","label":"next","inV":120,"outV":142}
|
||||
{"id":144,"type":"edge","label":"item","inVs":[142],"outV":119,"document":111}
|
||||
{"id":145,"type":"edge","label":"item","inVs":[142],"outV":130,"document":111}
|
||||
{"id":146,"type":"edge","label":"item","inVs":[130],"outV":121,"document":111}
|
||||
{"id":147,"type":"edge","label":"item","inVs":[142],"outV":121,"document":111}
|
||||
{"id":148,"type":"vertex","label":"range","start":{"line":1,"character":31},"end":{"line":1,"character":37}}
|
||||
{"id":149,"type":"edge","label":"next","inV":113,"outV":148}
|
||||
{"id":150,"type":"edge","label":"item","inVs":[148],"outV":114,"document":111}
|
||||
{"id":151,"type":"edge","label":"contains","inVs":[126,142,148],"outV":111}
|
||||
@ -1,19 +0,0 @@
|
||||
definition local1
|
||||
# ^^^^^^ definition local 1
|
||||
# documentation signature of local1
|
||||
definition local2
|
||||
# ^^^^^^ definition local 2
|
||||
# documentation signature of local2
|
||||
definition local3
|
||||
# ^^^^^^ definition local 3
|
||||
# documentation signature of local3
|
||||
definition local4 implements local1 references local2 type_defines local3
|
||||
# ^^^^^^ definition local 4
|
||||
# documentation signature of local4
|
||||
# relationship local 1 implementation
|
||||
# relationship local 2 reference
|
||||
# relationship local 3 type_definition
|
||||
# ^^^^^^ reference local 1
|
||||
# ^^^^^^ reference local 2
|
||||
# ^^^^^^ reference local 3
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
definition local1
|
||||
# ^^^^^^ definition local 1
|
||||
# documentation signature of local1
|
||||
definition local2 references local1
|
||||
# ^^^^^^ definition local 2
|
||||
# documentation signature of local2
|
||||
# relationship local 1 reference
|
||||
# ^^^^^^ reference local 1
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
definition local1
|
||||
# ^^^^^^ definition local 1
|
||||
# documentation signature of local1
|
||||
definition local2 type_defines local1
|
||||
# ^^^^^^ definition local 2
|
||||
# documentation signature of local2
|
||||
# relationship local 1 type_definition
|
||||
# ^^^^^^ reference local 1
|
||||
|
||||
@ -96,7 +96,6 @@
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"lib/codeintel/lsiftyped",
|
||||
"client/*",
|
||||
"client/sandboxes/*"
|
||||
]
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
# Configuration file for https://buf.build/, which we use for Protobuf code generation.
|
||||
version: v1
|
||||
lint:
|
||||
use:
|
||||
- DEFAULT
|
||||
except:
|
||||
- PACKAGE_VERSION_SUFFIX
|
||||
- ENUM_VALUE_PREFIX
|
||||
- ENUM_VALUE_UPPER_SNAKE_CASE
|
||||
- ENUM_ZERO_VALUE_SUFFIX
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
@ -1,3 +0,0 @@
|
||||
package gen
|
||||
|
||||
//go:generate ../dev/proto-generate.sh
|
||||
@ -1,371 +0,0 @@
|
||||
// An index contains one or more pieces of information about a given piece of
|
||||
// source code or software artifact. Complementary information can be merged
|
||||
// together from multiple sources to provide a unified code intelligence
|
||||
// experience.
|
||||
//
|
||||
// Programs producing a file of this format is an "indexer" and may operate
|
||||
// somewhere on the spectrum between precision, such as indexes produced by
|
||||
// compiler-backed indexers, and heurstics, such as indexes produced by local
|
||||
// syntax-directed analysis for scope rules.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package lib.codeintel.lsiftyped;
|
||||
|
||||
option go_package = "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped/";
|
||||
|
||||
// Index represents a complete LSIF 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.
|
||||
message Index {
|
||||
// Metadata about this index.
|
||||
Metadata metadata = 1;
|
||||
// Documents that belong to this index.
|
||||
repeated Document documents = 2;
|
||||
// (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.
|
||||
repeated SymbolInformation external_symbols = 3;
|
||||
}
|
||||
|
||||
message Metadata {
|
||||
// Which version of this protocol was used to generate this index?
|
||||
ProtocolVersion version = 1;
|
||||
// Information about the tool that produced this index.
|
||||
ToolInfo tool_info = 2;
|
||||
// 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.
|
||||
string project_root = 3;
|
||||
// Text encoding of the source files on disk that are referenced from
|
||||
// `Document.relative_path`.
|
||||
TextEncoding text_document_encoding = 4;
|
||||
}
|
||||
|
||||
enum ProtocolVersion {
|
||||
UnspecifiedProtocolVersion = 0;
|
||||
}
|
||||
|
||||
enum TextEncoding {
|
||||
UnspecifiedTextEncoding = 0;
|
||||
UTF8 = 1;
|
||||
UTF16 = 2;
|
||||
}
|
||||
|
||||
message ToolInfo {
|
||||
// Name of the indexer that produced this index.
|
||||
string name = 1;
|
||||
// Version of the indexer that produced this index.
|
||||
string version = 2;
|
||||
// Command-line arguments that were used to invoke this indexer.
|
||||
repeated string arguments = 3;
|
||||
}
|
||||
|
||||
// Document defines the metadata about a source file on disk.
|
||||
message Document {
|
||||
// (Required) Path to the text document relative to the directory supplied in
|
||||
// the associated `Metadata.project_root`. Not URI-encoded. This value should
|
||||
// not begin with a directory separator.
|
||||
string relative_path = 1;
|
||||
// Occurrences that appear in this file.
|
||||
repeated Occurrence occurrences = 2;
|
||||
// Symbols that are defined within this document.
|
||||
repeated SymbolInformation symbols = 3;
|
||||
}
|
||||
|
||||
// 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:
|
||||
// ```
|
||||
// <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> ::= <package> | <type> | <term> | <method> | <type-parameter> | <parameter> | <meta>
|
||||
// <package> ::= <name> '/'
|
||||
// <type> ::= <name> '#'
|
||||
// <term> ::= <name> '.'
|
||||
// <meta> ::= <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.
|
||||
// ```
|
||||
message Symbol {
|
||||
string scheme = 1;
|
||||
Package package = 2;
|
||||
repeated Descriptor descriptors = 3;
|
||||
}
|
||||
|
||||
message Package {
|
||||
string manager = 1;
|
||||
string name = 2;
|
||||
string version = 3;
|
||||
}
|
||||
|
||||
message Descriptor {
|
||||
enum Suffix {
|
||||
UnspecifiedSuffix = 0;
|
||||
Package = 1;
|
||||
Type = 2;
|
||||
Term = 3;
|
||||
Method = 4;
|
||||
TypeParameter = 5;
|
||||
Parameter = 6;
|
||||
// Can be used for any purpose.
|
||||
Meta = 7;
|
||||
Local = 8;
|
||||
}
|
||||
string name = 1;
|
||||
string disambiguator = 2;
|
||||
Suffix suffix = 3;
|
||||
}
|
||||
|
||||
// SymbolInformation defines metadata about a symbol, such as the symbol's
|
||||
// docstring or what package it's defined it.
|
||||
message SymbolInformation {
|
||||
// Identifier of this symbol, which can be referenced from `Occurence.symbol`.
|
||||
// The string must be formatted according to the grammar in `Symbol`.
|
||||
string symbol = 1;
|
||||
// (optional, but strongly recommended) The markdown-formatted documentation
|
||||
// for this symbol. This field is repeated to allow different kinds of
|
||||
// documentation. For example, it's nice to include both the signature of a
|
||||
// method (parameters and return type) along with the accompanying docstring.
|
||||
repeated string documentation = 3;
|
||||
// (optional) Relationships to other symbols (e.g., implements, type definition).
|
||||
repeated Relationship relationships = 4;
|
||||
}
|
||||
|
||||
message Relationship {
|
||||
string symbol = 1;
|
||||
// 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#, implementation_symbols = Animal#
|
||||
// public sound(): string { return "woof" }
|
||||
// ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), implementation_symbols = Animal#sound()
|
||||
// }
|
||||
// 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.
|
||||
bool is_reference = 2;
|
||||
// Similar to `references_symbols` but for "Go to implementation".
|
||||
// It's common for the `implementation_symbols` and `references_symbols` fields
|
||||
// have the same values but that's not always the case.
|
||||
// In the TypeScript example above, observe that `implementation_symbols` has
|
||||
// the value `"Animal#"` for the "Dog#" symbol while `references_symbols` is
|
||||
// empty. When requesting "Find references" on the "Animal#" symbol we don't
|
||||
// want to include references to "Dog#" even if "Go to implementation" on the
|
||||
// "Animal#" symbol should navigate to the "Dog#" symbol.
|
||||
bool is_implementation = 3;
|
||||
// Similar to `references_symbols` but for "Go to type definition".
|
||||
bool is_type_definition = 4;
|
||||
}
|
||||
|
||||
// SymbolRole declares what "role" a symbol has in an occurrence. A role is
|
||||
// encoded as a bitmask 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 psuedo-code, this can be implemented with the
|
||||
// logic: `const isImportRole = (role.value & SymbolRole.Import.value) > 0`.
|
||||
enum SymbolRole {
|
||||
UnspecifiedSymbolRole = 0;
|
||||
// Is the symbol defined here? If not, then this is a symbol reference.
|
||||
Definition = 0x1;
|
||||
// Is the symbol imported here?
|
||||
Import = 0x2;
|
||||
// Is the symbol written here?
|
||||
WriteAccess = 0x4;
|
||||
// Is the symbol read here?
|
||||
ReadAccess = 0x8;
|
||||
// Is the symbol in generated code?
|
||||
Generated = 0x10;
|
||||
// Is the symbol in test code?
|
||||
Test = 0x20;
|
||||
}
|
||||
|
||||
enum SyntaxKind {
|
||||
UnspecifiedSyntaxKind = 0;
|
||||
|
||||
// Comment, including comment markers and text
|
||||
Comment = 1;
|
||||
|
||||
// `;` `.` `,`
|
||||
PunctuationDelimiter = 2;
|
||||
// (), {}, [] when used syntactically
|
||||
PunctuationBracket = 3;
|
||||
|
||||
// `if`, `else`, `return`, `class`, etc.
|
||||
IdentifierKeyword = 4;
|
||||
|
||||
// `+`, `*`, etc.
|
||||
IdentifierOperator = 5;
|
||||
|
||||
// non-specific catch-all for any identifier not better described elsewhere
|
||||
Identifier = 6;
|
||||
// Identifiers builtin to the language: `min`, `print` in Python.
|
||||
IdentifierBuiltin = 7;
|
||||
// Identifiers representing `null`-like values: `None` in Python, `nil` in Go.
|
||||
IdentifierNull = 8;
|
||||
// `xyz` in `const xyz = "hello"`
|
||||
IdentifierConstant = 9;
|
||||
// `var X = "hello"` in Go
|
||||
IdentifierMutableGlobal = 10;
|
||||
// both parameter definition and references
|
||||
IdentifierParameter = 11;
|
||||
// identifiers for variable definitions and references within a local scope
|
||||
IdentifierLocal = 12;
|
||||
// Used when identifier shadowes some other identifier within the scope
|
||||
IdentifierShadowed = 13;
|
||||
// `package main`
|
||||
IdentifierModule = 14;
|
||||
|
||||
// Function call/reference
|
||||
IdentifierFunction = 15;
|
||||
// Function definition only
|
||||
IdentifierFunctionDefinition = 16;
|
||||
|
||||
// Macro call/reference
|
||||
IdentifierMacro = 17;
|
||||
// Macro definition only
|
||||
IdentifierMacroDefinition = 18;
|
||||
|
||||
// non-builtin types, including namespaces
|
||||
IdentifierType = 19;
|
||||
// builtin types only, such as `str` for Python or `int` in Go
|
||||
IdentifierBuiltinType = 20;
|
||||
|
||||
// Python decorators, c-like __attribute__
|
||||
IdentifierAttribute = 21;
|
||||
|
||||
// `\b`
|
||||
RegexEscape = 22;
|
||||
// `*`, `+`
|
||||
RegexRepeated = 23;
|
||||
// `.`
|
||||
RegexWildcard = 24;
|
||||
// `(`, `)`, `[`, `]`
|
||||
RegexDelimiter = 25;
|
||||
// `|`, `-`
|
||||
RegexJoin = 26;
|
||||
|
||||
// Literal strings: "Hello, world!"
|
||||
StringLiteral = 27;
|
||||
// non-regex escapes: "\t", "\n"
|
||||
StringLiteralEscape = 28;
|
||||
// datetimes within strings, special words within a string, `{}` in format strings
|
||||
StringLiteralSpecial = 29;
|
||||
// "key" in { "key": "value" }, useful for example in JSON
|
||||
StringLiteralKey = 30;
|
||||
// 'c' or similar, in languages that differentiate strings and characters
|
||||
CharacterLiteral = 31;
|
||||
// Literal numbers, both floats and integers
|
||||
NumericLiteral = 32;
|
||||
// `true`, `false`
|
||||
BooleanLiteral = 33;
|
||||
|
||||
// Used for XML-like tags
|
||||
Tag = 34;
|
||||
// Attribute name in XML-like tags
|
||||
TagAttribute = 35;
|
||||
// Delimiters for XML-like tags
|
||||
TagDelimiter = 36;
|
||||
}
|
||||
|
||||
// Occurrence associates a source position with a symbol and/or highlighting
|
||||
// information.
|
||||
message Occurrence {
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
repeated int32 range = 1;
|
||||
// (optional) The symbol that appears at this position. See
|
||||
// `SymbolInformation.symbol` for how to format symbols as strings.
|
||||
string symbol = 2;
|
||||
// (optional) Bitmask for what `SymbolRole` apply to this occurrence. See
|
||||
// `SymbolRole` for how to read and write this field.
|
||||
int32 symbol_roles = 3;
|
||||
// (optional) Markdown-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>`).
|
||||
repeated string override_documentation = 4;
|
||||
// (optional) What syntax highlighting class should be used for this range?
|
||||
SyntaxKind syntax_kind = 5;
|
||||
// Diagnostics that have been reported for this specific range.
|
||||
repeated Diagnostic diagnostics = 6;
|
||||
}
|
||||
|
||||
// Represents a diagnostic, such as a compiler error or warning, which should be
|
||||
// reported for a document.
|
||||
message Diagnostic {
|
||||
// Should this diagnostic be reported as an error, warning, info, or hint?
|
||||
Severity severity = 1;
|
||||
// Code of this diagnostic, which might appear in the user interface.
|
||||
string code = 2;
|
||||
// Message of this diagnostic.
|
||||
string message = 3;
|
||||
// Human-readable string describing the source of this diagnostic, e.g.
|
||||
// 'typescript' or 'super lint'.
|
||||
string source = 4;
|
||||
repeated DiagnosticTag tags = 5;
|
||||
}
|
||||
|
||||
enum Severity {
|
||||
UnspecifiedSeverity = 0;
|
||||
Error = 1;
|
||||
Warning = 2;
|
||||
Information = 3;
|
||||
Hint = 4;
|
||||
}
|
||||
|
||||
enum DiagnosticTag {
|
||||
UnspecifiedDiagnosticTag = 0;
|
||||
Unnecessary = 1;
|
||||
Deprecated = 2;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user