How to use the @jupyterlab/completer.ContextConnector function in @jupyterlab/completer

To help you get started, we’ve selected a few @jupyterlab/completer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / completer-extension / src / index.ts View on Github external
editorTracker.widgetAdded.connect((sender, widget) => {
      const sessions = app.serviceManager.sessions;
      const editor = widget.content.editor;
      const contextConnector = new ContextConnector({ editor });

      // When the list of running sessions changes,
      // check to see if there are any kernels with a
      // matching path for this file editor.
      const onRunningChanged = (
        sender: Session.IManager,
        models: Session.IModel[]
      ) => {
        const oldSession = activeSessions[widget.id];
        // Search for a matching path.
        const model = find(models, m => m.path === widget.context.path);
        if (model) {
          // If there is a matching path, but it is the same
          // session as we previously had, do nothing.
          if (oldSession && oldSession.id === model.id) {
            return;
github jupyterlab / jupyterlab / packages / completer-extension / src / index.ts View on Github external
editorTracker.widgetAdded.connect(async (sender, widget) => {
      const sessions = app.serviceManager.sessions;
      const editor = await widget.content.editor;
      const contextConnector = new ContextConnector({ editor });

      // When the list of running sessions changes,
      // check to see if there are any kernels with a
      // matching path for this file editor.
      const onRunningChanged = (
        sender: Session.IManager,
        models: Session.IModel[]
      ) => {
        const oldSession = activeSessions[widget.id];
        // Search for a matching path.
        const model = find(models, m => m.path === widget.context.path);
        if (model) {
          // If there is a matching path, but it is the same
          // session as we previously had, do nothing.
          if (oldSession && oldSession.id === model.id) {
            return;
github jupyterlab / jupyterlab-data-explorer / packages / completer-extension / src / index.ts View on Github external
editorTracker.widgetAdded.connect((sender, widget) => {
      const sessions = app.serviceManager.sessions;
      const editor = widget.content.editor;
      const contextConnector = new ContextConnector({ editor });

      // When the list of running sessions changes,
      // check to see if there are any kernels with a
      // matching path for this file editor.
      const onRunningChanged = (
        sender: Session.IManager,
        models: Session.IModel[]
      ) => {
        const oldSession = activeSessions[widget.id];
        // Search for a matching path.
        const model = find(models, m => m.path === widget.context.path);
        if (model) {
          // If there is a matching path, but it is the same
          // session as we previously had, do nothing.
          if (oldSession && oldSession.id === model.id) {
            return;
github krassowski / jupyterlab-lsp / packages / jupyterlab-lsp / src / adapters / jupyterlab / components / completion.ts View on Github external
constructor(options: LSPConnector.IOptions) {
    super();
    this._editor = options.editor;
    this._connections = options.connections;
    this.virtual_editor = options.virtual_editor;
    this._context_connector = new ContextConnector({ editor: options.editor });
    if (options.session) {
      let kernel_options = { editor: options.editor, session: options.session };
      this._kernel_connector = new KernelConnector(kernel_options);
      this._kernel_and_context_connector = new CompletionConnector(
        kernel_options
      );
    }
    this.options = options;
  }