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

Enabling Blockman while viewing PySide6 function definitions causes VSCode and Pylance to hang #137

Open
myuanz opened this issue May 7, 2024 · 1 comment

Comments

@myuanz
Copy link

myuanz commented May 7, 2024

It seems to be caused by the excessive length of the PySide6 pyi files.

Environment data

  • Blockman version: 1.7.7
  • Language Server version: Pylance language server 2024.4.106 (pyright version 1.1.360, commit 4bc8428d)
  • OS and version: Windows 10 20H2 19045.4291
  • Python version: Python 3.11.3
  • PySide version: 6.7.0

Code Snippet

from PySide6.QtCore import Signal, QObject


class MyObject(QObject):
    t1 = Signal()

o = MyObject()

Repro Steps

  1. Enable blockman
  2. Open a Python project in VSCode that uses the PySide6 library
  3. Hover over QObject or any other PySide6 class/function and press F12 to go to its definition
  4. Try to go to the definition of another class/function by pressing F12 again
bug-report.mp4

Expected behavior

F12 should smoothly switch between different class/function definitions without freezing.

Actual behavior

  1. After using F12 to go to a definition in PySide6 for the first time, subsequent uses of F12 cause Pylance to hang and become unresponsive for dozens of seconds. This also affects other VSCode functionalities such as creating new files.
  2. When working in an SSH Remote environment, this issue also cause the SSH connection to drop. Remote system is Ubuntu 23.10, other softwares version is same to this issue.

Logs

Pylance log link: https://github.com/myuanz/pylance-pyside-hang/blob/master/test2.log

I'm not sure how to view the Blockman log, but there seem to be some traces in the Pylance log:
microsoft/pylance-release#5847 (comment)

@leodevbro
Copy link
Owner

leodevbro commented May 16, 2024

Hello, thanks for the report. The thing is that Blockman uses third party libraries for parsing/tokenizing, because VS Code does not give extensions access to the native AST tokens.

For Python language, Blockman uses dt-python-parser, which is not exactly optimized for finding block start-end locations (tokens), it tokenizes everything in the Python code. And maybe it is the reason that it overanalyzes the file and causes freezing.

I will try to implement other libraries (more optimized, or more stable libraries) for parsing/tokenizing in Blockman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants