UNPKG

@nteract/monaco-editor

Version:

A React component for the monaco editor, tailored for nteract

44 lines (43 loc) 1.42 kB
/** * Jupyter messaging protocol's _jupyter_types_experimental completion result. */ interface CompletionResult { end: number; start: number; type: string; text: string; displayText?: string; } /** * Juptyer completion match item. */ export declare type CompletionMatch = string | CompletionResult; /** * Jupyter messaging protocol's complete_reply response. */ export interface CompletionResults { status: string; cursor_start: number; cursor_end: number; matches: CompletionMatch[]; metadata?: { _jupyter_types_experimental?: any; }; } /** * Create Jupyter messaging protocol's complete_request message. * @param code Code of editor. * @param cursorPos cursor position represented in the Jupyter messaging protocol (character position) */ export declare const completionRequest: (code: string, cursorPos: number) => import("@nteract/messaging").JupyterMessage<"complete_request", any>; /** * JavaScript stores text as utf16 and string indices use "code units", * which stores high-codepoint characters as "surrogate pairs", * which occupy two indices in the JavaScript string. * We need to translate cursor_pos in the protocol (in characters) * to js offset (with surrogate pairs taking two spots). * @param js_idx JavaScript index * @param text Text */ export declare const js_idx_to_char_idx: (js_idx: number, text: string) => number; export {};