pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Pylance unable to parse code

Open stolenzc opened this issue 5 years ago • 19 comments

Environment data

  • Language Server version: 2021.6.0
  • OS and version: Windows10 2004 19041.985
  • Python version (& distribution if applicable, e.g. Anaconda): Python3.8.5

Expected behaviour

This use pylance 2021.5.4

image

Actual behaviour

This use Pylance 2021.6.0

image

I also can‘t jump to defination,it means pylance not parse this code。

stolenzc avatar Jun 03 '21 03:06 stolenzc

Hi I did update the Pylance from 2021.5.4 to 2021.6.0. Unfortunately, it takes time (a few seconds) to parse the code (colorize that)! But in version 2021.5.4 it did that immediately.

S3Y3D avatar Jun 03 '21 06:06 S3Y3D

Hi I did update the Pylance from 2021.5.4 to 2021.6.0. Unfortunately, it takes time (a few seconds) to parse the code (colorize that)! But in version 2021.5.4 it did that immediately.

I try again, but it uncolorize more than 10 minutes. I think it not should be affected by computer performance. In version 2021.5.4 it also did that immediately in my PC.

stolenzc avatar Jun 03 '21 06:06 stolenzc

Thanks for the report, could you please add the logs for when you see this behavior? Instructions.

Also, which version of Python are you using?

judej avatar Jun 03 '21 17:06 judej

Thanks for the report, could you please add the logs for when you see this behavior? Instructions.

Also, which version of Python are you using?

Thanks for replay, this is the logs when I use the newset Pylance and behaviour unexpected.

And I just use the normal python download from python.org

python log: Python.log

language server log: LanguageServer.log

stolenzc avatar Jun 04 '21 01:06 stolenzc

Hi there, just came across this and here's a further data point: My issue is that the OUTLINE window doesn't always populate on VSCode startup. You can see this in my screen grab, with image

The behaviour seems intermittent as sometimes it will populate immediately, otherwise it will populate after an edit. I've attached the log and you can see my comment on line 51. pylance-log2.log

Thanks for a great product, hope this helps.

ghost avatar Jun 04 '21 09:06 ghost

Ah, another point that will be useful: I'm using VSCode with a remote machine. With this the OUTLINE window just displays "Loading document symbols for 'mycode.py'".

The interesting part of the log is:

[Error - 10:19:49] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js [Error - 10:19:49] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js [Error - 10:19:49] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js [Info - 10:19:49] Searching for source files [Info - 10:19:50] Background analysis(1) root directory: /home/a3h/.vscode-server/extensions/ms-python.vscode-pylance-2021.6.0/dist [Info - 10:19:50] Background analysis(1) started Background analysis message: setConfigOptions Background analysis message: ensurePartialStubPackages Received updated settings [Error - 10:20:01] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js [Error - 10:20:01] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js [Error - 10:20:01] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js

Is Node.js part of vs-code remote?

ghost avatar Jun 04 '21 09:06 ghost

Those error messages are not related, see #1392. Both VS Code and Pylance are written in Node; you don't need to think about that detail.

Both of you appear to be using VS Code remote; perhaps the issue lies there and there's some racy behavior happening in that.

jakebailey avatar Jun 04 '21 17:06 jakebailey

I am also running into the same error (the trace log stops at Background analysis message: ensurePartialStubPackages and nothing else happens). I am running Linux and am not using VS Code Remote. Whether the ERR_FEATURE_UNAVAILABLE_ON_PLATFORM error is unrelated is unclear since it does not occur in the previous pylance version.

For me, this issue only occurs for bigger projects. Relatively small projects don't seem to be affected. To reproduce this problem, cloning https://github.com/mesonbuild/meson should work.

Language server log:

[Info  - 9:47:45 PM] Pylance language server 2021.6.0 (pyright 209c8040) starting
[Info  - 9:47:45 PM] Server root directory: /home/daniel/.vscode/extensions/ms-python.vscode-pylance-2021.6.0/dist
[Info  - 9:47:45 PM] No configuration file found.
[Info  - 9:47:45 PM] pyproject.toml file found at /home/daniel/projects/meson.
[Info  - 9:47:45 PM] Loading pyproject.toml file at /home/daniel/projects/meson/pyproject.toml
[Error - 9:47:45 PM] Pyproject file "/home/daniel/projects/meson/pyproject.toml" is missing "[tool.pyright] section.
[Info  - 9:47:45 PM] Setting pythonPath for service "meson": "/usr/bin/python"
[Warn  - 9:47:45 PM] stubPath /home/daniel/projects/meson/typings is not a valid directory.
[Info  - 9:47:45 PM] Assuming Python version 3.9
[Info  - 9:47:45 PM] Assuming Python platform Linux
Search paths for /home/daniel/projects/meson
  /home/daniel/.vscode/extensions/ms-python.vscode-pylance-2021.6.0/dist/typeshed-fallback/stdlib
  /home/daniel/projects/meson
  /home/daniel/projects/meson/typings
  /home/daniel/.vscode/extensions/ms-python.vscode-pylance-2021.6.0/dist/typeshed-fallback/stubs/...
  /home/daniel/.vscode/extensions/ms-python.vscode-pylance-2021.6.0/dist/bundled/stubs
  /usr/lib/python39.zip
  /usr/lib/python3.9
  /usr/lib/python3.9/lib-dynload
  /home/daniel/.local/lib/python3.9/site-packages
  /usr/lib/python3.9/site-packages
[Error - 9:47:45 PM] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Error - 9:47:45 PM] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Error - 9:47:45 PM] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Error - 9:47:45 PM] Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Info  - 9:47:45 PM] Searching for source files
[Info  - 9:47:46 PM] Background analysis(1) root directory: /home/daniel/.vscode/extensions/ms-python.vscode-pylance-2021.6.0/dist
[Info  - 9:47:46 PM] Background analysis(1) started
Background analysis message: setConfigOptions
Background analysis message: ensurePartialStubPackages

mensinda avatar Jun 04 '21 19:06 mensinda

@mensinda to confirm, these are trace logs? I'm not seeing a lot of the info that normally gets printed when we're analyzing code, which either means it's the wrong log level, or we really are freezing at that point.

Do you see high CPU usage at all for the pylance process?

jakebailey avatar Jun 04 '21 19:06 jakebailey

@jakebailey Yes, this is a trace log. Comparing to the previous pylance version it is as if the log is cut of at the Background analysis message: ensurePartialStubPackages message. The noisy [BG(1)] parsing: .* stuff comes after that point.

mensinda avatar Jun 04 '21 20:06 mensinda

Also, the pylance process ( /opt/visual-studio-code/code /home/daniel/.vscode/extensions/ms-python.vscode-pylance-2021.6.0/dist/server.bundle.js ... seems to be at 0% CPU usage.

mensinda avatar Jun 04 '21 20:06 mensinda

Same issue here, using remote container on WSL2 based on VS Code remote container templates. Downgrading to v2021.5.4 fixes the issue for now.

ggirard07 avatar Jun 07 '21 14:06 ggirard07

It seems resolved In version 2021.6.1

stolenzc avatar Jun 10 '21 03:06 stolenzc

I can also confirm that the problem is gone with 2021.6.1

mensinda avatar Jun 10 '21 09:06 mensinda

The problem persists in 2021.7.5

software version
Ubuntu 20.04.2 LTS
Node 12.22.2
Python 3.8.10 GCC 9.4.0
[Info  - 1:06:23 PM] Pylance language server 2021.7.5 (pyright 06d75c6c) starting
[Info  - 1:06:23 PM] Server root directory: /home/parano/.vscode/extensions/ms-python.vscode-pylance-2021.7.5/dist
[Info  - 1:06:23 PM] Background analysis(1) root directory: /home/parano/.vscode/extensions/ms-python.vscode-pylance-2021.7.5/dist
[Info  - 1:06:23 PM] Background analysis(1) started
Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
Exception received when installing recursive file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js

parsa-ra avatar Jul 24 '21 08:07 parsa-ra

Same here with v2021.7.5

• OS: Windows 10 • VS Code Version: 1.58.2 • Pylance: v2021.7.5 • Remote – SSH Version: v0.65.7

From my Windows laptop, I work on an Ubuntu 20.04 VM using the Remote – SSH plugin, So I have configured a python3.9 virtual environment with Django3.2 and others python packages. Also, I have pylint installed and all works as expected.

The issue arises when I mount a folder inside the application media folder (inside the workspace) from another station through sshfs. What happens is that autocomplete stops working and when y press Clr+Space I just get a loading message.

This folder that I mount through sshfs is big with many files and also I note that even when I close the VScode I cannot unmount this folder because the fusermount said that the folder is used by some process (its some VScode process inside the VM). If I unmount the folder with force, then Intellisence goes back to work.

I have also excluded this media folder using the files.exclude serach.exclude and files.watcherExclude but the issue persists.

I tested with previous Pylance versions but i still facing the same issue

jrbosch avatar Jul 26 '21 09:07 jrbosch

Can you try creating a pyrightconfig.json at the root of the workspace, and add to the excludes to see if that fixes the issue? https://github.com/microsoft/pyright/blob/main/docs/configuration.md#main-pyright-config-options

If not please open a new issue.

bschnurr avatar Jul 26 '21 16:07 bschnurr

@bschnurr Amazing. I had been on this for several days. The exclude on pyrightconfig.json solve the issue. Thanks a lot !!

jrbosch avatar Jul 27 '21 11:07 jrbosch

Sorry to sound like a dummy but

  1. An empty pyrightconfig.json file?
  2. Which excludes? Thanks

72saab avatar Aug 03 '21 22:08 72saab