最近(当前为 1.58.2),VS Code 在自动完成名称时似乎变得更加“有用”。以前,我可以输入
然后当点击Tab时我会得到
except pydantic.ValidationError
但现在,在从 int
这样的内置函数到第三方库的情况下,VS Code 会得到 suuuuper 的帮助,并认为我想调用它并给我签名:一个片段:
如何恢复“愚蠢”行为?我很聪明,但恕我直言,我至少应该需要用开放括号来表示它,而不是它呕吐我需要手动选择删除的文本。
我当前的设置非常乏味:
{
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"window.titleBarStyle": "custom",
"gitlens.blame.separateLines": false,
"gitlens.codeLens.enabled": false,
"editor.renderWhitespace": "all",
"python.formatting.blackArgs": [
"--experimental-string-processing"
],
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"window.zoomLevel": 1,
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
}
}
设置python.autoComplete.addBrackets
目前是默认的false
,即使我在我的设置中明确说明,或者将其设置为true
,据我所知没有什么区别。
扩展:
eamodio.gitlens
EFanZh.graphviz-preview
joaompinto.vscode-graphviz
lextudio.restructuredtext
mechatroner.rainbow-csv
ms-azuretools.vscode-docker
ms-python.python
ms-toolsai.jupyter
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.sublime-keybindings
mscgenjs.vscode-mscgen
rust-lang.rust
samuelcolvin.jinjahtml
sleistner.vscode-fileutils
tamasfe.even-better-toml
tsandall.opa
最佳答案
您正在使用 JediLSP
语言服务器,不是吗?
可以修改参数并通过Tab
跳转到下一个参数。
您可以尝试切换到 Pylance
语言服务器吗?依然是“笨”的行为。您可以在settings.json 文件中进行设置:
"python.languageServer": "Pylance",
关于python - 如何在 Python 中仅使用 VS Code 自动完成名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68628046/