Skip to content

Intellisense for notebooks

Rich Chiodo edited this page Aug 2, 2022 · 23 revisions

Table of Contents

Overview

Notebooks Architecture

Concatentation of the notebook cells

Finding modules

Future changes

Intellisense Overview

Intellisense in VS code works by sending LSP requests to a separate process (well in most cases, see this for more info)

Something like so:

image

Intellisense for notebooks

Intellisense for notebooks works pretty much the same way but with each cell of a notebook being a text document:

image

Concatentation of the notebook cells

This poses a problem for the language server (Pylance) because code from one cell can be referenced in another.

Example:

image

In that example, the pandas import crosses the cell boundary.

This means pylance cannot just analyze each cell individually.

New LSP Messages

The solution was changes to LSP:

  • message 1
  • message 2

Pylance can now understand notebooks

Pylance still needs the active interpreter per notebook

Tooling

Clone this wiki locally