Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
chore(codeintel): usagesForSymbol - make start/end non-optional for n…
Browse files Browse the repository at this point in the history
…ow (#63059)

We can add support for optional start/end later
in a backwards-compatible way. Making these non-optional
helps simplify the initial implementation.
  • Loading branch information
varungandhi-src authored Jun 4, 2024
1 parent 9847d67 commit d313441
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
8 changes: 5 additions & 3 deletions cmd/frontend/graphqlbackend/codeintel.codenav.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,14 @@ input RangeInput {
"""
Start position of the range (inclusive)
"""
start: PositionInput
# TODO(id: usagesForSymbol-v2) Make this input optional
start: PositionInput!

"""
End position of the range (exclusive)
"""
end: PositionInput
# TODO(id: usagesForSymbol-v2) Make this input optional
end: PositionInput!
}

"""
Expand Down Expand Up @@ -602,7 +604,7 @@ input UsagesFilter {
an empty value will find results across the Sourcegraph instance.
"""
repository: RepositoryFilter
# TODO(id: usagesForSymbols-v2)
# TODO(id: usagesForSymbol-v2)
# and: [UsagesFilter!]
# or: [UsagesFilter!]
# path: PathFilter
Expand Down
16 changes: 6 additions & 10 deletions internal/codeintel/resolvers/codenav.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ type RangeInput struct {
Repository string
Revision *string
Path string
Start *PositionInput
End *PositionInput
Start PositionInput
End PositionInput
}

func (r *RangeInput) Attrs() (out []attribute.KeyValue) {
Expand All @@ -362,14 +362,10 @@ func (r *RangeInput) Attrs() (out []attribute.KeyValue) {
out = append(out, attribute.String("range.revision", *r.Revision))
}
out = append(out, attribute.String("range.path", r.Path))
if r.Start != nil {
out = append(out, attribute.Int("range.start.line", int(r.Start.Line)))
out = append(out, attribute.Int("range.start.character", int(r.Start.Character)))
}
if r.End != nil {
out = append(out, attribute.Int("range.end.line", int(r.End.Line)))
out = append(out, attribute.Int("range.end.character", int(r.End.Character)))
}
out = append(out, attribute.Int("range.start.line", int(r.Start.Line)))
out = append(out, attribute.Int("range.start.character", int(r.Start.Character)))
out = append(out, attribute.Int("range.end.line", int(r.End.Line)))
out = append(out, attribute.Int("range.end.character", int(r.End.Character)))
return out
}

Expand Down

0 comments on commit d313441

Please sign in to comment.