VS Code No Longer Shows Default Code Snippet for Python
Asked Answered
P

2

12

For some unknown reasons, my VS code no longer shows the default code snippets for Python.

Below is what I see when I type for in the editor (to write the for loop)

enter image description here

I'm expecting to see something like below:

enter image description here

All snippets seem to be missing. Not just the one for for loop.

Things that I have tried:

  1. Re-install VS Code (from scratch by removing the 3 folders as stated in another SO)
  2. Changed the language server from Jedi to Microsoft (as shown below)
  3. Enable snippet suggestions (as shown below)
  4. Enable Pylance extension

enter image description here

Any help is highly appreciated

Ponceau answered 9/2, 2021 at 7:22 Comment(0)
U
1

It appears to me as 2 possibilities:

  1. VS code Python extension problem.
  2. Python version you are using.

I personally think this problem is more toward VS code extension issue. Try to update Python extension or even downgrade extension version. It might help. If it doesnt, you would probably need to look at common issues of the Python version you are using.

Cheers

Unruh answered 9/2, 2021 at 8:5 Comment(1)
You're right. Downgrading the VS Python extension works. Should have tried that first.Ponceau
H
41

The Python code snippets were removed from the Python extension for Visual Studio Code in the 2021.1.0 (21 January 2021) release. The reasoning was that it was seen causing more harm than helping the user. See for example: Don't suggest Code snippets for import statements

If you want to, you can copy the old snippets (or part of them), and add them as your own snippets.

Hammurabi answered 9/2, 2021 at 8:57 Comment(1)
Thanks for this tip! A real time saver!Discrepant
U
1

It appears to me as 2 possibilities:

  1. VS code Python extension problem.
  2. Python version you are using.

I personally think this problem is more toward VS code extension issue. Try to update Python extension or even downgrade extension version. It might help. If it doesnt, you would probably need to look at common issues of the Python version you are using.

Cheers

Unruh answered 9/2, 2021 at 8:5 Comment(1)
You're right. Downgrading the VS Python extension works. Should have tried that first.Ponceau

© 2022 - 2024 — McMap. All rights reserved.