insights: Return offsets and lengths with inline insights
Created by: CristinaBirkel
Description
In order to identify the particular match that was found on the line, we need to return where the match was found. OffsetAndLengths
is what's returned from the streaming search API, so that's what we can pass along here.
Test plan
Tested this by requesting offsetAndLengths
from the endpoint, using this query:
query {
relatedInsightsInline(input: {
file: "enterprise/internal/insights/query/querybuilder/builder.go"
revision: "a84fde5e35eed41060acb6aa46b842af32133027",
repo: "github.com/sourcegraph/sourcegraph"}) {
viewId, title, lineNumbers, offsetAndLengths
}
}
It looks pretty reasonable, just eyeballing it. Will have to confirm with the frontend that it's as expected!