简体   繁体   中英

Runaway Jedi Language task in VSCode

Every time I close VSCode (after running some Python script) I have a Python task that lingers in my terminal running 90-100% CPU on my M1 MacBook Air, and I have to manually kill it every time. I ran the following on the PID:

ps aux | grep <PID>

and it returns the same thing every time...

Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python /Users/<user>/.vscode/extensions/ms-python.python-2021.2.625869727/pythonFiles/runJediLanguageServer.py

I checked my VSCode extensions, and I don't have any "Jedi" ones installed, but maybe it's a lingering task from some other extension. Any ideas how to fix this?

The solution as provided in the link Valy provided above is to:

  1. Open the command palette (View > Command Palette...)
  2. Run the "Preferences: Open Settings (JSON)" command. This will open the user settings in VS code
  3. Paste the following line in the settings file: "python.experiments.optOutFrom": ["pythonJediLSP"]
  4. Reload the window (either by closing VS Code and opening it again or running the "Developer: Reload Window" command from the command palette)

reference: Rogue Python Processes with High CPU Consumption issue #15586

I had the same issue as apparently VSC is experimenting with a new feature. Another user helped me find the solution, which can be found here: https://github.com/microsoft/vscode-python/issues/15586#issuecomment-792360066

When using python in VS Code, it requires us to install the "python" extension, and it will automatically load the corresponding language service to better identify and analyze the code.

"Visual Studio Code provides smart editing features for different programming languages through Language Extensions. VS Code doesn't provide built-in language support but offers a set of APIs that enable rich language features."

We can use different python language services: Jedi , Microsoft , Pylance , and so on, and VS Code uses Jedi by default:

在此处输入图像描述

在此处输入图像描述

Reference: Language Server Extension Guide and Language Extensions Overview .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM