@@ -60,9 +60,10 @@ import {
6060import type { WorkspaceRoot } from '@sourcegraph/extension-api-types'
6161import { gql , isHTTPAuthError } from '@sourcegraph/http-client'
6262import type { ActionItemAction } from '@sourcegraph/shared/src/actions/ActionItem'
63- import { wrapRemoteObservable } from '@sourcegraph/shared/src/api/client/api/common'
6463import type { CodeEditorData , CodeEditorWithPartialModel } from '@sourcegraph/shared/src/api/viewerTypes'
6564import { isRepoNotFoundErrorLike } from '@sourcegraph/shared/src/backend/errors'
65+ import { createCodeIntelAPI } from '@sourcegraph/shared/src/codeintel/api'
66+ import type { CodeIntelContext } from '@sourcegraph/shared/src/codeintel/legacy-extensions/api'
6667import type { Controller } from '@sourcegraph/shared/src/extensions/controller'
6768import { getHoverActions , registerHoverContributions } from '@sourcegraph/shared/src/hover/actions'
6869import {
@@ -354,6 +355,13 @@ function initCodeIntelligence({
354355 } )
355356 )
356357
358+ const codeintelContext : CodeIntelContext = { ...platformContext , telemetryRecorder, settings : ( ) => undefined }
359+ const codeintelAPI = createCodeIntelAPI ( codeintelContext )
360+
361+ function thenMaybeLoadingResult < T > ( result : T ) : MaybeLoadingResult < T > {
362+ return { isLoading : false , result }
363+ }
364+
357365 // Code views come and go, but there is always a single hoverifier on the page
358366 const hoverifier = createHoverifier <
359367 RepoSpec & RevisionSpec & FileSpec & ResolvedRevisionSpec ,
@@ -369,17 +377,22 @@ function initCodeIntelligence({
369377 getHover : ( { line, character, part, ...rest } ) =>
370378 concat (
371379 [ { isLoading : true , result : null } ] ,
372- from ( extensionsController . extHostAPI )
380+ of ( true /* TODO!(sqs) */ )
373381 . pipe (
374382 withLatestFrom ( repoSyncErrors ) ,
375- switchMap ( ( [ extensionHost , hasRepoSyncError ] ) =>
383+ switchMap ( ( [ , hasRepoSyncError ] ) =>
376384 // Prevent GraphQL requests that we know will result in error/null when the repo is private (and not added to Cloud)
377385 hasRepoSyncError
378386 ? of ( { isLoading : true , result : null } )
379- : wrapRemoteObservable (
380- extensionHost . getHover (
381- toTextDocumentPositionParameters ( { ...rest , position : { line, character } } )
382- )
387+ : from (
388+ codeintelAPI
389+ . getHover (
390+ toTextDocumentPositionParameters ( {
391+ ...rest ,
392+ position : { line, character } ,
393+ } )
394+ )
395+ . then ( thenMaybeLoadingResult )
383396 )
384397 )
385398 )
@@ -393,19 +406,20 @@ function initCodeIntelligence({
393406 )
394407 ) ,
395408 getDocumentHighlights : ( { line, character, part, ...rest } ) =>
396- from ( extensionsController . extHostAPI ) . pipe (
409+ of ( true /* TODO!(sqs) */ ) . pipe (
397410 withLatestFrom ( repoSyncErrors ) ,
398- switchMap ( ( [ extensionHost , hasRepoSyncError ] ) =>
411+ switchMap ( ( [ , hasRepoSyncError ] ) =>
399412 // Prevent GraphQL requests that we know will result in error/null when the repo is private (and not added to Cloud)
400413 hasRepoSyncError
401414 ? of ( [ ] )
402- : wrapRemoteObservable (
403- extensionHost . getDocumentHighlights (
415+ : from (
416+ codeintelAPI . getDocumentHighlights (
404417 toTextDocumentPositionParameters ( { ...rest , position : { line, character } } )
405418 )
406419 )
407420 )
408421 ) ,
422+ // TODO!(sqs): just gotta make it so the actions are determined programmatically AND we only trigger it on supported languages
409423 getActions : context =>
410424 // Prevent GraphQL requests that we know will result in error/null when the repo is private (and not added to Cloud)
411425 repoSyncErrors . pipe (
0 commit comments