Ray*_*nth 5 python visual-studio-code
在开始教朋友如何用 Python 编写代码时,我在他的 VSCode 中观察到一些与我自己的不同的东西 - 他可以将鼠标悬停在 Python 关键字(例如 asimport
或 )上def
,并且会显示该关键字的 Python 手册定义。我自己的 VSCode 没有这样做。
我已经尝试了所有我能想到的方法来找出为什么这对我不起作用,但我完全不知所措。我将我的安装过程与我朋友的安装过程进行了比较,按照我为他提供的完全相同的步骤来设置他的环境,但没有得到相同的结果。我尝试从我的笔记本电脑中完全删除 Python、VSCode 和所有残留的 VSCode 文件,并按照他所做的顺序重新安装,但仍然无济于事。
我在工作时在另一台笔记本电脑上执行了相同的步骤,我可以让 MouseHover 在那里工作。我能想到的唯一可行的区别是,我的工作机器没有使用与我的家用电脑和笔记本电脑相同的 Windows 帐户 - 但我没有启用“设置同步”,所以我不明白为什么这很重要。
为了让这个功能在 VSCode 中正常工作,我有什么想法吗?我不是特别需要它,但我想在教我的朋友时和他处于相同的环境中。
我们都使用 VSCode 1.55.2、Python 3.9.4,使用从 VSCode 的 Powershell 终端创建的虚拟环境,然后重新启动 VSCode 以使其检测虚拟环境并将其用作终端的默认环境,最后安装并启用 pip Pylint 作为 linter。
接下来是编辑添加步骤 - 在完全删除 VisualStudio2019 和 Code 以及 Python 的所有痕迹之后,我刚刚在我的家用笔记本电脑上再次经历了所有这些。注意:这是在 Windows 10 上进行的,并且应用了所有更新
something.py
在资源管理器窗格中创建pylint
未安装、允许安装或pip install pylint
从 venv 手动安装。something.py
输出import random
import
——这就是差异。在我的两台家用机器上,没有鼠标悬停任何东西。在我朋友的两台机器以及我工作的机器上,显示以下内容:在 riov8 对原始帖子的评论的帮助下,我能够比较每个环境中有效的实验组。
\npythonJediLSP
,pythonJediLSPcf
或如果\n两者都没有。如果您遇到我描述的问题,那么在同一面板的底部,当您第一次将鼠标悬停在 python关键字上时上时,您将收到类似于以下内容的错误:
\nError 2021-04-16 15:33:40: stderr jediProxy Error (stderr) %UserProfile%\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\completion.py:598: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`\n sys_path=sys.path,\n%UserProfile%\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\completion.py:598: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`\n sys_path=sys.path,\n\nError 2021-04-16 15:33:40: stderr jediProxy Error (stderr) %UserProfile%\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\completion.py:598: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead.\n sys_path=sys.path,\n\nError 2021-04-16 15:33:40: stderr jediProxy Error (stderr) %UserProfile%\\.vscode\\extensions\\ms-python.python-2021.3.680753044\\pythonFiles\\completion.py:626: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.\n script.goto_definitions(), request["id"]\n
Run Code Online (Sandbox Code Playgroud)\n以下场景为我解决了这个问题:
\npythonJediLSPcf
:python.experiment
Edit in settings.json
"python.experiments.optOutFrom"
,添加"pythonJediLSPcf"
(引用)"python.experiments.optInto"
"pythonJediLSP"
(引用)pythonJediLSPcf
或pythonJediLSP
:python.experiment
Edit in settings.json
"python.experiments.optInto
部分中,添加"pythonJediLSP"
(引用)pythonJediLSP
:pythonJediLSPcf
. 如果您这样做,请按照第一个小标题中的说明将其禁用。如果它仍然不起作用,那么可能还有另一个我自己没有经历过的冲突。我正在发布有关此问题的 GitHub 问题,并将在完成后使用链接更新此答案。
\n 归档时间: |
|
查看次数: |
4435 次 |
最近记录: |