简体   繁体   English

VSCode 中的失控绝地语言任务

[英]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.每次我关闭 VSCode(在运行一些 Python 脚本之后)我都有一个 Python 任务在我的终端中徘徊,在我的 M1 MacBook Air 上运行 90-100% CPU,我每次都必须手动杀死它。 I ran the following on the PID:我在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.我检查了我的 VSCode 扩展,我没有安装任何“Jedi”扩展,但也许这是其他扩展的一个挥之不去的任务。 Any ideas how to fix this?任何想法如何解决这一问题?

The solution as provided in the link Valy provided above is to:上面提供的 Valy 链接中提供的解决方案是:

  1. Open the command palette (View > Command Palette...)打开命令面板(视图 > 命令面板...)
  2. Run the "Preferences: Open Settings (JSON)" command.运行“首选项:打开设置 (JSON)”命令。 This will open the user settings in VS code这将在 VS 代码中打开用户设置
  3. Paste the following line in the settings file: "python.experiments.optOutFrom": ["pythonJediLSP"]将以下行粘贴到设置文件中:“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)重新加载 window(通过关闭 VS Code 并再次打开它或从命令面板运行“开发人员:重新加载窗口”命令)

reference: Rogue Python Processes with High CPU Consumption issue #15586参考: Rogue Python 进程 CPU 消耗高问题 #15586

I had the same issue as apparently VSC is experimenting with a new feature.我遇到了同样的问题,显然 VSC 正在试验一项新功能。 Another user helped me find the solution, which can be found here: https://github.com/microsoft/vscode-python/issues/15586#issuecomment-792360066另一个用户帮我找到了解决方案,可以在这里找到: 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.在 VS Code 中使用 python 时,需要我们安装“python”扩展,它会自动加载相应的语言服务,以便更好地识别和分析代码。

"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." “Visual Studio Code 通过 Language Extensions 为不同的编程语言提供智能编辑功能。VS Code 不提供内置语言支持,但提供了一组支持丰富语言功能的 API。”

We can use different python language services: Jedi , Microsoft , Pylance , and so on, and VS Code uses Jedi by default:我们可以使用不同的 python 语言服务: JediMicrosoftPylance等,VS Code 默认使用Jedi

在此处输入图像描述

在此处输入图像描述

Reference: Language Server Extension Guide and Language Extensions Overview .参考: 语言服务器扩展指南语言扩展概述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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