Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylance / Language server full support #4307

Closed
HaleTom opened this issue Jan 6, 2021 · 13 comments
Closed

Pylance / Language server full support #4307

HaleTom opened this issue Jan 6, 2021 · 13 comments
Labels
bug Issue identified by VS Code Team member as probable bug notebook-intellisense Intellisense & other language features in notebook cells for any language upstream-pylance Blocked on upstream Pylance

Comments

@HaleTom
Copy link

HaleTom commented Jan 6, 2021

Environment data

  • VS Code version: Version: 1.51.1
    Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
    Date: 2020-11-10T23:31:29.624Z
    Electron: 9.3.3
    Chrome: 83.0.4103.122
    Node.js: 12.14.1
    V8: 8.3.110.13-electron.0
    OS: Linux x64 5.4.80-2-MANJARO
  • Jupyter Extension version (available under the Extensions sidebar): v2020.12.414227025
  • Python Extension version (available under the Extensions sidebar): v2020.12.424452561
  • OS (Windows | Mac | Linux distro) and version: Linux svelte 5.4.80-2-MANJARO Setup component governance #1 SMP PREEMPT Sat Nov 28 09:58:18 UTC 2020 x86_64 GNU/Linux
  • Python and/or Anaconda version: 3.9.1, conda, conda 4.8.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Jupyter server running: Local

Expected behaviour

Language server functions are available

Eg, pressing F2 to rename a variable, I get the rename variable popup

Actual behaviour

Pylance works for .py files:

.py with pylance

But doesn't work with Jupyter .ipynb notebooks:

.ipynb with pylance

I tried saving the .ipynb - same issue.

Steps to reproduce:

  1. See images above.

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

User belongs to experiment group 'jupyterTest'
Error 2021-01-06 09:44:36: Jupyter Kernel Spec not found for a local connection
> /bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> /bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Started kernel Python 3.9.1 64-bit ('rl': conda)
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> ~/.local/share/miniconda3/envs/rl/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v

@HaleTom HaleTom added the bug Issue identified by VS Code Team member as probable bug label Jan 6, 2021
@HaleTom
Copy link
Author

HaleTom commented Jan 6, 2021

@rchiodo
Copy link
Contributor

rchiodo commented Jan 6, 2021

Thanks for the bug.

We do have partial intellisense in notebooks, but rename support is not currently supported. It works slightly better if you use VS code insiders (this will force notebooks to open with a beta notebook editor that has better intellisense), but this still doesn't support rename yet.

@rchiodo rchiodo changed the title Pylance / Language server support Pylance / Language server full support Jan 6, 2021
@jackedai
Copy link

jackedai commented Jan 10, 2021

This is working great on the daily Python preview channel with Jupyter, Pylance and Python 3.9.1.

The only problem is that it doesn't always recognize line breaks between code blocks
image

With a line break to fix it (but the next statement also needs a line break):

image

@rchiodo
Copy link
Contributor

rchiodo commented Jan 11, 2021

Thanks. Line breaks are actually already being tracked by this issue here:
#4300

@fromm1990
Copy link

I would love a full pylance experience within notebooks as well. I have a significant increase of code mistakes in notebooks compared to plain python files with pylance. It will definitely help my productivity when working within notebooks.

@haeraeus
Copy link

This code actually works :(
image

@jaanli
Copy link

jaanli commented Jul 19, 2021

+1 pylance does not work for jupyter notebooks, and would be nice to have.

@greazer greazer added the notebook-intellisense Intellisense & other language features in notebook cells for any language label Aug 3, 2021
@rchiodo
Copy link
Contributor

rchiodo commented Aug 31, 2021

This should be working now but the 16 upvotes it received on Jul 19th makes me think it isn't working for some people.

@rchiodo rchiodo added this to the September 2021 milestone Aug 31, 2021
@rchiodo rchiodo self-assigned this Aug 31, 2021
@jaanli
Copy link

jaanli commented Sep 3, 2021

Still not working unfortunately - thank you for checking @rchiodo !

@greazer greazer modified the milestones: September 2021, October 2021 Sep 23, 2021
@rchiodo rchiodo modified the milestones: October 2021, November 2021 Oct 27, 2021
@rchiodo rchiodo added the upstream-pylance Blocked on upstream Pylance label Nov 11, 2021
@rchiodo rchiodo removed their assignment Nov 11, 2021
@rchiodo rchiodo removed this from the November 2021 milestone Nov 11, 2021
@TTTPOB
Copy link

TTTPOB commented Nov 24, 2021

I found that if I start a remote server manually, connect a notebook from vscode to it, pylance wont be enabled,
but if i let vscode start a local jupyter server instead, pylance will be working as normal

@markub3327
Copy link

markub3327 commented Jan 12, 2022

@rchiodo I don't know why my Pylance give me a lots of errors, but the cell and whole notebook I can run without any issue (no errors). Here is list of founded errors:

  • Unindent not expected
  • Unexpected indentation
  • Expected expression
  • "(" was not closed
  • and so on ...

Thanks.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 12, 2022

@markub3327 I opened a new issue for you (#8678). We need some more information to help you.

@DonJayamanne
Copy link
Contributor

Closing this as fixed

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug notebook-intellisense Intellisense & other language features in notebook cells for any language upstream-pylance Blocked on upstream Pylance
Projects
None yet
Development

No branches or pull requests