import { Subject } from 'rxjs'; import { Controller as BaseController } from 'sourcegraph/module/client/controller'; import { ExecuteCommandParams } from 'sourcegraph/module/client/providers/command'; import { MessageTransports } from 'sourcegraph/module/protocol/jsonrpc2/connection'; import { Notification } from '../app/notifications/notification'; import { Context } from '../context'; import { ConfiguredExtension } from '../extensions/extension'; import { ConfigurationCascade, ConfigurationSubject, Settings } from '../settings'; /** * Extends the {@link BaseController} class to add functionality that is useful to this package's consumers. */ export declare class Controller extends BaseController> { /** * Global notification messages that should be displayed to the user, from the following sources: * * - window/showMessage notifications from extensions * - Errors thrown or returned in command invocation */ readonly notifications: Subject; /** * Executes the command (registered in the CommandRegistry) specified in params. If an error is thrown, the * error is returned *and* emitted on the {@link Controller#notifications} observable. * * All callers should execute commands using this method instead of calling * {@link sourcegraph:CommandRegistry#executeCommand} directly (to ensure errors are * emitted as notifications). */ executeCommand(params: ExecuteCommandParams): Promise; } /** * React props or state containing the controller. There should be only a single controller for the whole * application. */ export interface ControllerProps { /** * The controller, which is used to communicate with the extensions and manages extensions based on the * environment. */ extensionsController: Controller; } declare global { interface Window { sx: any; sxenv: any; } } /** * Creates the controller, which handles all communication between the React app and Sourcegraph extensions. * * There should only be a single controller for the entire application. The controller's environment represents all * of the application state that the controller needs to know. * * It receives state updates via calls to the setEnvironment method from React components. It provides results to * React components via its registries and the showMessages, etc., observables. */ export declare function createController(context: Context, createMessageTransports: (extension: ConfiguredExtension) => Promise): Controller;