question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Snippets do not work for Python

See original GitHub issue

Environment data

  • VS Code version: 1.52.1
  • Extension version (available under the Extensions sidebar): v2021.1.502429796
  • OS and version: macOS 11.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.1, homebrew
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Jedi

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

Code Snippets do not work for Python. This has worked for me before.

Actual behaviour

For example, if I type the def keyword, code normally snows a popup to insert a snippet which contains a basic definition of a Python function. The snippet for the function no longer works. The def keyword is entered and the snippet is not created.

Screen Shot 2021-01-24 at 14 19 48

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

Here is an example with the for keyword. Normally, I would see a popup for several types of for statements. This is no longer working.

Screen Shot 2021-01-24 at 16 48 39

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

No text output is displayed.

Screen Shot 2021-01-25 at 06 23 43

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
chemacortescommented, Jan 25, 2021

Any idea on how to downgrade to the previous version?

You can install any previous version like this:

version downgrading

3reactions
luabudcommented, Jan 26, 2021

Hey folks, sorry for the frustration! The main feedback we got from our snippets is that they’re actually confusing and overwhelming, especially to beginners and students. We often heard they were annoying too, so we ended up removing them. I understand they can still be pretty useful though, I use custom snippets myself. If you want them back you can copy them from here, and then create snippets in VS Code (instructions can be found here: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets). Additionally, as @mikemadden42 pointed out in this comment, you can also get additional snippets through this extension: https://marketplace.visualstudio.com/items?itemName=frhtylcn.pythonsnippets. This way you can still get updates from the Python extension and keep using the snippets 😊

I’m closing this issue as we don’t intend to bring back the snippets for now, at least not until we have a mechanism to make it play nice with Pylance in VS Code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code python snippets are not working in my vscode
I've been using VS Code from a week and I want to use VS Code built-in Python snippets but it is not working...
Read more >
python-snippets - Visual Studio Marketplace
If you experience problems with the auto-formatting of certain snippets, make sure you have the option editor.tabCompletion set on onlySnippets ...
Read more >
13 Python Code Snippets You Need to Know - Built In
There are many snippets out there for Python categorized by field but, for this article, I'll focus on general-purpose snippets you can use...
Read more >
Snippets and tasks - Modern Python Developer's Toolkit
Here is how this snippet works: "Print to console" - this is the name of the snippet. It will be displayed in the...
Read more >
Automating Snippets in Visual Studio Code with Python
So why not automate this process with Python, so that when you write some code that ... To do this all you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found