UNPKG

@krassowski/jupyterlab-lsp

Version:

Language Server Protocol integration for JupyterLab

31 lines 1.05 kB
import { ILSPVirtualEditorManager, PLUGIN_ID } from '../tokens'; export class VirtualEditorManager { constructor() { this.editorTypes = []; } registerEditorType(options) { this.editorTypes.push(options); } findBestImplementation(editors) { // for now, we check if all editors are of the same type, // but it could be good enough if majority of the editors // had the requested type for (let editorType of this.editorTypes) { if (editors.every(editor => editor instanceof editorType.supports)) { return editorType; } } console.warn('Cold not find a VirtualEditor suitable for the provided set of editors:', editors); return null; } } export const VIRTUAL_EDITOR_MANAGER = { id: PLUGIN_ID + ':ILSPVirtualEditorManager', requires: [], activate: app => { return new VirtualEditorManager(); }, provides: ILSPVirtualEditorManager, autoStart: true }; //# sourceMappingURL=editor.js.map