diff --git a/.gitignore b/.gitignore index a7a43685..3d921587 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.exe *.pyc __pycache__ -.vscode \ No newline at end of file +.vscode +*.class +.vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json index b0c5e59a..8340a222 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "g++.exe debug", + "name": "g++.exe - 生成和调试活动文件", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d90607c6..8996fdb6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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" + }, + ] } \ No newline at end of file diff --git a/TOOL/工具说明.md b/TOOL/工具说明.md index 1ef6a4fc..228ade0b 100644 --- a/TOOL/工具说明.md +++ b/TOOL/工具说明.md @@ -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 > 代码运行过程中的问题 diff --git a/Vscode/1 用户界面.md b/Vscode/1 用户界面.md new file mode 100644 index 00000000..ad157f74 --- /dev/null +++ b/Vscode/1 用户界面.md @@ -0,0 +1,37 @@ + +## 1 菜单栏 + +### 文件 + +### 编辑 + +### 选择 + +### 查看 + +### 转到 + +### 运行 + +### 终端 + +## 2 侧边栏 + +### 文件 + +### 搜索 + +### 版本 + +### 调试 + +### 插件 + +### 用户 + +### 设置 + +## 3 状态栏 + + +## 4 编辑器 \ No newline at end of file diff --git a/Vscode/2 代码片段.md b/Vscode/2 代码片段.md new file mode 100644 index 00000000..5dacc547 --- /dev/null +++ b/Vscode/2 代码片段.md @@ -0,0 +1,64 @@ +# 2代码片段 + +> 参考vscode官方文档 +> +## 1 内置片段 + +## 2 扩展片段 + +- 扩展插件中包含对应语言的代码片段 + +## 3 自定义片段 + +```json +{ + "hello world": { + "prefix": "hello", + "body": [ + "#include ", + "#include ", + "using namespace std;", + "int main()", + "{", + "\tvector vec;", + "\t${1:elemet}", + "\tcout<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. 选择调试变量 \ No newline at end of file diff --git a/Vscode/4 快捷键和命令.md b/Vscode/4 快捷键和命令.md new file mode 100644 index 00000000..1cbd2c47 --- /dev/null +++ b/Vscode/4 快捷键和命令.md @@ -0,0 +1,110 @@ +## 1 快捷键 + +![](image/2021-04-12-13-18-08.png) + +### 常用快捷键说明 +侧边栏导航 +- 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 + +``` +@ +``` diff --git a/Vscode/C/1 gcc.md b/Vscode/C/1 gcc.md new file mode 100644 index 00000000..a3a9aaf0 --- /dev/null +++ b/Vscode/C/1 gcc.md @@ -0,0 +1,125 @@ +# gcc + +> 当前会这一种调试就行了。cmake编译构建工具以后再学。msvc编译构建工具为啥不直接使用vscode呢。 + + +## 1 条件 + +* vscode +* MinGW-gcc/g++ +* addon-C/C++ + +## 2 创建helloworld + +```C +#include +#include +#include + +using namespace std; + +int main() +{ + vector 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 +} +``` \ No newline at end of file diff --git a/Vscode教程/C++/1 使用教程.md b/Vscode/C/2 cmake.md similarity index 100% rename from Vscode教程/C++/1 使用教程.md rename to Vscode/C/2 cmake.md diff --git a/Vscode/C/3 msvc.md b/Vscode/C/3 msvc.md new file mode 100644 index 00000000..e69de29b diff --git a/Vscode/C/hello.cpp b/Vscode/C/hello.cpp new file mode 100644 index 00000000..45957fa5 --- /dev/null +++ b/Vscode/C/hello.cpp @@ -0,0 +1,11 @@ +#include +#include +using namespace std; + +int main() +{ + vector vec; + cout << "hello world" << endl; + return 0; +} + diff --git a/Vscode/image/2021-04-12-13-18-08.png b/Vscode/image/2021-04-12-13-18-08.png new file mode 100644 index 00000000..fe0bae67 Binary files /dev/null and b/Vscode/image/2021-04-12-13-18-08.png differ diff --git a/Vscode教程/C++/hello.cpp b/Vscode教程/C++/hello.cpp deleted file mode 100644 index f73ecde5..00000000 --- a/Vscode教程/C++/hello.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -using namespace std; - -int main(){ - vector vec{"hello", "world","nihao","!"}; - for(auto a:vec){ - cout< 二期简历