ipythonvisual-studio-codepylancevscode-python

How to ignore Python interactive window for linting in VSCode


I would like to disable linting for cells in the interactive window in Visual Studio Code. I don't see how it is beneficial, since it is not possible to manipulate cells which have already been run (which is different from *.ipynb notebooks). I believe the linting inside the interactive window is a new feature, since it only started a while ago. Currently the only way to remove the linting warnings is removing the cells.

My workflow is usually as follows: I write *.py files and execute them using the "Jupyter: Run Current File in Interactive Window" command, so I can access the variables and experiment.

I already tried adding the following settings to my settings.json file:

"python.linting.ignorePatterns": [
    "Interactive*",
    "*.interactive"
],

This is what it looks like:

Example screenshot of linting in interactive window


Solution

  • This behavior was treated as a bug and will be resolved in future releases. See here: https://github.com/microsoft/vscode-jupyter/issues/8289