UNPKG

@jupyterlab/lsp

Version:
75 lines (74 loc) 2.08 kB
import { IConfigurableExtension, IEditorExtensionFactory } from '@jupyterlab/codemirror'; import { IDisposable } from '@lumino/disposable'; import { WidgetLSPAdapter } from './adapter'; import { Document } from '../tokens'; /** * The CodeEditor.IEditor adapter. */ export declare class EditorAdapter implements IDisposable { /** * Instantiate a new EditorAdapter. * * @param options The instantiation options for a EditorAdapter. */ constructor(options: EditorAdapter.IOptions); /** * Whether the handler is disposed. */ isDisposed: boolean; /** * Dispose the handler. */ dispose(): void; /** * Setup the editor. */ private _injectExtensions; private _widgetAdapter; private _extensions; } /** * A namespace for EditorAdapter `statics`. */ export declare namespace EditorAdapter { /** * Instantiation options for `EditorAdapter`. */ interface IOptions { /** * Editor wrapper enabling revealing the editor when detached (out of view). */ editor: Document.IEditor; /** * The widget lsp adapter. */ widgetAdapter: WidgetLSPAdapter; /** * The list of CodeMirror extension factories */ extensions: ILSPEditorExtensionFactory[]; } interface ILSPEditorExtensionFactory extends Omit<IEditorExtensionFactory<any>, 'factory'> { /** * Extension factory. * * @param options * @returns The extension builder or null if the extension is not active for that document */ readonly factory: (options: IFactoryOptions) => IConfigurableExtension<any> | null; } interface IFactoryOptions extends IEditorExtensionFactory.IOptions { /** * A path to a source file. */ path: string; /** * The code editor. */ editor: Document.IEditor; /** * The widget lsp adapter. */ widgetAdapter: WidgetLSPAdapter<any>; } }