zoukankan      html  css  js  c++  java
  • vscode如何自定义补全内容,自定义常用的快捷方式?

    step1
    vscode中按ctrl+shift+p,然后输入snippet,点击这个:
    在这里插入图片描述
    选择对应的语言,随后出现.json文件,这里以go语言为例:
    在这里插入图片描述
    step2:加入自己设定的快捷方式
    这段英文其实已经告诉你怎么定义了,不懂的可以看我的示例:

    {
    	// Place your snippets for go here. Each snippet is defined under a snippet name and has a prefix, body and 
    	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
    	// same ids are connected.
    	// Example:
    	// "Print to console": {
    	// 	"prefix": "log",
    	// 	"body": [
    	// 		"console.log('$1');",
    	// 		"$2"
    	// 	],
    	// 	"description": "Log output to console"
    	// }
    	//这是我自己定义的快捷方式
    	"pln":{  
    		"prefix": "pln",//输入"pln"时
    		"body": "fmt.Println($0)",//自动补全"fmt.Println($0)"
    		"description": "fmt.Println()"//描述,随便写
    	},
    	"plf":{  
    		"prefix": "plf",//输入"plf"时
    		"body": "fmt.Printf($0)",//自动补全"fmt.Printf($0)"
    		"description": "fmt.Printf()"//描述,随便写
    	}
    
    }
    

    step3:当我在编辑器中输入pln时:会自动弹出
    在这里插入图片描述
    然后回车即可:
    在这里插入图片描述
    若想一个名字的快捷方式有多个补全的可能,在.json文件中定义多个快捷方式(同prefix不同body)即可

  • 相关阅读:
    es之零停机重新索引数据
    es之索引的别名操作
    es索引基本操作(2)之 索引映射(mappings)管理和索引库配置管理(settings)
    进程管理(八)-进程控制
    进程管理(七)-进程状态与转换
    进程管理(六)-进程的描述
    numpy数组转置与轴变换
    numpy数组的索引和切片
    numpy数组的运算
    numpy库中数组的数据类型
  • 原文地址:https://www.cnblogs.com/Luweir/p/14147258.html
Copyright © 2011-2022 走看看