@jupyter-lsp/jupyterlab-lsp
Version:
Language Server Protocol integration for JupyterLab
37 lines (36 loc) • 1.71 kB
TypeScript
import { JupyterFrontEnd } from '@jupyterlab/application';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { ILSPConnection, WidgetLSPAdapter, ILSPDocumentConnectionManager, IEditorPosition, IRootPosition, IVirtualPosition, Document } from '@jupyterlab/lsp';
import { BrowserConsole } from './virtual/console';
import { VirtualDocument } from './virtual/document';
export declare class ContextAssembler {
private options;
protected console: BrowserConsole;
constructor(options: ContextAssembler.IOptions);
/**
* Get context from current context menu (or fallback to document context).
*/
getContext(): ICommandContext | null;
isContextMenuOverToken(): boolean | undefined;
private _wasOverToken;
private _contextFromActiveDocument;
private _contextFromRoot;
adapterFromNode(leafNode: HTMLElement): WidgetLSPAdapter<any> | undefined;
positionFromCoordinates(left: number, top: number, adapter: WidgetLSPAdapter<any>, editorAccessor: Document.IEditor | undefined): IRootPosition | null;
editorPositionFromCoordinates(left: number, top: number, editorAccessor: Document.IEditor): IEditorPosition | null;
editorFromNode(adapter: WidgetLSPAdapter<any>, node: HTMLElement): Document.IEditor | undefined;
private getContextFromContextMenu;
}
export declare namespace ContextAssembler {
interface IOptions {
app: JupyterFrontEnd;
connectionManager: ILSPDocumentConnectionManager;
}
}
export interface ICommandContext {
document: VirtualDocument;
connection?: ILSPConnection;
virtualPosition: IVirtualPosition;
rootPosition: IRootPosition;
adapter: WidgetLSPAdapter<IDocumentWidget>;
}