Getting Started
命令及快捷键
interface overview
- Find and run all commands: Ctrl+Shift+P
- File explore: Ctrl+Shift+E
- Search across files: Ctrl+Shift+F
- Source code management: Ctrl+Shift+G
- Launch and debug: Ctrl+Shift+D
- Mange extensions: Ctrl+Shift+X
- View errors and warnings: Ctrl+Shift+M
- Toggle integrated terminal: Ctrl+`
Help
- Help:welcom
Themem
- Preferences:color theme
- Preferences: file color theme
Keyboard
- Preferences: Open Default Keyboard Shortcuts File
File
- Quick open: C+P
- File: Quick Open Rencent 或者: C+P C+P
- Quick open multi fules: C+P →
选择
- 收缩/扩展选中:S+A+←/→
- 选中当前行:C+I
Go to Symbol in File
- C+S+O
Go to Symbol in Workspace
- C+T
Navigate to a specific line
- C+G
Undo cursor position
- Keyboard Shortcut: Ctrl+U
Trim trailing whitespace(修剪尾部空格)
Keyboard Shortcut: Ctrl+K Ctrl+X
VSCode code
VSCode 提供了强大的 code 工具。
# open code with current directory
code .
# open the current directory in the most recently used code window
code -r .
# create a new window
code -n
# change the language
code --locale=es
# open diff editor
code --diff <file1> <file2>
# open file at specific line and column <file:line[:character]>
code --goto package.json:10:5
# see help options
code --help
# disable all extensions
code --disable-extensions .
Side Bar
- 切换Side Bar: C+B
Zen mode
- C-K Z
Side by side Editing
- 新建:C+\
- 关闭:C+W 或 C+F4
- 切换:C+1/2,3
Navigation history
- Navigate entire history: Ctrl+Tab
- Navigate back: Alt+Left
- Navigate forward: Alt+Right
Markdown
- 快速提示:quickSuggestions 【Settings】
- Open Markdown Preview:C+S+V
- Side by Side Markdown Edit and Preview:Ctrl+K V
Interactive Editor Playground
Multi-Cursor Editing
非常重要的几个命令,尤其是 C+S+L
- Box Selection —— C+S+A+↑/↓/←/→
- Add a cursor —— C+A+↑/↓
- Create cursors on all occurrences of a string —— C+S+L
IntelliSense
- C-Space
?
Line Actions
- 拷贝一行并且插入到上一行或者下一行: S+A+↑/↓
- 移动一行到上一行或者下一行:A+↑/↓
- 删除一整行:C+S+K
- Join lines
Rename Refactoring
更名重构:
批量修改变量或者函数名称。
使用 F2
Refactoring via Extraction
有时,您希望将已编写的代码重构成单独的函数或常数,以便以后重用它。
?
Formatting
格式化整个文档: S+A+F
格式化当前选中部分: C+K C+F
附加的 格式化工具,如 clang-format.
Setting: editor.formatOnSave - 设置保存时自动格式化
Code Folding
在大型文件中,经常折叠代码段以提高可读性通常是有用的。
- 折叠展开:C+S+[/]
- 全部折叠:C+K C+0
折叠代码是以缩进为基础的,因此可以适用于所有的语言。只需缩进代码以创建一个可折叠的部分,就可以使用快捷方式折叠一定数量的级别,如Ctrl+K Ctrl+1到Ctrl+K Ctrl+5。
Errors and Warnings
当您用代码编辑代码时,错误和警告会被高亮显示。在下面的示例中,您可以看到许多语法错误。通过按下F8,您可以依次浏览它们并查看详细的错误消息。当您纠正它们时,会出现斜杠和滚动条指示器。
Snippets
通过使用片段,可以极大地加快编辑速度。只需开始键入尝试并从建议列表中选择Trycatch,然后按Tab创建一个Test-> catch块。您的光标将被放置在文本错误,以便于编辑。如果存在不止一个参数,则按Tab跳转到它。
- 通过插件安装各种语言的片段
- Preferences:Configure user snippets : 配置用户自定义的片段
Emmet
Emmet 将代码片段的思想带到了一个全新的层次:可以输入可以动态解析的CSS类表达式,并根据在缩写中输入的内容生成输出。
??
JavaScript Type Checking
- 在workspace或application中使能Javascript的 type checking:"Javascript.implicitProjectConfig.checkJs": true
https://code.visualstudio.com/docs
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem(生态系统) of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity). Begin your journey with VS Code with these introductory videos.
First Steps
To get the most out of Visual Studio Code, start by reviewing a few introductory topics:
Intro Videos - Begin your journey with VS Code through these introductory videos.
Setup - Install VS Code for your platform and configure the tool set for your development needs.
User Interface - Introduction to the basic UI, commands, and features of the VS Code editor.
Settings - Customize VS Code for how you like to work.
Languages - Learn about VS Code's support for your favorite programming languages.
Node.js - This tutorial gets you quickly running and debugging a Node.js web app.
Tips and Tricks - Jump right in with Tips and Tricks to become a VS Code power user.
Azure - VS Code is great for deploying your web applications to the cloud.
Community - Connect with the VS Code community and check out other ways to learn VS Code.
Why VS Code? - Read about the design philosophy and architecture of VS Code.
Keyboard Shortcuts
Increase your productivity with VS Code's keyboard shortcuts.
Keyboard Shortcut Reference Sheet - Learn the commonly used keyboard shortcuts.
Keymap Extensions - Change VS Code's keyboard shortcuts to match another editor.
Customize Keyboard Shortcuts - Modify the default keyboard shortcuts.
Downloads
Download VS Code - Quickly find the appropriate install for your platform (Windows, macOS and Linux).
Privacy
By default, VS Code auto-updates to new versions, and collects usage data and crash report information. You may opt out of these defaults by disabling them as instructed below:
How do I disable auto update?
How do I disable crash reporting?
How do I disable usage reporting?