From abe43262c2d44a39316e77a768f62c70c18db97a Mon Sep 17 00:00:00 2001 From: Surendrajat Date: Mon, 24 Aug 2020 20:03:29 +0530 Subject: [PATCH] add minimal VS Code project config (#2393) * add minimal VSCode project config * update docs * add extension recommendations Co-authored-by: Itay Cohen --- .gitignore | 4 +++- .vscode/extensions.json | 7 +++++++ .vscode/settings.json | 6 ++++++ docs/source/contributing/code/ide-setup.rst | 19 ++++++++++--------- 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index c28933e8..f81790da 100644 --- a/.gitignore +++ b/.gitignore @@ -75,7 +75,9 @@ compile_commands.json docs/source/_build # vscode -**/.vscode +/.vscode/* +!/.vscode/settings.json +!/.vscode/extensions.json # Visual Studio CMake src/out diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..c61da927 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "twxs.cmake" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..f853122b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "cmake.sourceDirectory": "${workspaceFolder}/src", + "cmake.configureSettings": { + "CUTTER_USE_BUNDLED_RADARE2": "ON" + } +} \ No newline at end of file diff --git a/docs/source/contributing/code/ide-setup.rst b/docs/source/contributing/code/ide-setup.rst index 989d2cd5..0e6014d8 100644 --- a/docs/source/contributing/code/ide-setup.rst +++ b/docs/source/contributing/code/ide-setup.rst @@ -68,9 +68,9 @@ Editing Qt .ui files ~~~~~~~~~~~~~~~~~~~~ Double-clicking a ``.ui`` file in a file list opens it inside a visual editor. If you want to make changes that are easier to do by editing ``.ui`` file as text - right-click the file and select :menuselection:`Open With --> Plain Text Editor`. Switching from visual form editor back to code editor mode will open the ``.ui`` file in read-only mode with the following warning "This file can only be edited in Design mode". To edit use the same steps as described before. -VSCode +VS Code ------- -`VSCode `_ is an open-source code editor made by Microsoft. +`VS Code `_ is an open-source code editor made by Microsoft. Pros and Cons ~~~~~~~~~~~~~ @@ -86,23 +86,24 @@ Recommended plugins Project setup ~~~~~~~~~~~~~ -- :menuselection:`File --> Open Folder` select the folder in which you cloned Cutter -- If the recommend plugins are already installed, in the corner you will see a popup asking you "Would you like to configure project 'cutter'? Source: CMake Tools (Extension)". Click Yes. -- If you initially dismissed the configuration window or didn't have the plugins installed yet - open command pallet using :kbd:`Ctrl-Shift-P` and select :guilabel:`Cmake: Configure` -- In the kit selection choose :guilabel:`[Unspecified]` unless you have more specific needs. -- If you see the following error: "CMakeList.txt was not found in the root of folder cutter", choose :guilabel:`Locate` and specify the path to :file:`cutter/src/CMakeLists.txt` -- :kbd:`Ctrl-Shift-P`/:guilabel:`CMake: Edit CMake Cache`, find the line ``CUTTER_USE_BUNDLED_RADARE2:BOOL=OFF`` and change it to ON. +- :menuselection:`File --> Open Folder...` and select the folder in which you cloned Cutter +- Install the recommended plugins. +- Once the `CMake Tools` plugin is installed, in the corner you will see a popup asking you "Would you like to configure project 'cutter'? Source: CMake Tools (Extension)". Click Yes. +- In the kit selection popup, choose :guilabel:`[Unspecified]` unless you have more specific needs. +- If you initially dismissed the configuration window or didn't have the plugins installed yet - open command-palette using :kbd:`Ctrl-Shift-P` and select :guilabel:`Cmake: Configure` Changing CMake configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After the first configuration :kbd:`Ctrl-Shift-P`/:guilabel:`CMake: Edit CMake Cache` opens a text editor with all CMake options. Cutter specific ones mostly start with "CUTTER". +.. note:: + ``CUTTER_USE_BUNDLED_RADARE2`` option is also defined in ``.vscode/settings.json`` file and it will be overridden from there. It is set to ``ON`` by default as it is recommended during development. .. _vscode-debug-setup: Building, Running, Debugging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Build and running commands are available in the bar at the bottom left and in the Command Palette menu (:kbd:`Ctrl-Shift-P`) named ``CMake: Build F7``, ``CMake: Run Without Debugging Shift+F5``, and ``CMake Debug Ctrl + F5``. +Build and running commands are available in the status bar at the bottom and in the Command Palette menu (:kbd:`Ctrl-Shift-P`) named ``CMake: Build F7``, ``CMake: Run Without Debugging Shift+F5``, and ``CMake Debug Ctrl + F5``. Shortcuts can be viewed in the :kbd:`Ctrl-Shift-P` menu. They don't match default VS Code ones since those depend on :file:`tasks.json``. Running and debugging launches the executable without any arguments. Command-line arguments can be passed to the debug