UNPKG

@jupyter-lsp/jupyterlab-lsp

Version:

Language Server Protocol integration for JupyterLab

83 lines (82 loc) 2.49 kB
import { CompletionHandler } from '@jupyterlab/completer'; import { ILSPConnection } from '@jupyterlab/lsp'; import { LabIcon } from '@jupyterlab/ui-components'; import * as lsProtocol from 'vscode-languageserver-types'; /** * To be upstreamed */ export interface IExtendedCompletionItem extends CompletionHandler.ICompletionItem { insertText: string; sortText: string; source: string; } declare namespace CompletionItem { interface IOptions { /** * Type of this completion item. */ type: string; /** * LabIcon object for icon to be rendered with completion type. */ icon: LabIcon | null; match: lsProtocol.CompletionItem; connection: ILSPConnection; source: string; } } export declare class CompletionItem implements IExtendedCompletionItem { protected options: CompletionItem.IOptions; /** * Self-reference to make sure that the instance for will remain accessible * after any copy operation (whether via spread syntax or Object.assign) * performed by the JupyterLab completer internals. */ self: CompletionItem; element: HTMLLIElement; source: string; get isDocumentationMarkdown(): boolean; /** * User facing completion. * If insertText is not set, this will be inserted. */ label: string; icon: LabIcon | undefined; constructor(options: CompletionItem.IOptions); get type(): string; /** * Completion to be inserted. */ get insertText(): string; set insertText(text: string); get sortText(): string; set sortText(text: string); get filterText(): string | undefined; set filterText(text: string | undefined); get detail(): string | undefined; needsResolution(): boolean; isResolved(): boolean; /** * Resolve (fetch) details such as documentation. */ resolve(): Promise<CompletionItem>; /** * A human-readable string with additional information * about this item, like type or symbol information. */ get documentation(): string | undefined; /** * Indicates if the item is deprecated. */ get deprecated(): boolean; private _setDocumentation; private _supportsResolution; private _detail; private _documentation; private _isDocumentationMarkdown; private _resolved; private _currentInsertText; private _currentSortText; private _match; } export {};