UNPKG

@jupyter-lsp/jupyterlab-lsp

Version:

Language Server Protocol integration for JupyterLab

58 lines (57 loc) 2.83 kB
import { INotebookShell } from '@jupyter-notebook/application'; import { ILabShell } from '@jupyterlab/application'; import { IThemeManager } from '@jupyterlab/apputils'; import { IEditorExtensionRegistry } from '@jupyterlab/codemirror'; import { WidgetLSPAdapter, VirtualDocument } from '@jupyterlab/lsp'; import { TranslationBundle } from '@jupyterlab/translation'; import * as lsProtocol from 'vscode-languageserver-protocol'; import { CodeDiagnostics as LSPDiagnosticsSettings } from '../../_diagnostics'; import { IFeatureSettings, Feature } from '../../feature'; import { BrowserConsole } from '../../virtual/console'; import { DiagnosticsDatabase } from './listing'; import { IDiagnosticsFeature } from './tokens'; export declare class DiagnosticsFeature extends Feature implements IDiagnosticsFeature { readonly id: string; readonly capabilities: lsProtocol.ClientCapabilities; protected settings: IFeatureSettings<LSPDiagnosticsSettings>; protected console: BrowserConsole; private _firstResponseReceived; private _diagnosticsDatabases; constructor(options: DiagnosticsFeature.IOptions); private _reconfigureTheme; clearDocumentDiagnostics(adapter: WidgetLSPAdapter<any>, document: VirtualDocument): void; /** * Allows access to the most recent diagnostics in context of the editor. * * One can use VirtualEditorForNotebook.find_cell_by_editor() to find * the corresponding cell in notebook. * Can be used to implement a Panel showing diagnostics list. * * Maps virtualDocument.uri to IEditorDiagnostic[]. */ getDiagnosticsDB(adapter: WidgetLSPAdapter<any>): DiagnosticsDatabase; switchDiagnosticsPanelSource: (adapter: WidgetLSPAdapter<any> | null) => void; protected diagnosticsByRange(diagnostics: lsProtocol.Diagnostic[]): Map<lsProtocol.Range, lsProtocol.Diagnostic[]>; get defaultSeverity(): lsProtocol.DiagnosticSeverity; private filterDiagnostics; setDiagnostics(response: lsProtocol.PublishDiagnosticsParams, document: VirtualDocument, adapter: WidgetLSPAdapter<any>): void; handleDiagnostic: (response: lsProtocol.PublishDiagnosticsParams, document: VirtualDocument, adapter: WidgetLSPAdapter<any>) => Promise<void>; refreshDiagnostics(): void; private _lastResponse; private _lastDocument; private _lastAdapter; private _trans; private _invalidate; private _invalidationCounter; private _styleElement; } export declare namespace DiagnosticsFeature { interface IOptions extends Feature.IOptions { settings: IFeatureSettings<LSPDiagnosticsSettings>; shell: ILabShell | INotebookShell; trans: TranslationBundle; editorExtensionRegistry: IEditorExtensionRegistry; themeManager: IThemeManager | null; } const id: string; }