From a5fa3eda302ca0ecd8b6938b3fbe940ae659a76c Mon Sep 17 00:00:00 2001
From: Daniel Agar <daniel@agar.ca>
Date: Tue, 4 Dec 2018 23:11:36 -0500
Subject: [PATCH] vscode initial configuration (#10911)

---
 .gitignore                  |  2 --
 .vscode/cmake-kits.json     | 10 +++++++++
 .vscode/cmake-variants.yaml | 33 ++++++++++++++++++++++++++++
 .vscode/extensions.json     | 11 ++++++++++
 .vscode/launch.json         | 44 +++++++++++++++++++++++++++++++++++++
 .vscode/settings.json       |  8 +++++++
 .vscode/tasks.json          | 16 ++++++++++++++
 7 files changed, 122 insertions(+), 2 deletions(-)
 create mode 100644 .vscode/cmake-kits.json
 create mode 100644 .vscode/cmake-variants.yaml
 create mode 100644 .vscode/extensions.json
 create mode 100644 .vscode/launch.json
 create mode 100644 .vscode/settings.json
 create mode 100644 .vscode/tasks.json

diff --git a/.gitignore b/.gitignore
index de25e81e76..f7c268a521 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,8 +52,6 @@ GTAGS
 .idea
 cmake-build-*/
 
-.vscode
-
 posix-configs/SITL/init/test/*_generated
 
 /airframes.md
diff --git a/.vscode/cmake-kits.json b/.vscode/cmake-kits.json
new file mode 100644
index 0000000000..2624a2e50b
--- /dev/null
+++ b/.vscode/cmake-kits.json
@@ -0,0 +1,10 @@
+[
+        {
+                "name": "arm-none-eabi-gcc",
+                "toolchainFile": "cmake/toolchains/Toolchain-arm-none-eabi.cmake"
+        },
+        {
+                "name": "native",
+                "toolchainFile": "cmake/toolchains/Toolchain-native.cmake"
+        }
+]
\ No newline at end of file
diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml
new file mode 100644
index 0000000000..5b52735df2
--- /dev/null
+++ b/.vscode/cmake-variants.yaml
@@ -0,0 +1,33 @@
+CONFIG:
+  default: posix_sitl_default
+  choices:
+    posix_sitl_default:
+      short: sitl
+      buildType: RelWithDebInfo
+      settings:
+        CONFIG: posix_sitl_default
+    nuttx_px4fmu-v2_default:
+      short: px4fmu-v2
+      buildType: MinRelSize
+      settings:
+        CONFIG: nuttx_px4fmu-v2_default
+    nuttx_px4fmu-v3_default:
+      short: px4fmu-v3
+      buildType: MinRelSize
+      settings:
+        CONFIG: nuttx_px4fmu-v3_default
+    nuttx_px4fmu-v4_default:
+      short: px4fmu-v4
+      buildType: MinRelSize
+      settings:
+        CONFIG: nuttx_px4fmu-v4_default
+    nuttx_px4fmu-v4pro_default:
+      short: px4fmu-v4pro
+      buildType: MinRelSize
+      settings:
+        CONFIG: nuttx_px4fmu-v4pro_default
+    nuttx_px4fmu-v5_default:
+      short: px4fmu-v5
+      buildType: MinRelSize
+      settings:
+        CONFIG: nuttx_px4fmu-v5_default
\ No newline at end of file
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000000..086dda8cb4
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,11 @@
+{
+    // See http://go.microsoft.com/fwlink/?LinkId=827846
+    // for the documentation about the extensions.json format
+    "recommendations": [
+        "ms-vscode.cpptools",
+        "github.vscode-pull-request-github",
+        "chiehyu.vscode-astyle",
+        "marus25.cortex-debug",
+        "vector-of-bool.cmake-tools"
+    ]
+}
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000000..7d5492a988
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,44 @@
+{
+        "version": "0.2.0",
+        "configurations": [
+            {
+                "name": "(lldb) Launch",
+                "type": "cppdbg",
+                "request": "launch",
+                "program": "${command:cmake.launchTargetPath}",
+                "args": [],
+                "stopAtEntry": false,
+                "cwd": "${workspaceFolder}",
+                "environment": [],
+                "externalConsole": true,
+                "MIMode": "lldb",
+            },
+            {
+                "name": "(gdb) Launch",
+                "type": "cppdbg",
+                "request": "launch",
+                // Resolved by CMake Tools:
+                "program": "${command:cmake.launchTargetPath}",
+                "args": [],
+                "stopAtEntry": false,
+                "cwd": "${workspaceFolder}",
+                "externalConsole": true,
+                "MIMode": "gdb",
+                "setupCommands": [
+                    {
+                        "description": "Enable pretty-printing for gdb",
+                        "text": "-enable-pretty-printing",
+                        "ignoreFailures": true
+                    }
+                ]
+            }
+            {
+                "cwd": "${workspaceRoot}",
+                "executable": "${command:cmake.launchTargetPath}",
+                "name": "Debug Microcontroller",
+                "request": "launch",
+                "type": "cortex-debug",
+                "servertype": "jlink"
+            },
+        ]
+    }
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000..c5ef40b8a2
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,8 @@
+{
+        "editor.insertSpaces": false,
+        "editor.wordWrapColumn": 120,
+        "astyle.astylerc": "${workspaceFolder}/Tools/astyle/astylerc",
+        "C_Cpp.default.cppStandard": "c++11",
+        "C_Cpp.default.cStandard": "c99",
+        "cmake.buildDirectory": "${workspaceRoot}/build/${variant:CONFIG}",
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000000..d171d02bb4
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,16 @@
+{
+    // See https://go.microsoft.com/fwlink/?LinkId=733558
+    // for the documentation about the tasks.json format
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "jmavsim",
+            "type": "shell",
+            "command": "make posix_sitl_default jmavsim",
+            "group": {
+                "kind": "build",
+                "isDefault": true
+            }
+        }
+    ]
+}
-- 
GitLab