@krassowski/jupyterlab-lsp
Version:
Language Server Protocol integration for JupyterLab
57 lines (56 loc) • 1.95 kB
TypeScript
import { CodeEditor } from '@jupyterlab/codeeditor';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
import { Tooltip } from '@jupyterlab/tooltip';
import * as lsProtocol from 'vscode-languageserver-protocol';
import { WidgetAdapter } from '../adapters/adapter';
import { IEditorPosition } from '../positioning';
interface IFreeTooltipOptions extends Tooltip.IOptions {
/**
* Position at which the tooltip should be placed, or null (default) to use the current cursor position.
*/
position: CodeEditor.IPosition | undefined;
/**
* HoverBox privilege.
*/
privilege?: 'above' | 'below' | 'forceAbove' | 'forceBelow';
/**
* Alignment with respect to the current token.
*/
alignment?: 'start' | 'end' | undefined;
/**
* default: true; ESC will always hide
*/
hideOnKeyPress?: boolean;
}
/**
* Tooltip which can be placed at any character, not only at the current position (derived from getCursorPosition)
*/
export declare class FreeTooltip extends Tooltip {
protected options: IFreeTooltipOptions;
constructor(options: IFreeTooltipOptions);
handleEvent(event: Event): void;
private _setGeometry;
}
export declare namespace EditorTooltip {
interface IOptions {
id?: string;
markup: lsProtocol.MarkupContent;
ce_editor: CodeEditor.IEditor;
position: IEditorPosition;
adapter: WidgetAdapter<IDocumentWidget>;
className?: string;
tooltip?: Partial<IFreeTooltipOptions>;
}
}
export declare class EditorTooltipManager {
private rendermime_registry;
private currentTooltip;
private currentOptions;
constructor(rendermime_registry: IRenderMimeRegistry);
create(options: EditorTooltip.IOptions): FreeTooltip;
get position(): IEditorPosition;
isShown(id?: string): boolean;
remove(): void;
}
export {};