@jupyter-lsp/jupyterlab-lsp
Version:
Language Server Protocol integration for JupyterLab
73 lines (72 loc) • 2.93 kB
TypeScript
import { VDomModel, VDomRenderer } from '@jupyterlab/apputils';
import { IDocumentWidget } from '@jupyterlab/docregistry';
import { VirtualDocument, WidgetLSPAdapter } from '@jupyterlab/lsp';
import { TranslationBundle } from '@jupyterlab/translation';
import React, { ReactElement } from 'react';
import * as lsProtocol from 'vscode-languageserver-protocol';
import { CodeDiagnostics as LSPDiagnosticsSettings } from '../../_diagnostics';
import { IFeatureSettings } from '../../feature';
import { DiagnosticSeverity } from '../../lsp';
import { IEditorDiagnostic } from './tokens';
import '../../../style/diagnostics_listing.css';
export declare const DIAGNOSTICS_LISTING_CLASS = "lsp-diagnostics-listing";
export declare class DiagnosticsDatabase extends Map<VirtualDocument, IEditorDiagnostic[]> {
get all(): IEditorDiagnostic[];
}
export interface IDiagnosticsRow {
data: IEditorDiagnostic;
key: string;
document: VirtualDocument;
/**
* Cell number is the ordinal, 1-based cell identifier displayed to the user.
*/
cellNumber?: number;
}
interface IListingContext {
db: DiagnosticsDatabase;
adapter: WidgetLSPAdapter<IDocumentWidget>;
}
interface IColumnOptions {
id: string;
label: string;
renderCell(data: IDiagnosticsRow, context?: IListingContext): ReactElement;
sort(a: IDiagnosticsRow, b: IDiagnosticsRow): number;
isAvailable?(context: IListingContext): boolean;
}
declare class Column {
private options;
isVisible: boolean;
constructor(options: IColumnOptions);
renderCell(data: IDiagnosticsRow, context: IListingContext): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
sort(a: IDiagnosticsRow, b: IDiagnosticsRow): number;
get id(): string;
isAvailable(context: IListingContext): boolean;
renderHeader(listing: DiagnosticsListing): ReactElement;
}
export declare function messageWithoutCode(diagnostic: lsProtocol.Diagnostic): string;
export declare class DiagnosticsListing extends VDomRenderer<DiagnosticsListing.Model> {
sortKey: string;
sortDirection: number;
private _diagnostics;
protected trans: TranslationBundle;
columns: Column[];
protected severityTranslations: Record<keyof typeof DiagnosticSeverity, string>;
constructor(model: DiagnosticsListing.Model);
sort(key: string): void;
render(): React.JSX.Element;
getDiagnostic(key: string): IDiagnosticsRow | undefined;
jumpTo(row: IDiagnosticsRow): Promise<void>;
}
export declare namespace DiagnosticsListing {
/**
* A VDomModel for the LSP of current file editor/notebook.
*/
class Model extends VDomModel {
diagnostics: DiagnosticsDatabase | null;
adapter: WidgetLSPAdapter<any> | null;
settings: IFeatureSettings<LSPDiagnosticsSettings>;
trans: TranslationBundle;
constructor(translatorBundle: TranslationBundle);
}
}
export {};