Skip to content
This repository was archived by the owner on Jun 7, 2022. It is now read-only.

Commit cf26fb8

Browse files
authored
Do not block LSIF definition/hovers with isLSIFAvailable. (#307)
1 parent 153d9b8 commit cf26fb8

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/extension/extension.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { URL as _URL, URLSearchParams as _URLSearchParams } from 'whatwg-url'
66
Object.assign(_URL, self.URL)
77
Object.assign(self, { URL: _URL, URLSearchParams: _URLSearchParams })
88

9-
import { initLSIF, mkIsLSIFAvailable, impreciseBadge } from '@sourcegraph/basic-code-intel'
9+
import { initLSIF, impreciseBadge } from '@sourcegraph/basic-code-intel'
1010
import { Tracer as LightstepTracer } from '@sourcegraph/lightstep-tracer-webworker'
1111
import {
1212
createMessageConnection,
@@ -120,7 +120,6 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
120120
const config = new BehaviorSubject(getConfig())
121121
ctx.subscriptions.add(sourcegraph.configuration.subscribe(() => config.next(getConfig())))
122122

123-
const isLSIFAvailable = mkIsLSIFAvailable()
124123
const lsif = initLSIF()
125124
const basicCodeIntel = initBasicCodeIntel()
126125

@@ -468,7 +467,7 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
468467
return
469468
}
470469

471-
if (!(await isLSIFAvailable(textDocument)) && config.value['typescript.serverUrl']) {
470+
if (config.value['typescript.serverUrl']) {
472471
const serverRootUri = resolveServerRootUri(textDocumentUri, serverSgEndpoint)
473472
const serverTextDocumentUri = toServerTextDocumentUri(textDocumentUri, serverSgEndpoint)
474473
const connection = await getOrCreateConnection(serverRootUri, { token, span })
@@ -513,9 +512,7 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
513512
logger.log('Hover trace', span.generateTraceURL())
514513
}
515514

516-
const lsifResult = (await isLSIFAvailable(textDocument))
517-
? await lsif.hover(textDocument, position)
518-
: undefined
515+
const lsifResult = await lsif.hover(textDocument, position)
519516
if (lsifResult) {
520517
yield lsifResult.value
521518
} else if (!config.value['typescript.serverUrl']) {
@@ -567,9 +564,7 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
567564
logger.log('Definition trace', span.generateTraceURL())
568565
}
569566

570-
const lsifResult = (await isLSIFAvailable(textDocument))
571-
? await lsif.definition(textDocument, position)
572-
: undefined
567+
const lsifResult = await lsif.definition(textDocument, position)
573568
if (lsifResult) {
574569
yield lsifResult.value
575570
} else if (!config.value['typescript.serverUrl']) {
@@ -843,10 +838,6 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
843838
logger.log('Implementation trace', span.generateTraceURL())
844839
}
845840

846-
if (await isLSIFAvailable(textDocument)) {
847-
return null
848-
}
849-
850841
const textDocumentUri = new URL(textDocument.uri)
851842
const serverRootUri = resolveServerRootUri(textDocumentUri, serverSgEndpoint)
852843
const serverTextDocumentUri = toServerTextDocumentUri(textDocumentUri, serverSgEndpoint)

0 commit comments

Comments
 (0)