vscode常用操作
Easul Lv6

常用插件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
All Autocomplete
Auto Close Tag
Auto Rename Tag
Beautify
Bracket Pair Colorizer
Browser Preview
C#
Language
codewhisperer-aws代码提示
Cloudfoundry Manifest YML Support
Concourse CI Pipeline Editor
Debugger for Java
ESLint
EasyCode-不限量GPT3.5
HTML CSS Support
HTML Snippets
Java Extension Pack
Java Test Runner
JavaScript (ES6) code snippets
jQuery Code Snippets
Language support for Java(TM) by Red Hat
Lombok Annotations Support for VS Code
Markdown All in One
Markdown Preview Enhanced
Markdown Preview Github Styling
Maven for Java
NuGet Package Manager
Project Manager for Java
Remote - SSH
Remote - SSH: Editing Configuration Files
Scala (Metals)
ScalaSnippets
Spring Boot Dashboard
Spring Boot Extension Pack
Spring Boot Support
Spring Boot Tools
Spring Initializr Java Support
Tomcat for Java
Visual Studio IntelliCode
vscode-pdf
XML

快捷键

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
显示命令面板: CTRL + SHIFT + P
新创建一个页面: CTRL + N
剪切行: CTRL + X
复制行: CTRL + C
上下移动本行: ALT + 上下箭头
向上向下复制本行: SHIFT + ALT + 上下箭头
删除本行: CTRL + SHIFT + K
行注释: CTRL + /
块注释: SHIFT + ALT + A
撤销: CTRL + Z
重写: CTRL + SHIFT +Z或CTRL + Y
查找: CTRL + F
全局查找: CTRL + SHIFT + F
替换: CTRL + H
拆分编辑器: CTRL + \
全部保存: CTRL + K S
字体变大变小: CTRL 和+/-
显示隐藏侧边栏: CTRL + B
显示隐藏控制台: CTRL + J
打开应用市场: CTRL + SHIFT + X
打开配置文件: CTRL + ,(点击右上角的打开设置按钮可以直接编辑json)
打开资源管理器: CTRL + SHIFT + E
打开最近的目录: CTRL + R

用户配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
"workbench.colorTheme": "Default Light+",
"workbench.activityBar.visible": false,
"breadcrumbs.enabled": false,
"update.mode": "none",
"workbench.startupEditor": "newUntitledFile",
"editor.minimap.enabled": false,
"java.home": "/opt/apps/jdk-11.0.7",
"java.configuration.runtimes": "/home/easul/software/java-se-8u41-ri/",
"spring-boot.ls.java.home": "/root/software/jdk-11.0.7/",
"maven.executable.path": "/opt/apps/maven-3.6.3/bin/mvn",
"java.configuration.maven.userSettings": "/opt/apps/maven-3.6.3/conf/settings.xml",
"maven.terminal.customEnv": [
{
"environmentVariable": "JAVA_HOME",
"value": "/opt/apps/jdk-11.0.7"
}
],
"explorer.confirmDelete": false,
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:\"/home/easul/.vscode-insiders/extensions/gabrielbb.vscode-lombok-1.0.1/server/lombok.jar\"",
"java.project.importOnFirstTimeStartup": "automatic",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"git.ignoreLegacyWarning": true,
"window.zoomLevel": 0,
"java.refactor.renameFromFileExplorer": "autoApply",
"[json]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"browser-preview.chromeExecutable": "/opt/google/chrome/google-chrome",
}

代码片段

文件->首选项->用户片段

html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
// Place your snippets for html 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"
// }
"init html": {
"prefix": "htmlInit",
"body": [
"<!DOCTYPE html>",
"<html>",
" <head>",
" <meta charset=\"UTF-8\">",
" <link rel=\"stylesheet\" href=\"\"/>",
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
" </head>",
" <body>",
" <script src=\"\"></script>",
" </body>",
"</html>"
],
"description": "html init"
}
}

java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
// Place your snippets for java 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"
// }
"sout": {
"prefix": "sout",
"body": [
"System.out.println($1);"
],
"description": "get print code"
},
"psvm": {
"prefix": "psvm",
"body": [
"public static void main(String[] args) {",
" $1",
"}"
],
"description": "get main code"
},
"project": {
"prefix": "project",
"body": [
"/**",
" * @Author: Easul Wang",
" * @Date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
" * @Last Modified by: DALIU",
" * @Last Modified time: 2020-09-11 11:18:59",
" */"
],
"description": "author informations"
}
}

代理配置

安装了Remote - SSH之后可以用

1
2
3
4
5
Host wx
HostName 192.168.2.1
User root
Port 2222
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p

参考

win下修改插件位置

默认位置在C:\Users\用户名\.vscode\extensions
右击vscode快捷方式,点击属性,在目标中追加如下代码,路径可以换为自己的

1
--extensions-dir "D:\Software\Microsoft VS Code Insiders\extensions"  

这样就可以将插件下载位置移动到自定义位置了

远程连接ssh开发

主要用于本地直接在远程服务器进行开发操作,界面与各种操作同vscode并无区别
插件市场安装Remote - SSHRemote - SSH: Editing Configuration Files
win10自带SSH,可参考这篇文章,没有SSH的进行如下操作

  • ​从这个链接下载软件,解压到自己的相关目录里
  • 右键此电脑属性高级系统设置环境变量,在系统变量的path里边加一条变量,变量的内容为OpenSSH的解压路径
  • 在cmd输入ssh,有输出则配置成功

Linux无需进行这些操作

然后在vscode键入CTRL+SHIFT+P,输入ssh,选择Remote-SSH:Settings,勾选Show Login Terminal
这个时候左下角会出现一个绿色区域对尖号,点击左下角的对尖号,点击Open SSH Configuration File..
选择用户目录下的.ssh/config这一项,然后配置自己的远程登录信息。免密证书可以点这里查看如何创建

1
2
3
4
Host 主机名
HostName 服务器IP地址
User root
IdentityFile ~/.ssh/自己的免密证书名称

配置好后再次点击左下角的对尖号,点击Connect to Host,点击刚刚的主机名,就可以自动连接到自己的服务器了。

如果出现It is required that your private key files are NOT accessible by others,是因为私钥权限太开放。进行如下操作即可

Windows则按下列步骤进行操作

  • 找到.ssh文件夹。
  • 右键单击.ssh文件夹,然后单击属性
  • 找到并点击安全标签。
  • 然后单击高级
  • 单击禁用继承,出现警告弹出窗口,单击从此对象中删除所有继承的权限确定
  • 所有用户都将被删除,然后保存退出。
  • 进入.ssh文件夹,授予该用户操作权限即可再次登陆。

Linux直接给刚刚的免密证书修改下权限即可

1
chmod 600 免密证书路径

参考