VSCode学习笔记梳理
VSCODE 基本用法梳理
一。基本操作
- 新建文件 (Ctrl+N)
- 保存文件 (Ctrl+S)
- 命令行快捷键 (Ctrl+Shift+P)
- 查看扩展插件快捷键 (Ctrl+Shift+X)
- 打开所有快捷键 并编辑 (Ctrl+K Ctrl+S)
- 主题选择 (Ctrl+K Ctrl+T)
- 打开设置 (Ctrl+,)
- 编辑器操场(帮助了解怎么交互) 帮助-编辑器操场
- 快捷键PDF文件展示 (Ctrl+K Ctrl+R)
二、代码编辑
- 文件浏览器(Ctrl+Shift+E)
- 打开文件夹 (Ctrl+K Ctrl+O)
- 创建新文件 (Ctrl+N)
- 格式化代码文件 (Shift+Alt+F)
- 自动保存代码
- 打开交互终端 (Ctrl+`) 两个终端区别显示 Ctrl+Shift+5 增加一个终端显示Ctrl+Shift+`
- 显示关闭主侧栏 (Ctrl+B)
- 显示关闭面板 (Ctrl+J)
三、命令行工具
- 快速打开最近打开的文件 Ctrl+P 上下选择
- 快递定位到某个文件的行 filename:line number
- 快速定位到某一个标记位 filename@symbol name
- 可以输入 ? 选择任意一个可选命令
- 保持下拉菜单可用的情况下,使用 右箭 可以打开选择的文件
- 多光标操作(同时操作多个光标)
- Ctrl+Alt+Up Ctrl+Alt+Down 选择上下文的
- Alt+Click 选择单个的
- Ctrl+Shift+L 选择同类型的
- 使用 Ctrl+Space 触发 智能标识
四、编译Debugging
文档参考
https://code.visualstudio.com/docs/editor/debugging
- 内置插件只支持 node.js,其他语言需要下载debug插件
- 进入debug模式 Ctrl+Shift+D
- 建立一个launch.json文件协助debug
- 选择Debug的语言环境 (java;C#,Chrome)
- 在launch.json文件中配置不同类型 request:launch / request:attach
- Debug快捷键:
Continue / Pause F5
Step Over F10
Step Into F11
Step Out Shift+F11
Restart Ctrl+Shift+F5
Stop Shift+F5
7.断点:
- breakpoints 断点
- Logpoints 日志点 (不停,可以记录日志到控制台)
Launch.json attributes#
There are many launch.json
attributes to help support different debuggers and debugging scenarios. As mentioned above, you can use IntelliSense (Ctrl+Space) to see the list of available attributes once you have specified a value for the type
attribute.
The following attributes are mandatory for every launch configuration:
type
- the type of debugger to use for this launch configuration. Every installed debug extension introduces a type:node
for the built-in Node debugger, for example, orphp
andgo
for the PHP and Go extensions.request
- the request type of this launch configuration. Currently,launch
andattach
are supported.name
- the reader-friendly name to appear in the Debug launch configuration dropdown.
Here are some optional attributes available to all launch configurations:
presentation
- using theorder
,group
, andhidden
attributes in thepresentation
object, you can sort, group, and hide configurations and compounds in the Debug configuration dropdown and in the Debug quick pick.preLaunchTask
- to launch a task before the start of a debug session, set this attribute to the label of a task specified in tasks.json (in the workspace's.vscode
folder). Or, this can be set to${defaultBuildTask}
to use your default build task.postDebugTask
- to launch a task at the very end of a debug session, set this attribute to the name of a task specified in tasks.json (in the workspace's.vscode
folder).internalConsoleOptions
- this attribute controls the visibility of the Debug Console panel during a debugging session.debugServer
- for debug extension authors only: this attribute allows you to connect to a specified port instead of launching the debug adapter.serverReadyAction
- if you want to open a URL in a web browser whenever the program under debugging outputs a specific message to the debug console or integrated terminal. For details see section Automatically open a URI when debugging a server program below.
Many debuggers support some of the following attributes:
program
- executable or file to run when launching the debuggerargs
- arguments passed to the program to debugenv
- environment variables (the valuenull
can be used to "undefine" a variable)envFile
- path to dotenv file with environment variablescwd
- current working directory for finding dependencies and other filesport
- port when attaching to a running processstopOnEntry
- break immediately when the program launchesconsole
- what kind of console to use, for example,internalConsole
,integratedTerminal
, orexternalTerminal
五、版本控制
Visual Studio Code 集成了源代码控制管理 (SCM) 并包括开箱即用的 Git 支持。也可以安装其他插件支持不同的源代码控制工具。
- 创建一个分支
- 更改分支
- 在并排和内联视图中查看两个文件之间的差异
- stage和clean的变化
- 提交到您当地的分支机构
- 合并本地分支