Improved IntelliSense Support for Jupyter Notebooks in VS Code
Improved IntelliSense support for Jupyter Notebooks highlights the September 2022 update of Python dev tooling in Visual Studio Code.
That tooling comes in extensions for Python (64 million installs, making it by far the most popular VS Code tool), Jupyter (nearly 45 million installs) and Pylance, the language server that provides Python-specific "smarts" in the code editor, such as code completion, parameter suggestions, semantic highlighting and so on.
It's that latter language server tool and the associated Language Server Protocol that are responsible for the improved IntelliSense support, said the dev team in a Sept. 1 announcement post.
"IntelliSense support for Jupyter Notebooks with Python kernels is now much better when using Pylance, thanks to the updates in the Language Server Protocol to include notebook support," Microsoft's Erik De Bonte said.
"Not only you will get improved auto complete suggestions when writing Python code in notebook files, but you will also be able to leverage refactoring features such as extract variable, extract method as well as auto imports."
Indeed, the changelog for the Jupyter tool shows 15 different items that mention IntelliSense.
In addition, the team announced a new extension that also leverages the Language Server Protocol -- in this case for linting support for files using the Flake8 linter -- called Flake8. It joins several other extensions that provide linting functionality (flagging programming/style errors, bugs and suspicious constructs), code formatting and sorting.
"After releasing extensions for pylint, black and isort, we are now excited to announce we also have a new flake8 extension!" said De Bonte. "Much like the others, this new extension uses the Language Server Protocol to provide linting support, and because it ships with the latest version of Flake8, you're no longer required to have it installed in a Python environment.
"You can also use it side by side with the Pylint extension, as one doesn't conflict with the other."
Also, many small enhancements and fixes were enacted in response to developer feedback, including:
- Developers can now clear and refresh the Python interpreters list through a new button in the picker (vscode-python#19628).
- Debugpy has been updated to version 1.6.3 (vscode-python#19698)
- Pylance is now longer showing false warnings when importing a Python module/file in a Jupyter notebook (pylance-release#3017).
- Renaming symbols across different cells in Jupyter notebooks no longer fails when using Pylance (pylance-release#3061).
- IntelliSense support for matplotlib has been improved when using Pylance thanks to updates on matplotlib type stubs (python-type-stubs#223).
To figure out how to use all that tooling, Microsoft provides "Getting Started with Python in VS Code" documentation.
David Ramel is an editor and writer for Converge360.