diff --git a/.tool-versions b/.tool-versions index 2f437e3f..d2e62088 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ -golang 1.19.10 +golang 1.20.14 nodejs 16.20.2 shellcheck 0.7.1 yarn 1.22.17 diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d5b932..21129642 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # ChangeLog +## Unreleased (-> v0.5.0) + +CLI: + +- Breaking changes: + - Removed SCIP to LSIF conversion functionality + +Go SCIP bindings + +- Breaking changes: + - Removed SCIP to LSIF conversion functionality + ## v0.4.0 SCIP schema: diff --git a/bindings/go/scip/convert.go b/bindings/go/scip/convert.go deleted file mode 100644 index 556134b1..00000000 --- a/bindings/go/scip/convert.go +++ /dev/null @@ -1,542 +0,0 @@ -package scip - -// Originally this was under the sourcegraph/sourcegraph repo -// under lib/codeintel/lsif/protocol/reader/lsif_typed.go. -// -// Moved that code here to avoid a module cycle because of: -// - A dependency on sg/sg/lib/codeintel/lsif/protocol/reader from -// this module. -// - A dependency on this module from sg/sg/lib/codeintel/lsif/protocol/reader -// for the conversion functionality, as it needs access to generated -// Go code for the conversion. - -import ( - "fmt" - "io" - "path/filepath" - "strings" - - "github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol" - "github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader" - "github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/writer" - "github.com/sourcegraph/sourcegraph/lib/errors" -) - -// ConvertSCIPToLSIF takes a SCIP index and returns the equivalent LSIF index. -// There doesn't exist a reliable bijection between SCIP and LSIF. -// -// This conversion is lossy because SCIP includes metadata that has no equivalent encoding in -// LSIF, such as scip.SymbolRole beyond the definition role. -// -// Also, LSIF allows encoding certain behaviors that SCIP current doesn't support, -// such as asymmetric references/definitions. -// -// This conversion functionality is used by src-cli. -func ConvertSCIPToLSIF(index *Index) ([]reader.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 TextEncoding_UTF8: - positionEncoding = "utf-8" - case TextEncoding_UTF16: - positionEncoding = "utf-16" - default: - return nil, errors.New(".Metadata.TextDocumentEncoding does not have value utf-8 or utf-16") - } - - g.emitVertex( - "metaData", - reader.MetaData{ - Version: "0.4.3", // Hardcoded LSIF version. - ProjectRoot: index.Metadata.ProjectRoot, - PositionEncoding: positionEncoding, - ToolInfo: reader.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 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") - } - } - for _, occ := range document.Occurrences { - if !SymbolRole_Definition.Matches(occ) { - continue - } - if IsLocalSymbol(occ.Symbol) { - continue - } - if _, ok := g.symbolToResultSet[occ.Symbol]; ok { - continue - } - g.symbolToResultSet[occ.Symbol] = g.emitResultSet(&SymbolInformation{Symbol: occ.Symbol}, "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 LSIF. -type graph struct { - ID int - Elements []reader.Element - symbolToResultSet map[string]*symbolInformationIDs - inverseRelationships map[string][]*Relationship - packageToGraphID map[string]int -} - -// symbolInformationIDs is a container for LSIF IDs corresponding to an scip.SymbolInformation. -type symbolInformationIDs struct { - ResultSet int - DefinitionResult int - ReferenceResult int - ImplementationResult int - HoverResult int -} - -func newGraph() graph { - return graph{ - ID: 0, - Elements: []reader.Element{}, - symbolToResultSet: map[string]*symbolInformationIDs{}, - packageToGraphID: map[string]int{}, - inverseRelationships: map[string][]*Relationship{}, - } -} - -func (g *graph) emitPackage(pkg *Package) int { - id := pkg.ID() - graphID, ok := g.packageToGraphID[id] - if ok { - return graphID - } - - graphID = g.emitVertex("packageInformation", reader.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 scip.SymbolInformation. -func (g *graph) emitResultSet(info *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 - // directly need to emit this separator directly while with SCIP 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", reader.ResultSet{}), - DefinitionResult: definitionResult, - ReferenceResult: g.emitVertex("referenceResult", nil), - ImplementationResult: -1, - HoverResult: g.emitVertex("hoverResult", hover), - } - if hasDefinition { - g.emitEdge("textDocument/definition", reader.Edge{OutV: ids.ResultSet, InV: ids.DefinitionResult}) - } - g.emitEdge("textDocument/references", reader.Edge{OutV: ids.ResultSet, InV: ids.ReferenceResult}) - g.emitEdge("textDocument/hover", reader.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 `scip.Occurrence` in the provided document, along with -// associated `item` edges to link ranges with result sets. -func (g *graph) emitDocument(index *Index, doc *Document) { - uri := filepath.Join(index.Metadata.ProjectRoot, doc.RelativePath) - documentID := g.emitVertex("document", uri) - - documentSymbolTable := map[string]*SymbolInformation{} - localSymbolInformationTable := map[string]*symbolInformationIDs{} - for _, info := range doc.Symbols { - documentSymbolTable[info.Symbol] = info - - // Build symbol information table for Document-local symbols only. - if 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) - } - } - } - - for _, occ := range doc.Occurrences { - if !SymbolRole_Definition.Matches(occ) { - continue - } - if !IsLocalSymbol(occ.Symbol) { - continue - } - if _, ok := localSymbolInformationTable[occ.Symbol]; ok { - continue - } - localSymbolInformationTable[occ.Symbol] = g.emitResultSet(&SymbolInformation{Symbol: occ.Symbol}, "local") - } - - 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", reader.Edge{OutV: rangeID, InV: resultIDs.ResultSet}) - isDefinition := SymbolRole_Definition.Matches(occ) - if isDefinition && resultIDs.DefinitionResult > 0 { - g.emitEdge("item", reader.Edge{OutV: resultIDs.DefinitionResult, InVs: []int{rangeID}, Document: documentID}) - symbolInfo, ok := documentSymbolTable[occ.Symbol] - if ok { - g.emitRelationships(rangeID, documentID, resultIDs, localSymbolInformationTable, symbolInfo) - } - // Emit definition relationship info here, because we have access to the rangeID - // for this definition, which we don't have if we were to try to emit it - // when emitting it from rel.Symbol. See [NOTE: isDefinition-handling]. - if relationships, ok := g.inverseRelationships[occ.Symbol]; ok { - for _, rel := range relationships { - if rel.IsDefinition { - if ids, ok := g.symbolToResultSet[rel.Symbol]; ok && ids.DefinitionResult > 0 { - g.emitEdge("item", reader.Edge{OutV: ids.DefinitionResult, InVs: []int{rangeID}, Document: documentID}) - } - } - } - } - } - // reference - g.emitEdge("item", reader.Edge{OutV: resultIDs.ReferenceResult, InVs: []int{rangeID}, Document: documentID}) - } - if len(rangeIDs) != 0 { // a document may be empty - g.emitEdge("contains", reader.Edge{OutV: documentID, InVs: rangeIDs}) - } -} - -// emitRelationships emits "referenceResults" and "implementationResult" based on the value of scip.SymbolInformation.Relationships -func (g *graph) emitRelationships(rangeID, documentID int, resultIDs *symbolInformationIDs, localResultIDs map[string]*symbolInformationIDs, info *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", reader.Edge{ - OutV: resultIDs.ReferenceResult, - InVs: allReferenceResultIds, - Document: documentID, - // According to the LSIF spec, the 'property' field is required but it's not present in the reader.Element struct. - // Property: "referenceResults", - }) - } -} - -func (g *graph) emitRelationship(relationship *Relationship, rangeID, documentID int, localResultIDs map[string]*symbolInformationIDs) []int { - relationshipIDs := g.getOrInsertSymbolInformationIDs(relationship.Symbol, localResultIDs) - - var out []int - if relationship.IsImplementation { - if relationshipIDs.ImplementationResult < 0 { - relationshipIDs.ImplementationResult = g.emitVertex("implementationResult", nil) - g.emitEdge("textDocument/implementation", reader.Edge{OutV: relationshipIDs.ResultSet, InV: relationshipIDs.ImplementationResult}) - } - g.emitEdge("item", reader.Edge{OutV: relationshipIDs.ImplementationResult, InVs: []int{rangeID}, Document: documentID}) - } - - if relationship.IsReference { - g.emitEdge("item", reader.Edge{ - OutV: relationshipIDs.ReferenceResult, - InVs: []int{rangeID}, - Document: documentID, - // The 'property' field is included in the LSIF JSON but it's not present in reader.Element - // Property: "referenceResults", - }) - out = append(out, relationshipIDs.ReferenceResult) - } - - // [NOTE: isDefinition-handling] - // We can't emit an edge for relationship.IsDefinition here, - // because we don't have the rangeID for the definition. - - return out -} - -// emitMonikerVertex emits the "moniker" vertex and optionally the accompanying "packageInformation" vertex. -func (g *graph) emitMonikerVertex(symbolID string, kind string, resultSetID int) { - symbol, err := 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 scip.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 "scip-java", "lsif-java": - scheme = "semanticdb" - case "scip-typescript", "lsif-typescript": - scheme = "npm" - } - } - monikerID := g.emitVertex("moniker", reader.Moniker{ - Kind: kind, - Scheme: scheme, - Identifier: symbolID, - }) - g.emitEdge("moniker", reader.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", reader.Edge{OutV: monikerID, InV: packageID}) - } -} - -func (g *graph) emitRange(scipRange []int32) (int, error) { - startLine, startCharacter, endLine, endCharacter, err := interpretSCIPRange(scipRange) - if err != nil { - return 0, err - } - return g.emit("vertex", "range", reader.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 reader.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, reader.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 SCIP via the field `SymbolInformation.Relationships`. -// registerInverseRelationships method records the relationship in the opposite direction: parent->child. -func (g *graph) registerInverseRelationships(info *SymbolInformation) { - for _, relationship := range info.Relationships { - inverseRelationships := g.inverseRelationships[relationship.Symbol] - rel := Relationship{ - Symbol: info.Symbol, - IsReference: relationship.IsReference, - IsImplementation: relationship.IsImplementation, - IsTypeDefinition: relationship.IsTypeDefinition, - IsDefinition: relationship.IsDefinition && IsGlobalSymbol(info.Symbol) && IsGlobalSymbol(relationship.Symbol), - } - if rel.IsReference || rel.IsImplementation || rel.IsTypeDefinition || rel.IsDefinition { - g.inverseRelationships[relationship.Symbol] = append(inverseRelationships, &rel) - } - } -} - -// interpretSCIPRange handles the difference between single-line and multi-line encoding of range positions. -func interpretSCIPRange(scipRange []int32) (startLine, startCharacter, endLine, endCharacter int32, err error) { - if len(scipRange) == 3 { - return scipRange[0], scipRange[1], scipRange[0], scipRange[2], nil - } - if len(scipRange) == 4 { - return scipRange[0], scipRange[1], scipRange[2], scipRange[3], nil - } - return 0, 0, 0, 0, errors.Newf("invalid SCIP range %v", scipRange) -} - -func (g *graph) getOrInsertSymbolInformationIDs(symbol string, localResultSetTable map[string]*symbolInformationIDs) *symbolInformationIDs { - resultSetTable := g.symbolToResultSet - if IsLocalSymbol(symbol) { - resultSetTable = localResultSetTable - } - ids, ok := resultSetTable[symbol] - if !ok { - ids = g.emitResultSet(&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 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 []reader.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.(reader.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.(reader.Range) - object.Start = &rng.Start - object.End = &rng.End - case "metaData": - metaData := el.Payload.(reader.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.(reader.Moniker) - object.Identifier = moniker.Identifier - object.Kind = moniker.Kind - object.Scheme = moniker.Scheme - case "packageInformation": - pkg := el.Payload.(reader.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 -} diff --git a/bindings/go/scip/parse.go b/bindings/go/scip/parse.go index 937655cf..dbed05b0 100644 --- a/bindings/go/scip/parse.go +++ b/bindings/go/scip/parse.go @@ -3,10 +3,9 @@ package scip import ( "io" + "github.com/cockroachdb/errors" "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/proto" - - "github.com/sourcegraph/sourcegraph/lib/errors" ) // IndexVisitor is a struct of functions rather than an interface since Go diff --git a/bindings/go/scip/symbol.go b/bindings/go/scip/symbol.go index 5dd6a2eb..92ac6546 100644 --- a/bindings/go/scip/symbol.go +++ b/bindings/go/scip/symbol.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/sourcegraph/sourcegraph/lib/errors" + "github.com/cockroachdb/errors" ) // IsGlobalSymbol returns true if the symbol is obviously not a local symbol. diff --git a/bindings/go/scip/testutil/format.go b/bindings/go/scip/testutil/format.go index ffd6db78..db2a984b 100644 --- a/bindings/go/scip/testutil/format.go +++ b/bindings/go/scip/testutil/format.go @@ -8,7 +8,7 @@ import ( "sort" "strings" - "github.com/sourcegraph/sourcegraph/lib/errors" + "github.com/cockroachdb/errors" "github.com/sourcegraph/scip/bindings/go/scip" ) diff --git a/cmd/scip/convert.go b/cmd/scip/convert.go deleted file mode 100644 index 0c4f9414..00000000 --- a/cmd/scip/convert.go +++ /dev/null @@ -1,74 +0,0 @@ -package main - -import ( - "io" - "os" - "strings" - - "github.com/urfave/cli/v2" - - "github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader" - "github.com/sourcegraph/sourcegraph/lib/errors" - - "github.com/sourcegraph/scip/bindings/go/scip" -) - -type convertFlags struct { - from string - to string -} - -func convertCommand() cli.Command { - var convertFlags convertFlags - convert := cli.Command{ - Name: "convert", - Usage: "Convert a SCIP index to an LSIF index", - Flags: []cli.Flag{ - fromFlag(&convertFlags.from), - &cli.StringFlag{ - Name: "to", - Usage: "Output path for LSIF index", - Destination: &convertFlags.to, - Value: "dump.lsif", - }, - }, - Action: func(c *cli.Context) error { - return convertMain(convertFlags) - }, - } - return convert -} - -func convertMain(flags convertFlags) error { - scipIndex, err := readFromOption(flags.from) - if err != nil { - return err - } - - var lsifWriter io.Writer - toPath := flags.to - if toPath == "-" { - lsifWriter = os.Stdout - } else if !strings.HasSuffix(toPath, ".lsif") { - return errors.Newf("expected file with .lsif extension but found %s", toPath) - } else { - lsifFile, err := os.OpenFile(toPath, os.O_WRONLY|os.O_CREATE, 0666) - defer lsifFile.Close() - if err != nil { - return err - } - lsifWriter = lsifFile - } - - lsifIndex, err := scip.ConvertSCIPToLSIF(scipIndex) - if err != nil { - return errors.Wrap(err, "failed to convert SCIP index to LSIF index") - } - - err = reader.WriteNDJSON(reader.ElementsToJsonElements(lsifIndex), lsifWriter) - if err != nil { - return errors.Wrapf(err, "failed to write LSIF index to path %s", toPath) - } - - return nil -} diff --git a/cmd/scip/lint.go b/cmd/scip/lint.go index 96d3385d..8c0a0ff0 100644 --- a/cmd/scip/lint.go +++ b/cmd/scip/lint.go @@ -1,6 +1,7 @@ package main import ( + "errors" "fmt" "sort" "strings" @@ -8,7 +9,6 @@ import ( "github.com/urfave/cli/v2" "github.com/sourcegraph/scip/bindings/go/scip" - "github.com/sourcegraph/sourcegraph/lib/errors" ) func lintCommand() cli.Command { @@ -34,10 +34,7 @@ func lintMain(indexPath string) error { if err != nil { return err } - var errOut errors.MultiError - errSet := lintMainPure(scipIndex) - errOut = errors.Append(errOut, errSet.Unique()...) - return errOut + return errors.Join(lintMainPure(scipIndex).data...) } func lintMainPure(scipIndex *scip.Index) errorSet { diff --git a/cmd/scip/main.go b/cmd/scip/main.go index 180afdbd..c4a05e81 100644 --- a/cmd/scip/main.go +++ b/cmd/scip/main.go @@ -19,12 +19,11 @@ func main() { } func commands() []*cli.Command { - convert := convertCommand() lint := lintCommand() print := printCommand() snapshot := snapshotCommand() stats := statsCommand() - return []*cli.Command{&convert, &lint, &print, &snapshot, &stats} + return []*cli.Command{&lint, &print, &snapshot, &stats} } //go:embed version.txt diff --git a/cmd/scip/main_test.go b/cmd/scip/main_test.go index 7100dd5f..981af4c2 100644 --- a/cmd/scip/main_test.go +++ b/cmd/scip/main_test.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "flag" "fmt" "os" @@ -11,8 +10,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader" - "github.com/sourcegraph/scip/bindings/go/scip" "github.com/sourcegraph/scip/bindings/go/scip/testutil" "github.com/sourcegraph/scip/cmd/scip/tests/reprolang/bindings/go/repro" @@ -101,16 +98,6 @@ func TestSCIPSnapshots(t *testing.T) { } else { index.Metadata.ProjectRoot = "file:/root" } - lsif, err := scip.ConvertSCIPToLSIF(index) - require.Nil(t, err) - var obtained bytes.Buffer - err = reader.WriteNDJSON(reader.ElementsToJsonElements(lsif), &obtained) - require.Nil(t, err) - snapshots = append(snapshots, scip.NewSourceFile( - filepath.Join(outputDirectory, "dump.lsif"), - "dump.lsif", - obtained.String(), - )) return snapshots }) } diff --git a/cmd/scip/option_from.go b/cmd/scip/option_from.go index 121d565b..76b23f6d 100644 --- a/cmd/scip/option_from.go +++ b/cmd/scip/option_from.go @@ -5,8 +5,8 @@ import ( "os" "strings" + "github.com/cockroachdb/errors" "github.com/sourcegraph/scip/bindings/go/scip" - "github.com/sourcegraph/sourcegraph/lib/errors" "google.golang.org/protobuf/proto" ) diff --git a/cmd/scip/print.go b/cmd/scip/print.go index a858811d..a9640def 100644 --- a/cmd/scip/print.go +++ b/cmd/scip/print.go @@ -10,7 +10,7 @@ import ( "github.com/urfave/cli/v2" "google.golang.org/protobuf/encoding/protojson" - "github.com/sourcegraph/sourcegraph/lib/errors" + "github.com/cockroachdb/errors" ) func printCommand() cli.Command { diff --git a/cmd/scip/snapshot.go b/cmd/scip/snapshot.go index c9d268f1..73e69c4f 100644 --- a/cmd/scip/snapshot.go +++ b/cmd/scip/snapshot.go @@ -7,9 +7,9 @@ import ( "github.com/urfave/cli/v2" + "github.com/cockroachdb/errors" "github.com/sourcegraph/scip/bindings/go/scip" "github.com/sourcegraph/scip/bindings/go/scip/testutil" - "github.com/sourcegraph/sourcegraph/lib/errors" ) type snapshotFlags struct { diff --git a/cmd/scip/stats.go b/cmd/scip/stats.go index 89e2b9d5..b987acc3 100644 --- a/cmd/scip/stats.go +++ b/cmd/scip/stats.go @@ -13,7 +13,7 @@ import ( "github.com/urfave/cli/v2" "google.golang.org/protobuf/proto" - "github.com/sourcegraph/sourcegraph/lib/errors" + "github.com/cockroachdb/errors" "github.com/sourcegraph/scip/bindings/go/scip" ) diff --git a/cmd/scip/tests/snapshots/output/cyclic-reference/dump.lsif b/cmd/scip/tests/snapshots/output/cyclic-reference/dump.lsif deleted file mode 100755 index 1613bd44..00000000 --- a/cmd/scip/tests/snapshots/output/cyclic-reference/dump.lsif +++ /dev/null @@ -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} diff --git a/cmd/scip/tests/snapshots/output/diagnostics/dump.lsif b/cmd/scip/tests/snapshots/output/diagnostics/dump.lsif deleted file mode 100755 index 526aadc6..00000000 --- a/cmd/scip/tests/snapshots/output/diagnostics/dump.lsif +++ /dev/null @@ -1,21 +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 deprecatedMethod."}}} -{"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 diagnostics 1.0.0 diagnostics.repro/deprecatedMethod.","kind":"export","scheme":"reprolang"} -{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3} -{"id":11,"name":"diagnostics","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/diagnostics.repro"} -{"id":14,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":28}} -{"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":10},"end":{"line":1,"character":27}} -{"id":19,"type":"edge","label":"next","inV":3,"outV":18} -{"id":20,"type":"edge","label":"item","inVs":[18],"outV":4,"document":13} -{"id":21,"type":"edge","label":"contains","inVs":[14,18],"outV":13} diff --git a/cmd/scip/tests/snapshots/output/duplicates/dump.lsif b/cmd/scip/tests/snapshots/output/duplicates/dump.lsif deleted file mode 100755 index dcbe10c7..00000000 --- a/cmd/scip/tests/snapshots/output/duplicates/dump.lsif +++ /dev/null @@ -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} diff --git a/cmd/scip/tests/snapshots/output/forward-def/dump.lsif b/cmd/scip/tests/snapshots/output/forward-def/dump.lsif deleted file mode 100755 index 2fce177a..00000000 --- a/cmd/scip/tests/snapshots/output/forward-def/dump.lsif +++ /dev/null @@ -1,24 +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 abc#"}}} -{"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 forward-def 1.0.0 forward_def.repro/abc#","kind":"export","scheme":"reprolang"} -{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3} -{"id":11,"name":"forward-def","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/forward_def.repro"} -{"id":14,"type":"vertex","label":"range","start":{"line":0,"character":29},"end":{"line":0,"character":33}} -{"id":15,"type":"edge","label":"next","inV":3,"outV":14} -{"id":16,"type":"edge","label":"item","inVs":[14],"outV":4,"document":13} -{"id":17,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":15}} -{"id":18,"type":"edge","label":"next","inV":3,"outV":17} -{"id":19,"type":"edge","label":"item","inVs":[17],"outV":2,"document":13} -{"id":20,"type":"edge","label":"item","inVs":[17],"outV":4,"document":13} -{"id":21,"type":"vertex","label":"range","start":{"line":2,"character":10},"end":{"line":2,"character":14}} -{"id":22,"type":"edge","label":"next","inV":3,"outV":21} -{"id":23,"type":"edge","label":"item","inVs":[21],"outV":4,"document":13} -{"id":24,"type":"edge","label":"contains","inVs":[14,17,21],"outV":13} diff --git a/cmd/scip/tests/snapshots/output/global-cross-repo/dump.lsif b/cmd/scip/tests/snapshots/output/global-cross-repo/dump.lsif deleted file mode 100755 index 4bdd2f3c..00000000 --- a/cmd/scip/tests/snapshots/output/global-cross-repo/dump.lsif +++ /dev/null @@ -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} diff --git a/cmd/scip/tests/snapshots/output/implementation-cross-repo/dump.lsif b/cmd/scip/tests/snapshots/output/implementation-cross-repo/dump.lsif deleted file mode 100755 index 9bc8f6be..00000000 --- a/cmd/scip/tests/snapshots/output/implementation-cross-repo/dump.lsif +++ /dev/null @@ -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} diff --git a/cmd/scip/tests/snapshots/output/implementation/dump.lsif b/cmd/scip/tests/snapshots/output/implementation/dump.lsif deleted file mode 100755 index dee434df..00000000 --- a/cmd/scip/tests/snapshots/output/implementation/dump.lsif +++ /dev/null @@ -1,62 +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 cat#"}}} -{"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/cat#","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":"definitionResult"} -{"id":24,"type":"vertex","label":"resultSet"} -{"id":25,"type":"vertex","label":"referenceResult"} -{"id":26,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of dog#"}}} -{"id":27,"type":"edge","label":"textDocument/definition","inV":23,"outV":24} -{"id":28,"type":"edge","label":"textDocument/references","inV":25,"outV":24} -{"id":29,"type":"edge","label":"textDocument/hover","inV":26,"outV":24} -{"id":30,"type":"vertex","label":"moniker","identifier":"reprolang repro_manager implementation 1.0.0 animal.repro/dog#","kind":"export","scheme":"reprolang"} -{"id":31,"type":"edge","label":"moniker","inV":30,"outV":24} -{"id":32,"type":"edge","label":"packageInformation","inV":11,"outV":30} -{"id":33,"type":"vertex","label":"document","uri":"file:/root/animal.repro"} -{"id":34,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":18}} -{"id":35,"type":"edge","label":"next","inV":3,"outV":34} -{"id":36,"type":"edge","label":"item","inVs":[34],"outV":2,"document":33} -{"id":37,"type":"vertex","label":"implementationResult"} -{"id":38,"type":"edge","label":"textDocument/implementation","inV":37,"outV":14} -{"id":39,"type":"edge","label":"item","inVs":[34],"outV":37,"document":33} -{"id":40,"type":"vertex","label":"implementationResult"} -{"id":41,"type":"edge","label":"textDocument/implementation","inV":40,"outV":24} -{"id":42,"type":"edge","label":"item","inVs":[34],"outV":40,"document":33} -{"id":43,"type":"edge","label":"item","inVs":[34],"outV":4,"document":33} -{"id":44,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":15}} -{"id":45,"type":"edge","label":"next","inV":24,"outV":44} -{"id":46,"type":"edge","label":"item","inVs":[44],"outV":23,"document":33} -{"id":47,"type":"vertex","label":"implementationResult"} -{"id":48,"type":"edge","label":"textDocument/implementation","inV":47,"outV":3} -{"id":49,"type":"edge","label":"item","inVs":[44],"outV":47,"document":33} -{"id":50,"type":"edge","label":"item","inVs":[44],"outV":25,"document":33} -{"id":51,"type":"vertex","label":"range","start":{"line":2,"character":27},"end":{"line":2,"character":34}} -{"id":52,"type":"edge","label":"next","inV":3,"outV":51} -{"id":53,"type":"edge","label":"item","inVs":[51],"outV":4,"document":33} -{"id":54,"type":"vertex","label":"range","start":{"line":3,"character":11},"end":{"line":3,"character":15}} -{"id":55,"type":"edge","label":"next","inV":14,"outV":54} -{"id":56,"type":"edge","label":"item","inVs":[54],"outV":13,"document":33} -{"id":57,"type":"edge","label":"item","inVs":[54],"outV":47,"document":33} -{"id":58,"type":"edge","label":"item","inVs":[54],"outV":15,"document":33} -{"id":59,"type":"vertex","label":"range","start":{"line":3,"character":27},"end":{"line":3,"character":34}} -{"id":60,"type":"edge","label":"next","inV":3,"outV":59} -{"id":61,"type":"edge","label":"item","inVs":[59],"outV":4,"document":33} -{"id":62,"type":"edge","label":"contains","inVs":[34,44,51,54,59],"outV":33} diff --git a/cmd/scip/tests/snapshots/output/local-document/dump.lsif b/cmd/scip/tests/snapshots/output/local-document/dump.lsif deleted file mode 100755 index dcc3bd68..00000000 --- a/cmd/scip/tests/snapshots/output/local-document/dump.lsif +++ /dev/null @@ -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} diff --git a/cmd/scip/tests/snapshots/output/missing-symbol-information/dump.lsif b/cmd/scip/tests/snapshots/output/missing-symbol-information/dump.lsif deleted file mode 100755 index 86bbe696..00000000 --- a/cmd/scip/tests/snapshots/output/missing-symbol-information/dump.lsif +++ /dev/null @@ -1,37 +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"}}} -{"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 missing-symbol-information 1.0.0 globals.repro/NoSymbolInformation#","kind":"export","scheme":"reprolang"} -{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3} -{"id":11,"name":"missing-symbol-information","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/globals.repro"} -{"id":14,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":31}} -{"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":10},"end":{"line":1,"character":30}} -{"id":19,"type":"edge","label":"next","inV":3,"outV":18} -{"id":20,"type":"edge","label":"item","inVs":[18],"outV":4,"document":13} -{"id":21,"type":"edge","label":"contains","inVs":[14,18],"outV":13} -{"id":22,"type":"vertex","label":"document","uri":"file:/root/locals.repro"} -{"id":23,"type":"vertex","label":"definitionResult"} -{"id":24,"type":"vertex","label":"resultSet"} -{"id":25,"type":"vertex","label":"referenceResult"} -{"id":26,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}} -{"id":27,"type":"edge","label":"textDocument/definition","inV":23,"outV":24} -{"id":28,"type":"edge","label":"textDocument/references","inV":25,"outV":24} -{"id":29,"type":"edge","label":"textDocument/hover","inV":26,"outV":24} -{"id":30,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":35}} -{"id":31,"type":"edge","label":"next","inV":24,"outV":30} -{"id":32,"type":"edge","label":"item","inVs":[30],"outV":23,"document":22} -{"id":33,"type":"edge","label":"item","inVs":[30],"outV":25,"document":22} -{"id":34,"type":"vertex","label":"range","start":{"line":1,"character":10},"end":{"line":1,"character":34}} -{"id":35,"type":"edge","label":"next","inV":24,"outV":34} -{"id":36,"type":"edge","label":"item","inVs":[34],"outV":25,"document":22} -{"id":37,"type":"edge","label":"contains","inVs":[30,34],"outV":22} diff --git a/cmd/scip/tests/snapshots/output/relationships/dump.lsif b/cmd/scip/tests/snapshots/output/relationships/dump.lsif deleted file mode 100755 index 18f70658..00000000 --- a/cmd/scip/tests/snapshots/output/relationships/dump.lsif +++ /dev/null @@ -1,194 +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"}}} -{"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 relationships 1.0.0 defined_by.repro/C1_f.","kind":"export","scheme":"reprolang"} -{"id":10,"type":"edge","label":"moniker","inV":9,"outV":3} -{"id":11,"name":"relationships","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 M_f."}}} -{"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 relationships 1.0.0 defined_by.repro/M_f.","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/defined_by.repro"} -{"id":24,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":15}} -{"id":25,"type":"edge","label":"next","inV":14,"outV":24} -{"id":26,"type":"edge","label":"item","inVs":[24],"outV":13,"document":23} -{"id":27,"type":"edge","label":"item","inVs":[24],"outV":4,"document":23} -{"id":28,"type":"edge","label":"item","inVs":[4],"outV":15,"document":23} -{"id":29,"type":"edge","label":"item","inVs":[24],"outV":15,"document":23} -{"id":30,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":16}} -{"id":31,"type":"edge","label":"next","inV":3,"outV":30} -{"id":32,"type":"edge","label":"item","inVs":[30],"outV":2,"document":23} -{"id":33,"type":"edge","label":"item","inVs":[30],"outV":2,"document":23} -{"id":34,"type":"edge","label":"item","inVs":[30],"outV":4,"document":23} -{"id":35,"type":"vertex","label":"range","start":{"line":4,"character":10},"end":{"line":4,"character":15}} -{"id":36,"type":"edge","label":"next","inV":3,"outV":35} -{"id":37,"type":"edge","label":"item","inVs":[35],"outV":4,"document":23} -{"id":38,"type":"vertex","label":"range","start":{"line":6,"character":31},"end":{"line":6,"character":36}} -{"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":"vertex","label":"range","start":{"line":6,"character":48},"end":{"line":6,"character":52}} -{"id":42,"type":"edge","label":"next","inV":14,"outV":41} -{"id":43,"type":"edge","label":"item","inVs":[41],"outV":15,"document":23} -{"id":44,"type":"edge","label":"contains","inVs":[24,30,35,38,41],"outV":23} -{"id":45,"type":"vertex","label":"document","uri":"file:/root/mixed.repro"} -{"id":46,"type":"vertex","label":"definitionResult"} -{"id":47,"type":"vertex","label":"resultSet"} -{"id":48,"type":"vertex","label":"referenceResult"} -{"id":49,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local1"}}} -{"id":50,"type":"edge","label":"textDocument/definition","inV":46,"outV":47} -{"id":51,"type":"edge","label":"textDocument/references","inV":48,"outV":47} -{"id":52,"type":"edge","label":"textDocument/hover","inV":49,"outV":47} -{"id":53,"type":"vertex","label":"definitionResult"} -{"id":54,"type":"vertex","label":"resultSet"} -{"id":55,"type":"vertex","label":"referenceResult"} -{"id":56,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local2"}}} -{"id":57,"type":"edge","label":"textDocument/definition","inV":53,"outV":54} -{"id":58,"type":"edge","label":"textDocument/references","inV":55,"outV":54} -{"id":59,"type":"edge","label":"textDocument/hover","inV":56,"outV":54} -{"id":60,"type":"vertex","label":"definitionResult"} -{"id":61,"type":"vertex","label":"resultSet"} -{"id":62,"type":"vertex","label":"referenceResult"} -{"id":63,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local3"}}} -{"id":64,"type":"edge","label":"textDocument/definition","inV":60,"outV":61} -{"id":65,"type":"edge","label":"textDocument/references","inV":62,"outV":61} -{"id":66,"type":"edge","label":"textDocument/hover","inV":63,"outV":61} -{"id":67,"type":"vertex","label":"definitionResult"} -{"id":68,"type":"vertex","label":"resultSet"} -{"id":69,"type":"vertex","label":"referenceResult"} -{"id":70,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local4"}}} -{"id":71,"type":"edge","label":"textDocument/definition","inV":67,"outV":68} -{"id":72,"type":"edge","label":"textDocument/references","inV":69,"outV":68} -{"id":73,"type":"edge","label":"textDocument/hover","inV":70,"outV":68} -{"id":74,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":17}} -{"id":75,"type":"edge","label":"next","inV":47,"outV":74} -{"id":76,"type":"edge","label":"item","inVs":[74],"outV":46,"document":45} -{"id":77,"type":"vertex","label":"implementationResult"} -{"id":78,"type":"edge","label":"textDocument/implementation","inV":77,"outV":68} -{"id":79,"type":"edge","label":"item","inVs":[74],"outV":77,"document":45} -{"id":80,"type":"edge","label":"item","inVs":[74],"outV":55,"document":45} -{"id":81,"type":"edge","label":"item","inVs":[55],"outV":48,"document":45} -{"id":82,"type":"edge","label":"item","inVs":[74],"outV":48,"document":45} -{"id":83,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":17}} -{"id":84,"type":"edge","label":"next","inV":54,"outV":83} -{"id":85,"type":"edge","label":"item","inVs":[83],"outV":53,"document":45} -{"id":86,"type":"edge","label":"item","inVs":[83],"outV":69,"document":45} -{"id":87,"type":"edge","label":"item","inVs":[69],"outV":55,"document":45} -{"id":88,"type":"edge","label":"item","inVs":[83],"outV":55,"document":45} -{"id":89,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":17}} -{"id":90,"type":"edge","label":"next","inV":61,"outV":89} -{"id":91,"type":"edge","label":"item","inVs":[89],"outV":60,"document":45} -{"id":92,"type":"edge","label":"item","inVs":[89],"outV":62,"document":45} -{"id":93,"type":"vertex","label":"range","start":{"line":3,"character":11},"end":{"line":3,"character":17}} -{"id":94,"type":"edge","label":"next","inV":68,"outV":93} -{"id":95,"type":"edge","label":"item","inVs":[93],"outV":67,"document":45} -{"id":96,"type":"vertex","label":"implementationResult"} -{"id":97,"type":"edge","label":"textDocument/implementation","inV":96,"outV":47} -{"id":98,"type":"edge","label":"item","inVs":[93],"outV":96,"document":45} -{"id":99,"type":"edge","label":"item","inVs":[93],"outV":55,"document":45} -{"id":100,"type":"edge","label":"item","inVs":[55],"outV":69,"document":45} -{"id":101,"type":"edge","label":"item","inVs":[93],"outV":69,"document":45} -{"id":102,"type":"vertex","label":"range","start":{"line":3,"character":29},"end":{"line":3,"character":35}} -{"id":103,"type":"edge","label":"next","inV":47,"outV":102} -{"id":104,"type":"edge","label":"item","inVs":[102],"outV":48,"document":45} -{"id":105,"type":"vertex","label":"range","start":{"line":3,"character":47},"end":{"line":3,"character":53}} -{"id":106,"type":"edge","label":"next","inV":54,"outV":105} -{"id":107,"type":"edge","label":"item","inVs":[105],"outV":55,"document":45} -{"id":108,"type":"vertex","label":"range","start":{"line":3,"character":67},"end":{"line":3,"character":73}} -{"id":109,"type":"edge","label":"next","inV":61,"outV":108} -{"id":110,"type":"edge","label":"item","inVs":[108],"outV":62,"document":45} -{"id":111,"type":"edge","label":"contains","inVs":[74,83,89,93,102,105,108],"outV":45} -{"id":112,"type":"vertex","label":"document","uri":"file:/root/references.repro"} -{"id":113,"type":"vertex","label":"definitionResult"} -{"id":114,"type":"vertex","label":"resultSet"} -{"id":115,"type":"vertex","label":"referenceResult"} -{"id":116,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local1"}}} -{"id":117,"type":"edge","label":"textDocument/definition","inV":113,"outV":114} -{"id":118,"type":"edge","label":"textDocument/references","inV":115,"outV":114} -{"id":119,"type":"edge","label":"textDocument/hover","inV":116,"outV":114} -{"id":120,"type":"vertex","label":"definitionResult"} -{"id":121,"type":"vertex","label":"resultSet"} -{"id":122,"type":"vertex","label":"referenceResult"} -{"id":123,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local2"}}} -{"id":124,"type":"edge","label":"textDocument/definition","inV":120,"outV":121} -{"id":125,"type":"edge","label":"textDocument/references","inV":122,"outV":121} -{"id":126,"type":"edge","label":"textDocument/hover","inV":123,"outV":121} -{"id":127,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":17}} -{"id":128,"type":"edge","label":"next","inV":114,"outV":127} -{"id":129,"type":"edge","label":"item","inVs":[127],"outV":113,"document":112} -{"id":130,"type":"vertex","label":"resultSet"} -{"id":131,"type":"vertex","label":"referenceResult"} -{"id":132,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}} -{"id":133,"type":"edge","label":"textDocument/references","inV":131,"outV":130} -{"id":134,"type":"edge","label":"textDocument/hover","inV":132,"outV":130} -{"id":135,"type":"vertex","label":"moniker","identifier":"local 4","kind":"import","scheme":"local"} -{"id":136,"type":"edge","label":"moniker","inV":135,"outV":130} -{"id":137,"type":"vertex","label":"implementationResult"} -{"id":138,"type":"edge","label":"textDocument/implementation","inV":137,"outV":130} -{"id":139,"type":"edge","label":"item","inVs":[127],"outV":137,"document":112} -{"id":140,"type":"edge","label":"item","inVs":[127],"outV":122,"document":112} -{"id":141,"type":"edge","label":"item","inVs":[122],"outV":115,"document":112} -{"id":142,"type":"edge","label":"item","inVs":[127],"outV":115,"document":112} -{"id":143,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":17}} -{"id":144,"type":"edge","label":"next","inV":121,"outV":143} -{"id":145,"type":"edge","label":"item","inVs":[143],"outV":120,"document":112} -{"id":146,"type":"edge","label":"item","inVs":[143],"outV":131,"document":112} -{"id":147,"type":"edge","label":"item","inVs":[143],"outV":115,"document":112} -{"id":148,"type":"edge","label":"item","inVs":[131,115],"outV":122,"document":112} -{"id":149,"type":"edge","label":"item","inVs":[143],"outV":122,"document":112} -{"id":150,"type":"vertex","label":"range","start":{"line":1,"character":29},"end":{"line":1,"character":35}} -{"id":151,"type":"edge","label":"next","inV":114,"outV":150} -{"id":152,"type":"edge","label":"item","inVs":[150],"outV":115,"document":112} -{"id":153,"type":"edge","label":"contains","inVs":[127,143,150],"outV":112} -{"id":154,"type":"vertex","label":"document","uri":"file:/root/type_defines.repro"} -{"id":155,"type":"vertex","label":"definitionResult"} -{"id":156,"type":"vertex","label":"resultSet"} -{"id":157,"type":"vertex","label":"referenceResult"} -{"id":158,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local1"}}} -{"id":159,"type":"edge","label":"textDocument/definition","inV":155,"outV":156} -{"id":160,"type":"edge","label":"textDocument/references","inV":157,"outV":156} -{"id":161,"type":"edge","label":"textDocument/hover","inV":158,"outV":156} -{"id":162,"type":"vertex","label":"definitionResult"} -{"id":163,"type":"vertex","label":"resultSet"} -{"id":164,"type":"vertex","label":"referenceResult"} -{"id":165,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown","value":"signature of local2"}}} -{"id":166,"type":"edge","label":"textDocument/definition","inV":162,"outV":163} -{"id":167,"type":"edge","label":"textDocument/references","inV":164,"outV":163} -{"id":168,"type":"edge","label":"textDocument/hover","inV":165,"outV":163} -{"id":169,"type":"vertex","label":"range","start":{"line":0,"character":11},"end":{"line":0,"character":17}} -{"id":170,"type":"edge","label":"next","inV":156,"outV":169} -{"id":171,"type":"edge","label":"item","inVs":[169],"outV":155,"document":154} -{"id":172,"type":"vertex","label":"resultSet"} -{"id":173,"type":"vertex","label":"referenceResult"} -{"id":174,"type":"vertex","label":"hoverResult","result":{"contents":{"kind":"markdown"}}} -{"id":175,"type":"edge","label":"textDocument/references","inV":173,"outV":172} -{"id":176,"type":"edge","label":"textDocument/hover","inV":174,"outV":172} -{"id":177,"type":"vertex","label":"moniker","identifier":"local 4","kind":"import","scheme":"local"} -{"id":178,"type":"edge","label":"moniker","inV":177,"outV":172} -{"id":179,"type":"vertex","label":"implementationResult"} -{"id":180,"type":"edge","label":"textDocument/implementation","inV":179,"outV":172} -{"id":181,"type":"edge","label":"item","inVs":[169],"outV":179,"document":154} -{"id":182,"type":"edge","label":"item","inVs":[169],"outV":164,"document":154} -{"id":183,"type":"edge","label":"item","inVs":[164],"outV":157,"document":154} -{"id":184,"type":"edge","label":"item","inVs":[169],"outV":157,"document":154} -{"id":185,"type":"vertex","label":"range","start":{"line":1,"character":11},"end":{"line":1,"character":17}} -{"id":186,"type":"edge","label":"next","inV":163,"outV":185} -{"id":187,"type":"edge","label":"item","inVs":[185],"outV":162,"document":154} -{"id":188,"type":"edge","label":"item","inVs":[185],"outV":173,"document":154} -{"id":189,"type":"edge","label":"item","inVs":[173],"outV":164,"document":154} -{"id":190,"type":"edge","label":"item","inVs":[185],"outV":164,"document":154} -{"id":191,"type":"vertex","label":"range","start":{"line":1,"character":31},"end":{"line":1,"character":37}} -{"id":192,"type":"edge","label":"next","inV":156,"outV":191} -{"id":193,"type":"edge","label":"item","inVs":[191],"outV":157,"document":154} -{"id":194,"type":"edge","label":"contains","inVs":[169,185,191],"outV":154} diff --git a/docs/CLI.md b/docs/CLI.md index 56dd492e..5cd50e16 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -3,7 +3,6 @@ - [SCIP CLI Reference](#scip-cli-reference) - - [`scip convert`](#scip-convert) - [`scip lint`](#scip-lint) - [`scip print`](#scip-print) - [`scip snapshot`](#scip-snapshot) @@ -26,7 +25,6 @@ DESCRIPTION: https://github.com/sourcegraph/scip COMMANDS: - convert Convert a SCIP index to an LSIF index lint Flag potential issues with a SCIP index print Print a SCIP index for debugging snapshot Generate snapshot files for golden testing @@ -38,20 +36,6 @@ GLOBAL OPTIONS: --version, -v print the version ``` -## `scip convert` - -``` -NAME: - scip convert - Convert a SCIP index to an LSIF index - -USAGE: - scip convert [command options] [arguments...] - -OPTIONS: - --from value Path to SCIP index file (default: index.scip) - --to value Output path for LSIF index (default: dump.lsif) -``` - ## `scip lint` ``` diff --git a/go.mod b/go.mod index 0bc031eb..e43cb354 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,10 @@ module github.com/sourcegraph/scip -go 1.19 +go 1.20 require ( github.com/bufbuild/buf v1.25.0 + github.com/cockroachdb/errors v1.8.9 github.com/google/go-cmp v0.5.9 github.com/google/gofuzz v1.1.0 github.com/hexops/autogold/v2 v2.2.1 @@ -13,7 +14,6 @@ require ( github.com/montanaflynn/stats v0.7.1 github.com/pseudomuto/protoc-gen-doc v1.5.1 github.com/smacker/go-tree-sitter v0.0.0-20220209044044-0d3022e933c3 - github.com/sourcegraph/sourcegraph/lib v0.0.0-20220511160847-5a43d3ea24eb github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 @@ -31,7 +31,6 @@ require ( github.com/bufbuild/connect-go v1.9.0 // indirect github.com/bufbuild/connect-opentelemetry-go v0.4.0 // indirect github.com/bufbuild/protocompile v0.5.1 // indirect - github.com/cockroachdb/errors v1.8.9 // indirect github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect github.com/cockroachdb/redact v1.1.3 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect @@ -63,7 +62,6 @@ require ( github.com/imdario/mergo v0.3.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84 // indirect - github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/kr/pretty v0.3.1 // indirect @@ -72,8 +70,6 @@ require ( github.com/mattn/go-isatty v0.0.19 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/moby/term v0.5.0 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007 // indirect github.com/nightlyone/lockfile v1.0.0 // indirect diff --git a/go.sum b/go.sum index 2a8d1842..88532dfd 100644 --- a/go.sum +++ b/go.sum @@ -193,8 +193,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hexops/autogold v0.8.1 h1:wvyd/bAJ+Dy+DcE09BoLk6r4Fa5R5W+O+GUzmR985WM= github.com/hexops/autogold v0.8.1/go.mod h1:97HLDXyG23akzAoRYJh/2OBs3kd80eHyKPvZw0S5ZBY= -github.com/hexops/autogold v1.3.0 h1:IEtGNPxBeBu8RMn8eKWh/Ll9dVNgSnJ7bp/qHgMQ14o= github.com/hexops/autogold/v2 v2.2.1 h1:JPUXuZQGkcQMv7eeDXuNMovjfoRYaa0yVcm+F3voaGY= github.com/hexops/autogold/v2 v2.2.1/go.mod h1:IJwxtUfj1BGLm0YsR/k+dIxYi6xbeLjqGke2bzcOTMI= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= @@ -227,8 +227,6 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -293,12 +291,9 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= @@ -368,8 +363,6 @@ github.com/smacker/go-tree-sitter v0.0.0-20220209044044-0d3022e933c3 h1:WrsSqod9 github.com/smacker/go-tree-sitter v0.0.0-20220209044044-0d3022e933c3/go.mod h1:EiUuVMUfLQj8Sul+S8aKWJwQy7FRYnJCO2EWzf8F5hk= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/sourcegraph/sourcegraph/lib v0.0.0-20220511160847-5a43d3ea24eb h1:D8ciD0FEcPNnVm6BC8vg7gWJ9VxoJe6k/4j+Qxparj0= -github.com/sourcegraph/sourcegraph/lib v0.0.0-20220511160847-5a43d3ea24eb/go.mod h1:iFiGPqnhOvQziDZkpWasU+Uo1BaEt/Au9kNK4VpqyOw= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=