Skip to content

Patch: Visual Studio Code Support Fix

Could you apply the patch below? Otherwise it does not work with new vscode versions.

See also: #1936 (closed)

Also, can someone give me rights to create MRs?

diff --git a/bin/tools/vscode-settings b/bin/tools/vscode-settings
index 2b6e851eac..1cba457f45 100755
--- a/bin/tools/vscode-settings
+++ b/bin/tools/vscode-settings
@@ -18,8 +18,7 @@
 #     Emit some settings for Visual Studio Code + OpenFOAM
 #
 # Example
-#     bin/tools/vscode-settings > .vscode/settings.json
-#     etc/openfoam -spdp -int64 bin/tools/vscode-settings
+#     bin/tools/vscode-settings > openfoam.code-workspace
 #
 # Environment
 #     WM_PROJECT_DIR, WM_PROJECT_USER_DIR, WM_OPTIONS
@@ -42,8 +41,7 @@ options:
 Emit some settings for Visual Studio Code + OpenFOAM
 
 For example,
-    bin/tools/vscode-settings > .vscode/settings.json
-    etc/openfoam -spdp -int64 bin/tools/vscode-settings
+    bin/tools/vscode-settings > openfoam.code-workspace
 
 USAGE
     exit 0  # clean exit
@@ -113,15 +111,18 @@ cat << INFO 1>&2
 # -------------------------
 INFO
 
-echo '{'  # BEGIN_LIST
-
 # ccls integration
 cat << JSON_CONTENT
-    "ccls.cache.directory":
-"$outputDir/ccls-cache",
+{
+    "folders": [
+        {
+            "path": "$projectDir"
+        }
+    ],
+    "settings": {
+        "ccls.cache.directory": "$outputDir/ccls-cache",
 
-    "ccls.misc.compilationDatabaseDirectory":
-"$outputDir",
+        "ccls.misc.compilationDatabaseDirectory": "$outputDir",
 
 JSON_CONTENT
 
@@ -130,19 +131,18 @@ JSON_CONTENT
 if [ -x "$session" ]
 then
 cat << JSON_CONTENT
-    "C_Cpp.default.compileCommands":
-"$session wmake -with-bear -s -j",
+        "C_Cpp.default.compileCommands": "$session wmake -with-bear -s -j",
 JSON_CONTENT
 fi
 
 cat << JSON_CONTENT
 
-    "C_Cpp.autocomplete": "Disabled",
-    "C_Cpp.errorSquiggles": "Disabled",
-    "C_Cpp.formatting": "Disabled",
-    "C_Cpp.intelliSenseEngine": "Disabled"
+        "C_Cpp.autocomplete": "Disabled",
+        "C_Cpp.errorSquiggles": "Disabled",
+        "C_Cpp.formatting": "Disabled",
+        "C_Cpp.intelliSenseEngine": "Disabled"
+    }
+}
 JSON_CONTENT
 
-echo '}'  # END_LIST
-
 #------------------------------------------------------------------------------