1. VS Code 界面概览
VS Code 界面design简洁明了, 主要分 for 以 under 几个部分:
- 标题栏 (Title Bar) : 显示当 before 打开 file and file夹, 以及窗口控制按钮
- 菜单栏 (Menu Bar) : package含file, 编辑, 选择, 查看, 转 to , run, 终端, helpingetc.菜单
- 活动栏 (Activity Bar) : 位于 left 侧, package含fileresourcemanagement器, 搜索, sourcescodemanagement, run and debug, scaleetc.graph标
- 侧edge栏 (Side Bar) : 根据活动栏 选择显示不同 in 容, such asfilelist, 搜索结果, Gitstatusetc.
- 编辑器组 (Editor Groups) : in央区域, 用于编辑file, 可以分割 for many 个编辑器
- 面板 (Panel) : 位于底部, package含终端, issues, 输出, debug控制台etc.
- status栏 (Status Bar) : 位于底部, 显示当 before file statusinformation, such as行号, 列号, language模式, Gitbranchetc.
提示
您可以through拖拽各个区域 edge界来调整它们 big small , or 者using fast 捷键隐藏/显示specific区域.
2. 活动栏 (Activity Bar)
活动栏位于VS Code 最 left 侧, package含以 under graph标 ( from 顶部 to 底部) :
2.1 fileresourcemanagement器 (Explorer)
fileresourcemanagement器用于浏览 and managementprojectfile, fast 捷键 for Ctrl+Shift+E (Windows/Linux) or Cmd+Shift+E (macOS) .
2.2 搜索 (Search)
搜索functions用于 in 当 before 工作区in搜索 and replace文本, fast 捷键 for Ctrl+Shift+F (Windows/Linux) or Cmd+Shift+F (macOS) .
2.3 sourcescodemanagement (Source Control)
sourcescodemanagement用于集成Gitetc.version控制system, fast 捷键 for Ctrl+Shift+G (Windows/Linux) or Cmd+Shift+G (macOS) .
2.4 run and debug (Run and Debug)
run and debugfunctions用于run and debugcode, fast 捷键 for Ctrl+Shift+D (Windows/Linux) or Cmd+Shift+D (macOS) .
2.5 scale (Extensions)
scalefunctions用于installation and managementVS Code插件, fast 捷键 for Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS) .
2.6 test (Testing)
testfunctions用于run and managementtest, fast 捷键 for Ctrl+Shift+U (Windows/Linux) or Cmd+Shift+U (macOS) .
2.7 更 many (More)
点击活动栏底部 省略号graph标, 可以查看更 many functions.
3. 编辑器区域 (Editor)
编辑器区域 is VS Code core部分, 用于编辑codefile.
3.1 编辑器组 and 拆分编辑
VS Code允许you will编辑器区域拆分 for many 个编辑器组, 以便同时查看 and 编辑 many 个file:
- 水平拆分:
Ctrl+/code> (Windows/Linux) orCmd+/code> (macOS) - 垂直拆分:
Ctrl+Shift+\(Windows/Linux) orCmd+Shift+\(macOS) - 关闭编辑器组:
Ctrl+W(Windows/Linux) orCmd+W(macOS)
3.2 tag页management
每个打开 file都会显示 for 一个tag页, 您可以through以 under 方式managementtag页:
- 切换tag页:
Ctrl+Tab(Windows/Linux) orCmd+Tab(macOS) - 切换 to specifictag页:
Ctrl+(Windows/Linux) orCmd+(macOS) - 关闭tag页:
Ctrl+W(Windows/Linux) orCmd+W(macOS) - 关闭othertag页: right 键点击tag页, 选择"关闭othertag页"
- 固定tag页: right 键点击tag页, 选择"固定tag页"
3.3 编辑器basicoperation
编辑器 常用basicoperationincluding:
- new 建file:
Ctrl+N(Windows/Linux) orCmd+N(macOS) - 打开file:
Ctrl+O(Windows/Linux) orCmd+O(macOS) - 保存file:
Ctrl+S(Windows/Linux) orCmd+S(macOS) - 保存所 has file:
Ctrl+K S(Windows/Linux) orCmd+K S(macOS) - 关闭file:
Ctrl+W(Windows/Linux) orCmd+W(macOS)
4. 侧edge栏 (Side Bar)
侧edge栏 in 容会根据活动栏 选择而变化, under 面介绍几个常用 侧edge栏视graph:
4.1 fileresourcemanagement器视graph
fileresourcemanagement器视graph显示当 before 工作区 file and file夹structure, 您可以:
- 点击file名称打开file
- right 键点击file or file夹foroperation, such as new 建, delete, renameetc.
- 拖拽file or file夹formove
- using顶部 按钮 new 建file or file夹
4.2 搜索视graph
搜索视graph用于 in 当 before 工作区in搜索文本:
- in 搜索框in输入要搜索 文本
- in replace框in输入要replace 文本 (可选)
- using正则表达式: 点击
.*按钮 - 匹配 big small 写: 点击
Ab按钮 - 全词匹配: 点击
AA按钮 - package含 or 排除specificfile: in file匹配框in输入glob模式
4.3 sourcescodemanagement视graph
sourcescodemanagement视graph显示当 before Git仓library status:
- 显示modify过 file (已stage and 未stage)
- providingstage, submitting, push, pulletc.Gitoperation
- 显示branchinformation and submittinghistory
5. 面板 (Panel)
面板位于VS Code 底部, package含以 under 选项卡:
5.1 终端 (Terminal)
集成终端, 允许您 in VS Codein直接runcommands:
- 打开终端:
Ctrl+`(Windows/Linux/macOS) orCtrl+Shift+`(Windows/Linux/macOS) - creation new 终端: 点击终端面板 right on 角 加号按钮
- 切换终端class型: 点击终端面板 right on 角 under 拉菜单, 选择commands提示符, PowerShell, bashetc.
5.2 issues (Problems)
显示当 before 工作区in error and warninginformation, including语法error, 拼写erroretc..
5.3 输出 (Output)
显示各种scale and tool 输出information.
5.4 debug控制台 (Debug Console)
in debug过程in显示debuginformation and 执行commands.
6. status栏 (Status Bar)
status栏位于VS Code 最底部, 显示以 under information:
- 当 before file 行号, 列号 and 字符位置
- 当 before file language模式 (such asJavaScript, Pythonetc.)
- 当 before file 编码格式
- 当 before Gitbranch and 更改status
- 行号显示/隐藏切换
- 自动换行切换
- indent设置
- file保存status
- scaleupdatenotification
7. commands面板 (Command Palette)
commands面板 is VS Code 强 big functions, 可以访问所 has commands:
- 打开commands面板:
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) - in commands面板in输入commands名称 or 关键词
- using on under 箭头键选择commands
- 按Enter键执行选in commands
commands面板可以执行几乎所 has VS Codefunctions, including:
- 打开设置
- 更改language模式
- installationscale
- runtask
- 更改主题
- 执行Gitcommands
- etc.etc....
提示
commands面板 is VS Codein最强 big functions之一, 熟练usingcommands面板可以 big big improving您 工作efficiency.
8. basic导航techniques
VS Codeproviding了 many 种导航方式, helping您 fast 速定位 to code 不同部分:
8.1 行导航
- 跳转 to 指定行:
Ctrl+G(Windows/Linux) orCmd+G(macOS) , 然 after 输入行号 - 跳转 to 行首:
Home - 跳转 to 行尾:
End - 跳转 to file开头:
Ctrl+Home(Windows/Linux) orCmd+Up(macOS) - 跳转 to file结尾:
Ctrl+End(Windows/Linux) orCmd+Down(macOS)
8.2 符号导航
- 查看当 before file 符号 (such asfunction, class, variable) :
Ctrl+Shift+O(Windows/Linux) orCmd+Shift+O(macOS) - 跳转 to 定义:
F12orCtrl+Click(Windows/Linux) orCmd+Click(macOS) - 查看定义:
Alt+F12(Windows/Linux) orOption+F12(macOS) - find所 has 引用:
Shift+F12(Windows/Linux/macOS)
8.3 工作区导航
- 切换编辑器:
Ctrl+Tab(Windows/Linux) orCmd+Tab(macOS) - 切换面板:
Ctrl+Shift+\(Windows/Linux) orCmd+Shift+\(macOS) - 隐藏/显示侧edge栏:
Ctrl+B(Windows/Linux) orCmd+B(macOS) - 隐藏/显示面板:
Ctrl+J(Windows/Linux) orCmd+J(macOS)
9. 练习
练习 1: 界面布局调整
- 启动VS Code
- 调整活动栏, 侧edge栏, 编辑器区域 and 面板 big small
- 隐藏侧edge栏 (using fast 捷键)
- 显示侧edge栏 (using fast 捷键)
- 隐藏面板 (using fast 捷键)
- 显示面板 (using fast 捷键)
练习 2: 编辑器operation
- new 建一个file
- 输入一些文本 in 容
- 保存file, 命名 for
test.txt - 水平拆分编辑器
- in right 侧编辑器in打开
test.txtfile - in left 侧编辑器inmodifyfile in 容, 观察 right 侧编辑器 变化
- 关闭一个编辑器
练习 3: usingcommands面板
- 打开commands面板
- usingcommands面板打开设置
- usingcommands面板更改主题
- usingcommands面板installation一个scale (such asChinese Language Pack)
- usingcommands面板打开终端
练习 4: 导航techniques
- 打开一个较 long codefile (such as果没 has , 可以creation一个)
- using fast 捷键跳转 to 第50行
- using fast 捷键跳转 to file开头
- using fast 捷键跳转 to file结尾
- using符号导航查看filein function and class
- 尝试跳转 to 某个function 定义