mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:51:59 +00:00
Closes https://linear.app/sourcegraph/issue/GRAPH-665/add-a-search-client-to-the-codenav-service This change is preparation for pre-filtering syntactic occurrences via search. ## Test plan CI passing means things are wired up correctly
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package codenav
|
|
|
|
import (
|
|
"github.com/sourcegraph/log"
|
|
|
|
"github.com/sourcegraph/sourcegraph/internal/codeintel/codenav/internal/lsifstore"
|
|
codeintelshared "github.com/sourcegraph/sourcegraph/internal/codeintel/shared"
|
|
"github.com/sourcegraph/sourcegraph/internal/database"
|
|
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
|
"github.com/sourcegraph/sourcegraph/internal/observation"
|
|
searchClient "github.com/sourcegraph/sourcegraph/internal/search/client"
|
|
)
|
|
|
|
func NewService(
|
|
observationCtx *observation.Context,
|
|
db database.DB,
|
|
codeIntelDB codeintelshared.CodeIntelDB,
|
|
uploadSvc UploadService,
|
|
gitserver gitserver.Client,
|
|
) *Service {
|
|
lsifStore := lsifstore.New(scopedContext("lsifstore", observationCtx), codeIntelDB)
|
|
logger := log.Scoped("codenav")
|
|
searcher := searchClient.New(logger, db, gitserver)
|
|
|
|
return newService(
|
|
observationCtx,
|
|
db.Repos(),
|
|
lsifStore,
|
|
uploadSvc,
|
|
gitserver,
|
|
searcher,
|
|
logger,
|
|
)
|
|
}
|
|
|
|
func scopedContext(component string, parent *observation.Context) *observation.Context {
|
|
return observation.ScopedContext("codeintel", "codenav", component, parent)
|
|
}
|