This is the 12th day of my participation in the August More Text Challenge. For details, see:August is more challenging

Visual Studio Code (VS Code/VSC for short) is a free, open source, modern, lightweight code editor. Support for syntax highlighting, intelligent code completion, custom shortcuts, bracket matching and color differentiation, code snippets, code contrast Diff, GIT commands, and other features in almost all major development languages. Plug-in extensions are supported, and optimized for web development and cloud application development.


All in all, VS Code is a really good editor to use

But sometimes shortcuts can be a disadvantage when you’re writing. Sometimes you can type a shortcut that doesn’t follow the command you’re looking for. This is evident when writing markDown in VS Code.

This is where you need to configure yourself in a code snippet, and the configuration here is simple

Open in the upper left cornerFile -> Preferences -> User fragment, an input box will pop up

Enter markdown in the input box to find the snippet configuration for markdown.json

Json with a large section of commented code above markdown.json, here is an Example

  • “Print to console” is the title of the shortcut statement
  • Prefix is the command triggered by the shortcut statement, which is the keyword
  • Body is what it looks like after firing, using 1,1,1,2, etc to specify the cursor position. These numbers specify the order in which the cursor moves. $indicates the cursor position, where you can move the cursor to where you want it to be after firing (which I find very nice)
  • Description is the function description of the shortcut statement

I often write “““ snippets in MarkDown, but I often have to type them out myself, so it’s very inconvenient

So I wrote my own snippets of JavaScript, CSS, and HTML that are commonly used

"Print to ```javascript": {
	"prefix": "```js"."body": [
		"```javascript"."$1"."$2"."` ` `",]."description": "Js code snippets"
},
"Print to ```css": {
	"prefix": "```css"."body": [
		"```css"."$1"."$2"."` ` `",]."description": "CSS snippets"
},
"Print to ```html": {
	"prefix": "```html"."body": [
		"```html"."$1"."$2"."` ` `",]."description": "HTML snippets"
},
Copy the code

All right, now let’s see if we can get a quick prompt

I can’t, failed in markdown input ‘ ‘js failed to appear the corresponding prompt

You can change javascript. Json like this and it will work

You’ll notice that if it’s markdown.json, you need to add the editor shortcut editor.quickSuggestions setting to setting.json

"[markdown]": {"editor.quickSuggestions": true
}
Copy the code

Open vs Code Settings, File -> Preferences -> Settings -> Open Settings (in the upper right corner of Settings)




After you’ve added it, save it, and you can use the shortcut keys you just added