[VSCode] I made a user snippet for Python print f-string

I like print's f-string debugging (written as print (f" {○○○ =} "), which was adopted in Python 3.8. However, with VS Code, the amount of typing is quite large even if you use Intellisense, so I made a snippet myself.

・ How to make a user snippet Menu> "Code"> "Preferences"> Select "User Snippets"> Search for "Python" in the "Search Box"> "python.json" file opens

Add the following description;

python.json


{
	"Print f-string debugging": {
		"prefix": "print",
		"body": [
			"print(f\"{$1 = }\")",
		],
		"description": "print(f\"{ = }\")"
	},
	"Print with quote": {
		"prefix": "print",
		"body": [
			"print(\"$1\")",
		],
		"description": "print(\"\")"
	},
}

Below is a brief explanation;

--The name "Print f-string debugging" doesn't really matter.

-"prefix" is the character that triggers the snippet.

-"body" is the character that is actually entered. " must be escaped with\, $ 1 will be the cursor position, and $ 2, $ 3 ,, will be the next move position when the Tab key is pressed. ..

-"description" is the description when the snippet is displayed.

-"Print with quote" is a snippet of print ("") that I made incidentally.

I use this snippet a lot.

Recommended Posts

[VSCode] I made a user snippet for Python print f-string
I made a script in Python to convert a text file for JSON (for vscode user snippet)
I made a python dictionary file for Neocomplete
I made a python text
I made a user management tool for Let's Chat
I made a VM that runs OpenCV for Python
[Python] I made a classifier for irises [Machine learning]
I made a Line-bot using Python!
I made a fortune with Python.
I made a daemon with Python
Python> I made a test code for my own external file
I made a lot of files for RDP connection with Python
I made a scaffolding tool for the Python web framework Bottle
I made a Python wrapper library for docomo image recognition API.
I made a dash docset for Holoviews
I made a payroll program in Python!
I made a character counter with Python
I made a Hex map with Python
After studying Python3, I made a Slackbot
I made a roguelike game with Python
I made a simple blackjack with Python
I made a configuration file with Python
I made a library for actuarial science
A textbook for beginners made by Python beginners
I made a neuron simulator with Python
I made a competitive programming glossary with Python
I made a weather forecast bot-like with Python.
I made a spare2 cheaper algorithm for uWSGI
I made a useful tool for Digital Ocean
I made a GUI application with Python + PyQt5
I made a Twitter fujoshi blocker with Python ①
Procedure for creating a LineBot made with Python
[Python] I made a Youtube Downloader with Tkinter.
I made a downloader for word distributed expression
I made a peeping prevention product for telework.
I made a Caesar cryptographic program in Python.
I made a bin picking game with Python
I made a Mattermost bot with Python (+ Flask)
I made a Python Qiita API wrapper "qiipy"
〇✕ I made a game
I made a prime number generation program in Python
I made a Christmas tree lighting game with Python
I made a cleaning tool for Google Container Registry
I made a net news notification app with Python
I made a script to put a snippet in README.md
I made a Python module to translate comment outs
I made a Python3 environment on Ubuntu with direnv.
I made a LINE BOT with Python and Heroku
I made a prime number generation program in Python 2
I made a python library to do rolling rank
kabu Station® API-I made a Python wrapper for REST API
I made a package to filter time series with python
I made blackjack with python!
I made a quick feed reader using feedparser in Python
I made a simple book application with python + Flask ~ Introduction ~
I made a resource monitor for Raspberry Pi with a spreadsheet
I made a learning kit for word2vec / doc2vec / GloVe / fastText
I made a face diagnosis AI for a female professional golfer ③
I made a puzzle game (like) with Tkinter in Python
Made a command for FizzBuzz
I made a discord bot