mirror of
https://github.com/Estom/notes.git
synced 2026-04-14 10:21:08 +08:00
vscode 学习完成
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
*.exe
|
||||
*.pyc
|
||||
__pycache__
|
||||
.vscode
|
||||
.vscode
|
||||
*.class
|
||||
.vscode/launch.json
|
||||
|
||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -5,7 +5,7 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "g++.exe debug",
|
||||
"name": "g++.exe - 生成和调试活动文件",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
||||
|
||||
47
.vscode/tasks.json
vendored
47
.vscode/tasks.json
vendored
@@ -1,27 +1,24 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++:build",
|
||||
"command": "D:\\mingw\\mingw64\\bin\\g++.exe",
|
||||
"args": [
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "编译器: D:\\mingw\\mingw64\\bin\\g++.exe"
|
||||
}
|
||||
]
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++:build",
|
||||
"command": "D:\\mingw\\mingw64\\bin\\g++.exe",
|
||||
"args": [
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": "build",
|
||||
"detail": "编译器: D:\\mingw\\mingw64\\bin\\g++.exe"
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
> 基于语义的内容分析
|
||||
|
||||
* intellisense:智能感知工具。Edit your code with auto-completion, code navigation, syntax checking
|
||||
* intellisense:智能感知工具。包括自动补全、代码导航(选择)、符号识别。Edit your code with auto-completion, code navigation, syntax checking
|
||||
* linting:代码审查工具。对代码中存在的warn、info、error进行分析,代码分析工具
|
||||
* snippets:代码片段工具。代码片段已检查如。
|
||||
* refactoring:Restructure your Python code with variable extraction, method extraction and import sorting
|
||||
* refactoring:代码重构工具。包括转到定义、转到声明、转到实现、转到引用(转到)。Restructure your Python code with variable extraction, method extraction and import sorting
|
||||
|
||||
|
||||
> 代码运行过程中的问题
|
||||
|
||||
37
Vscode/1 用户界面.md
Normal file
37
Vscode/1 用户界面.md
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
## 1 菜单栏
|
||||
|
||||
### 文件
|
||||
|
||||
### 编辑
|
||||
|
||||
### 选择
|
||||
|
||||
### 查看
|
||||
|
||||
### 转到
|
||||
|
||||
### 运行
|
||||
|
||||
### 终端
|
||||
|
||||
## 2 侧边栏
|
||||
|
||||
### 文件
|
||||
|
||||
### 搜索
|
||||
|
||||
### 版本
|
||||
|
||||
### 调试
|
||||
|
||||
### 插件
|
||||
|
||||
### 用户
|
||||
|
||||
### 设置
|
||||
|
||||
## 3 状态栏
|
||||
|
||||
|
||||
## 4 编辑器
|
||||
64
Vscode/2 代码片段.md
Normal file
64
Vscode/2 代码片段.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# 2代码片段
|
||||
|
||||
> 参考vscode官方文档
|
||||
>
|
||||
## 1 内置片段
|
||||
|
||||
## 2 扩展片段
|
||||
|
||||
- 扩展插件中包含对应语言的代码片段
|
||||
|
||||
## 3 自定义片段
|
||||
|
||||
```json
|
||||
{
|
||||
"hello world": {
|
||||
"prefix": "hello",
|
||||
"body": [
|
||||
"#include <iostream>",
|
||||
"#include <vector>",
|
||||
"using namespace std;",
|
||||
"int main()",
|
||||
"{",
|
||||
"\tvector<int> vec;",
|
||||
"\t${1:elemet}",
|
||||
"\tcout<<endl;",
|
||||
"\treturn 0;",
|
||||
"}"
|
||||
],
|
||||
"description": "start a cpp"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- prefix:触发代码片段的前缀
|
||||
- body:代码片段的内容
|
||||
- description:描述
|
||||
|
||||
* 占位符是带有值的制表符,例如`${1:foo}`。占位符文本将被插入和选择,以便可以轻松更改。占位符可以嵌套,例如`${1:another ${2:placeholder}}`
|
||||
|
||||
|
||||
## 4 语法表达式
|
||||
|
||||
```
|
||||
any ::= tabstop | placeholder | choice | variable | text
|
||||
tabstop ::= '$' int
|
||||
| '${' int '}'
|
||||
| '${' int transform '}'
|
||||
placeholder ::= '${' int ':' any '}'
|
||||
choice ::= '${' int '|' text (',' text)* '|}'
|
||||
variable ::= '$' var | '${' var '}'
|
||||
| '${' var ':' any '}'
|
||||
| '${' var transform '}'
|
||||
transform ::= '/' regex '/' (format | text)+ '/' options
|
||||
format ::= '$' int | '${' int '}'
|
||||
| '${' int ':' '/upcase' | '/downcase' | '/capitalize' | '/pascalcase' '}'
|
||||
| '${' int ':+' if '}'
|
||||
| '${' int ':?' if ':' else '}'
|
||||
| '${' int ':-' else '}' | '${' int ':' else '}'
|
||||
regex ::= JavaScript Regular Expression value (ctor-string)
|
||||
options ::= JavaScript Regular Expression option (ctor-options)
|
||||
var ::= [_a-zA-Z] [_a-zA-Z0-9]*
|
||||
int ::= [0-9]+
|
||||
text ::= .*
|
||||
```
|
||||
82
Vscode/3 运行调试.md
Normal file
82
Vscode/3 运行调试.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# 编译、运行、调试
|
||||
|
||||
## 编译task
|
||||
|
||||
### tasks.json
|
||||
* tasks是终端的一部分。就像在.code-snippets json中配置snippet一样,可以用来提供代码片段。在tasks.json,配置命令执行的脚本。然后使用tasks命令执行。
|
||||
* tasks负责执行一些任务。主要由vscode的脚本提供支持。是vscode用来运行操作系统脚本的工具。
|
||||
* tasks可以在`命令列表>tasks:`中找到, **其中C/C++插件提供了默认的内容** 。
|
||||
```json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C/C++: g++.exe build active file",
|
||||
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
|
||||
"args": ["-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
### 字段解释
|
||||
|
||||
1. label:用户界面中使用的任务的标签。
|
||||
2. type:任务的类型。对于自定义任务,可以是shell或process。如果shell指定,则该命令将解释为Shell命令(例如:bash,cmd或PowerShell)。如果process指定,则该命令将被解释为要执行的过程。
|
||||
3. command:要执行的实际命令。
|
||||
4. windows:任何Windows特定的属性。在Windows操作系统上执行命令时,将使用该命令代替默认属性。
|
||||
5. group:定义任务所属的组。在示例中,它属于该test组。可以通过从命令面板运行“运行测试任务”来执行属于测试组的任务。
|
||||
6. presentation:定义如何在用户界面中处理任务输出。在此示例中,显示了显示输出的Integrated Terminal,always并new在每次运行的任务上创建了一个终端。
|
||||
7. options:覆盖cwd(当前工作目录),env(环境变量)或shell(默认外壳程序)的默认值。可以为每个任务设置选项,也可以为全局或每个平台设置选项。此处配置的环境变量只能从您的任务脚本或过程中引用,并且如果它们是args,command或其他任务属性的一部分,则无法解析。
|
||||
8. runOptions:定义何时以及如何运行任务。
|
||||
|
||||
## 2 运行launch
|
||||
> launch.json
|
||||
|
||||
* launch负责运行和调试任务。主要由vscode脚本提供支持。也是vscode用来兼容系统调试工具的。
|
||||
* launch有可视化的界面,`运行`栏目和左侧的`Debug`栏目都能生成launch文件,配置运行和调试任务。其中 **c/c++插件提供了默认的运行和调试内容** 。
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "g++.exe - Build and debug active file",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "C/C++: g++.exe build active file"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 3 调试debug
|
||||
|
||||
|
||||
1. 启用调试会话。启动调试会话的方式主要有三种:菜单栏-运行。侧边栏-调试。C/C++命令行:生成和调试任务。主要利用launch运行含有调试信息的可执行文件,然后进行调试。
|
||||
2. 设置调试断点
|
||||
3. 选择调试步骤:跳过过程、进入过程、跳出过程
|
||||
4. 选择调试变量
|
||||
110
Vscode/4 快捷键和命令.md
Normal file
110
Vscode/4 快捷键和命令.md
Normal file
@@ -0,0 +1,110 @@
|
||||
## 1 快捷键
|
||||
|
||||

|
||||
|
||||
### 常用快捷键说明
|
||||
侧边栏导航
|
||||
- ctrl+shift+E 资源管理器
|
||||
- ctrl+shift+G git
|
||||
- ctrl+shift+D debug
|
||||
- ctrl+shift+X extension
|
||||
|
||||
界面相关操作
|
||||
|
||||
- ctrl J 命令行
|
||||
- ctrl B 侧边栏
|
||||
- ctrl k,z zen 模式
|
||||
- ctrl \ 拆分编辑器
|
||||
- ctrl 2 选择编辑器组
|
||||
- ctrl tab 内部浏览(浏览器也适用)
|
||||
|
||||
光标相关操作(选择复制移动。编辑选项的相关操作)
|
||||
|
||||
- ctrl alt ↑/↓ 多光标
|
||||
- Ctrl + Shift + L 将附加光标添加到当前选择的所有实例中
|
||||
- ctrl D 同时修改多个实例
|
||||
- ctrl U 撤销光标
|
||||
- Alt + Left返回到先前的位置>go back
|
||||
|
||||
|
||||
选择复制移动
|
||||
|
||||
- 拖动鼠标时按住 Shift + Alt 键来选择文本块
|
||||
- Shift + Alt +向上键或 Shift + Alt +向下键 向上或者向下复制一行
|
||||
- Alt + Up 或 Alt + Down 向上或向下移动一行
|
||||
- ctrl L 选择当前行
|
||||
|
||||
- shift alt F格式化
|
||||
|
||||
markdown
|
||||
|
||||
- ctrl k,v 预览
|
||||
|
||||
intellisense
|
||||
|
||||
- F12 转到代码的定义
|
||||
- Alt + F12 peek代码,查看代码的位置
|
||||
- shiff + F12 转到参考
|
||||
- Shift + Alt + F12打开“引用”视图,在专用视图中显示文件的所有符号。
|
||||
|
||||
refector
|
||||
|
||||
- F2 重构所有引用
|
||||
|
||||
搜索和修改
|
||||
- ctrl + F 搜索
|
||||
- ctrl + H 替换
|
||||
|
||||
tasks
|
||||
- ctrl shift B
|
||||
|
||||
|
||||
launch
|
||||
- F5 调试运行
|
||||
- ctrl F5 非调试运行
|
||||
|
||||
|
||||
## 2 Ctrl + P 命令窗口
|
||||
|
||||
### 运行命令 command
|
||||
|
||||
```
|
||||
view
|
||||
edt
|
||||
```
|
||||
|
||||
### 打开文件 file
|
||||
|
||||
```
|
||||
file.md
|
||||
```
|
||||
|
||||
### 行号跳转:
|
||||
|
||||
- ctrl G
|
||||
|
||||
```
|
||||
:45
|
||||
```
|
||||
|
||||
### 建议命令?
|
||||
|
||||
```
|
||||
?
|
||||
```
|
||||
|
||||
### 快速命令>
|
||||
|
||||
- 快捷键:Ctrl + shift + P。
|
||||
|
||||
```
|
||||
> command
|
||||
```
|
||||
|
||||
### 大纲跳转@****
|
||||
|
||||
- 快捷键:ctrl + shift + O
|
||||
|
||||
```
|
||||
@
|
||||
```
|
||||
125
Vscode/C/1 gcc.md
Normal file
125
Vscode/C/1 gcc.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# gcc
|
||||
|
||||
> 当前会这一种调试就行了。cmake编译构建工具以后再学。msvc编译构建工具为啥不直接使用vscode呢。
|
||||
|
||||
|
||||
## 1 条件
|
||||
|
||||
* vscode
|
||||
* MinGW-gcc/g++
|
||||
* addon-C/C++
|
||||
|
||||
## 2 创建helloworld
|
||||
|
||||
```C
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
|
||||
|
||||
for (const string& word : msg)
|
||||
{
|
||||
cout << word << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
```
|
||||
|
||||
## 3 编译helloworld
|
||||
> tasks.json
|
||||
|
||||
* tasks负责执行一些任务。主要由vscode的脚本提供支持。是vscode用来运行操作系统脚本的工具。
|
||||
* tasks可以在`命令列表>tasks:`中找到, **其中C/C++插件提供了默认的内容** 。
|
||||
```json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C/C++: g++.exe build active file",
|
||||
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
|
||||
"args": ["-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 4 运行helloworld
|
||||
> launch.json
|
||||
|
||||
* launch负责运行和调试任务。主要由vscode脚本提供支持。也是vscode用来兼容系统调试工具的。
|
||||
* launch有可视化的界面,`运行`栏目和左侧的`Debug`栏目都能生成launch文件,配置运行和调试任务。其中 **c/c++插件提供了默认的运行和调试内容** 。
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "g++.exe - Build and debug active file",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "C/C++: g++.exe build active file"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 5 调试helloworld
|
||||
|
||||
1. 启用调试会话。启动调试会话的方式主要有三种:菜单栏-运行。侧边栏-调试。C/C++命令行:生成和调试任务。
|
||||
2. 设置调试断点
|
||||
3. 选择调试步骤:跳过过程、进入过程、跳出过程
|
||||
4. 选择调试变量
|
||||
|
||||
## 6 环境配置
|
||||
> c_cpp_properties.json
|
||||
|
||||
* c_cpp_properties.json提供了继承环境的配置功能。主要用来配置c/c++插件
|
||||
* c_cpp_properties可以在 **C/C++插件的命令列表** 里选择配置。
|
||||
* includePath 仅当程序包含工作空间或标准库路径中没有的头文件时,才需要添加到“包含路径数组”设置中。
|
||||
* compilerPath设置来推断C ++标准库头文件的路径。当扩展知道在哪里可以找到那些文件时,它可以提供诸如智能补全和“转到定义”导航之类的功能。
|
||||
|
||||
```json
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "GCC",
|
||||
"includePath": ["${workspaceFolder}/**"],
|
||||
"defines": ["_DEBUG", "UNICODE", "_UNICODE"],
|
||||
"windowsSdkVersion": "10.0.18362.0",
|
||||
"compilerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/g++.exe",
|
||||
"cStandard": "c11",
|
||||
"intelliSenseMode": "gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
```
|
||||
0
Vscode/C/3 msvc.md
Normal file
0
Vscode/C/3 msvc.md
Normal file
11
Vscode/C/hello.cpp
Normal file
11
Vscode/C/hello.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<int> vec;
|
||||
cout << "hello world" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIN
Vscode/image/2021-04-12-13-18-08.png
Normal file
BIN
Vscode/image/2021-04-12-13-18-08.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 311 KiB |
@@ -1,12 +0,0 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
vector<string> vec{"hello", "world","nihao","!"};
|
||||
for(auto a:vec){
|
||||
cout<<a<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
## 计划
|
||||
|
||||
- [x] 设计模式复习
|
||||
- [ ] vscode C++集成开发环境
|
||||
- [ ] 项目重构计划书完成。(等有时间再搞)
|
||||
- [ ] 制定四月份论文阅读计划
|
||||
- [x] vscode C++集成开发环境
|
||||
|
||||
|
||||
- TensorFlow之前的计划
|
||||
|
||||
@@ -57,7 +57,8 @@
|
||||
* 熟悉MySQL的使用与优化;熟悉Redis/Mongodb/Memcache等NoSQL技术的优先;
|
||||
* 流程
|
||||
- [x] 简历投递https://jobs.bytedance.com/campus/position/application
|
||||
- [ ] 2021-04-11 15:00 1面。北京字节跳动。
|
||||
- [x] 2021-04-11 15:00 1面。北京字节跳动。
|
||||
- [ ] 2021-04-14 11:00 3面。
|
||||
|
||||
## 阿里巴巴
|
||||
* 岗位:研发工程师C++
|
||||
@@ -70,7 +71,7 @@
|
||||
* 投递
|
||||
- [x] 简历投递
|
||||
- [x] 素质测评
|
||||
- [x] 2021年04月09日 19:00 - 2021年04月09日 20:00
|
||||
- [x] 2021年04月09日 19:00 - 2021年04月09日 20:00。完球了没人捞我的专利,待会问问师兄。
|
||||
|
||||
> 二期简历
|
||||
|
||||
|
||||
Reference in New Issue
Block a user