Search code examples
pythonvisual-studio-codevscode-python

How do I have VS Code only autocomplete names in Python?


Recently (currently on 1.58.2), it seems like VS Code became far more "helpful" when autocompleting names. Before, I could type

except pydantic.Val

Then when hitting Tab I'd end up with

except pydantic.ValidationError

but now in cases from built-ins like int to third party libraries, VS Code gets suuuuper helpful and thinks I want to call it and gives me the signature as a snippet:

enter image description here

How do I get the "dumber" behavior back? I'm fine for smart, but IMHO I should at least need to signal for it with an open-paren, rather than it vomiting text I need to manually select to remove.


My current settings are pretty dull:

{
    "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"
    }
}

there's the setting python.autoComplete.addBrackets that is currently the default false, even if I make it explicit in my settings, or set it true, there's no difference as far as I can tell.

Extensions:

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

Solution

  • You are using the JediLSP Language Server, isn't it?

    You can modify the parameter and jump to the next one with Tab.

    Could you try to switch to Pylance Language Server? It is still with the "dumber" behavior. You can set this in the settings.json file:

    "python.languageServer": "Pylance",