From ac598e51b4e97230e421efce1287b4417ebe7796 Mon Sep 17 00:00:00 2001 From: Yanis <35189056+Yanis42@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:30:26 +0200 Subject: [PATCH] Add vscode docs (#194) --- docs/c_cpp_properties.json | 77 ++++++++++++++++++++++++++++++++++++++ docs/vscode.md | 58 ++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 docs/c_cpp_properties.json create mode 100644 docs/vscode.md diff --git a/docs/c_cpp_properties.json b/docs/c_cpp_properties.json new file mode 100644 index 00000000..2e5208f6 --- /dev/null +++ b/docs/c_cpp_properties.json @@ -0,0 +1,77 @@ +{ + "configurations": [ + { + "name": "mq-j", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/mq-j/include" + ], + "defines": ["VERSION=MQ_J"] + }, + { + "name": "mq-u", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/mq-u/include" + ], + "defines": ["VERSION=MQ_U"] + }, + { + "name": "mq-e", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/mq-e/include" + ], + "defines": ["VERSION=MQ_E"] + }, + { + "name": "ce-j", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/ce-j/include" + ], + "defines": ["VERSION=CE_J"] + }, + { + "name": "ce-u", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/ce-u/include" + ], + "defines": ["VERSION=CE_U"] + }, + { + "name": "ce-e", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/ce-e/include" + ], + "defines": ["VERSION=CE_E"] + } + ], + "version": 4 +} diff --git a/docs/vscode.md b/docs/vscode.md new file mode 100644 index 00000000..aa4277f1 --- /dev/null +++ b/docs/vscode.md @@ -0,0 +1,58 @@ +# VSCode + +A lot of people on this project use VSCode as their coding environment. + +## Extensions + +There are a number of useful extensions available to make work more efficient: + +- C/C++ IntelliSense +- Clang-Format +- HexInspector (hover on numbers for float and other info) +- NumberMonger (convert hex to decimal and vice versa) + +## Useful keyboard shortcuts + +- Ctrl + Alt + Up/Down (on Windows, on Linux it's Ctrl + Shift + Up/Down or Shift + Alt + Up/Down) gives multicursors across consecutive lines. If you want several cursors in a more diverse arrangement, middle clicking works, at least on Windows. +- Alt + Up/Down moves lines up/down. +- Shift + Alt + Up/Down (Linux: Ctrl + Shift + Alt + Up/Down) copies lines up/down. +- Ctrl + P offers a box to use to search for and open files. +- Ctrl + Shift + P offers a box for commands like editing settings or reloading the window. + +- Make use of VSCode's search/search-and-replace features. + - Ctrl + Click goes to a definition. + - Ctrl + F for search in current file + - Ctrl + H for replace in current file + - Ctrl + Shift + F for search in all files + - Ctrl + Shift + H for replace in all files + - F2 for Rename symbol + +Many of VS Code's other shortcuts can be found on [its getting started page](https://code.visualstudio.com/docs/getstarted/keybindings), which also has links to OS-specific PDFs. + +## C/C++ configuration + +You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configurations (JSON)` in the command box to customise how IntelliSense reads the repository (stuff like where to look for includes, flags, compiler defines, etc.) to make VSCode's IntelliSense plugin better able to understand the structure of the repository. + +Below is a good default one to use for this project's repository, for the `ce-j` version specifically. + +A more complete `c_cpp_properties.json` with configurations for all supported versions [can be found here](c_cpp_properties.json). + +```jsonc +{ + "configurations": [ + { + "name": "ce-j", + "intelliSenseMode": "${default}", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/src", + "${workspaceFolder}/include", + "${workspaceFolder}/libc", + "${workspaceFolder}/build/ce-j/include" + ], + "defines": ["VERSION=CE_J"] + } + ], + "version": 4 +} +```