@@ -29,6 +29,7 @@ import uuid from 'uuid'
2929import { Disposable } from 'vscode-languageserver'
3030import storage , { StorageItems } from '../../browser/storage'
3131import { ExtensionConnectionInfo , onFirstMessage } from '../messaging'
32+ import { canFetchForURL } from '../util/context'
3233import { getContext } from './context'
3334import { createAggregateError , isErrorLike } from './errors'
3435import { queryGraphQL } from './graphql'
@@ -215,19 +216,19 @@ const configurationCascadeFragment = gql`
215216 */
216217export const gqlConfigurationCascade = storage . observeSync ( 'sourcegraphURL' ) . pipe (
217218 switchMap ( url =>
218- queryGraphQL (
219- getContext ( { repoKey : '' , isRepoSpecific : false } ) ,
220- gql `
219+ queryGraphQL ( {
220+ ctx : getContext ( { repoKey : '' , isRepoSpecific : false } ) ,
221+ request : gql `
221222 query Configuration {
222223 viewerConfiguration {
223224 ...ConfigurationCascadeFields
224225 }
225226 }
226227 ${ configurationCascadeFragment }
227228 ` [ graphQLContent ] ,
228- { } ,
229- url
230- ) . pipe (
229+ url ,
230+ requestMightContainPrivateInfo : false ,
231+ } ) . pipe (
231232 map ( ( { data, errors } ) => {
232233 if ( ! data || ! data . viewerConfiguration ) {
233234 throw createAggregateError ( errors )
@@ -257,14 +258,25 @@ export function createExtensionsContextController(
257258 distinctUntilChanged ( ( a , b ) => isEqual ( a , b ) )
258259 ) ,
259260 updateExtensionSettings,
260- queryGraphQL : ( request , variables ) =>
261+ queryGraphQL : ( request , variables , requestMightContainPrivateInfo ) =>
261262 storage . observeSync ( 'sourcegraphURL' ) . pipe (
262263 take ( 1 ) ,
263264 mergeMap ( url =>
264- queryGraphQL ( getContext ( { repoKey : '' , isRepoSpecific : false } ) , request , variables , url )
265+ queryGraphQL ( {
266+ ctx : getContext ( { repoKey : '' , isRepoSpecific : false } ) ,
267+ request,
268+ variables,
269+ url,
270+ requestMightContainPrivateInfo,
271+ } )
265272 )
266273 ) ,
267- queryLSP : requests => sendLSPHTTPRequests ( requests ) ,
274+ queryLSP : canFetchForURL ( sourcegraphUrl )
275+ ? requests => sendLSPHTTPRequests ( requests )
276+ : ( ) =>
277+ throwError (
278+ 'The queryLSP command is unavailable because the current repository does not exist on the Sourcegraph instance.'
279+ ) ,
268280 icons : {
269281 Loader : LoadingSpinner as React . ComponentType < { className : string ; onClick ?: ( ) => void } > ,
270282 Info : InfoIcon as React . ComponentType < { className : string ; onClick ?: ( ) => void } > ,
0 commit comments