[Libreoffice-commits] core.git: configure.ac .vscode/vs-code-template.code-workspace.in

Christian Lohmaier (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 15 10:56:47 UTC 2020


 .vscode/vs-code-template.code-workspace.in |  176 +++++++++++++++++++++++++++++
 configure.ac                               |    3 
 2 files changed, 178 insertions(+), 1 deletion(-)

New commits:
commit 591bad42866fb9beaa24f34ee746e011cba40f99
Author:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
AuthorDate: Sun Dec 13 16:01:55 2020 +0100
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Tue Dec 15 11:56:11 2020 +0100

    add a visual studio code workspace template (created by configure.ac)
    
    Not having settings directly stored in .vscode directory in the
    repository/having the files ignored there is a problem when you build in
    a separate builddirectory and you regularly do a full reset of your
    sourcedir using "git clean -fdx" and similar. If you had any
    folder-settings, you'd lose them that way.
    VS Code doesn't really have a mechanism to include and then extend
    repository defaults, but it has three different tiers where settings are
    pulled from: folder, workspace and user
    
    For LibreOffice core repository there are no folder settings as our
    .vscode is not populated (or at least it is not stable), a user can of
    course place a settings.json or other configuration files in their
    checkout, just with the "git clean" problem mentioned above.
    
    This patch adds a workspace configuration - that file can be stored
    anywhere and instead references the folders to use as configuration
    items. If you want to add your own launch configuration or tasks: you
    can just store it on your desktop, and can completely wipe out your
    builddir as well as prune your srcdir - if you reuse the same paths for
    your next build, you can simply reopen that workspace file and have all
    your settings applied.
    
    Having it part of the core repository and created by configure from the
    template is thus just a convenience thing - it has a launch-in-debugger
    rule and settings for code search/browsing that should be all that's
    needed/all that's specific to LibreOffice at least.
    
    Change-Id: I8625d83d0c30c2668b99ec672c651c3d35258ca5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107655
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/.vscode/vs-code-template.code-workspace.in b/.vscode/vs-code-template.code-workspace.in
new file mode 100644
index 000000000000..46f25dcd4f66
--- /dev/null
+++ b/.vscode/vs-code-template.code-workspace.in
@@ -0,0 +1,176 @@
+// *** Autogenerated file - created by configure.ac ***
+// you should save the auto-generated vs-code-templates.code-workspace to a separate file
+// to prevent your changes from being overwritten
+{
+	"extensions": {
+		"recommendations": [
+			"ms-vscode.cpptools"
+		]
+	},
+	"folders": [
+		{
+			"name": "srcdir",
+			"path": "@SRC_ROOT@"
+		},
+		{
+			"name": "builddir",
+			"path": "@BUILDDIR@"
+		}
+	],
+	"settings": {
+		"search.exclude": {
+			"/compile_commands.json": true,
+			"/dictionaries/": true,
+			"/helpcontent2/": true,
+			"/icon-themes/": true,
+			"/translations/": true
+		},
+		"files.watcherExclude": {
+			"/dictionaries/": true,
+			"/helpcontent2/": true,
+			"/icon-themes/": true,
+			"/translations/": true
+		},
+		// FIXME: arguably the generator should place it in the builddir, not srcdir
+		"C_Cpp.default.compileCommands": "${workspaceFolder:srcdir}/compile_commands.json",
+		// only used if the file doesn't match anything in the compile_commands.json - aka externals
+		// libxml includes just added as example/for reference
+		"C_Cpp.default.includePath": [
+			"${workspaceFolder:builddir}/workdir/UnpackedTarball/**",
+			"/usr/include/libxml2/"
+		],
+		// adjust if necessary
+		"C_Cpp.default.compilerPath": "@GCC_HOME@/bin/gcc",
+		"C_Cpp.default.intelliSenseMode": "gcc-x64",
+		"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true,
+		"C_Cpp.default.cppStandard": "c++17",
+		// point this to LibreOffice's version of clang-format 5.0.0,
+		// otherwise clang-format from the plugin is used, and that
+		// gives slightly different results
+		"C_Cpp.clang_format_path": "/opt/lo/bin/clang-format",
+		"editor.rulers": [
+			100
+		]
+	},
+	"tasks": {
+		"version": "2.0.0",
+		"tasks": [
+			{
+				"label": "full make",
+				"detail": "runs make in builddir to update everything",
+				"type": "shell",
+				"command": "make",
+				"group": {
+					"kind": "build",
+					"isDefault": true
+				},
+				"options": {
+					"cwd": "${workspaceFolder:builddir}"
+				}
+			},
+			{
+				"label": "create compile-commands.json",
+				"detail": "runs make vim-ide-integration to create the compile-commands.json file",
+				"type": "shell",
+				"command": "make",
+				"args": [
+					"vim-ide-integration"
+				],
+				"group": "build",
+				// doesn't really depend on full make, but doesn't hurt
+				// updating the compile-commands is not needed all the time and also demonstrate
+				// how to use dependencies in tasks…
+				"dependsOn": [
+					"full make"
+				],
+				"options": {
+					"cwd": "${workspaceFolder:builddir}"
+				},
+				"problemMatcher": [] // don't ask when manually running the task
+			},
+			{
+				"label": "remove profile-dir",
+				"detail": "removes the temporary user-profile profile directory",
+				"type": "shell",
+				"command": "rm",
+				"args": [
+					"-rf",
+					"vs-code-temporary-user-profile"
+				],
+				"group": "none",
+				"dependsOn": [
+					"full make"
+				],
+				"options": {
+					"cwd": "${workspaceFolder:builddir}"
+				},
+				"problemMatcher": []
+			}
+		]
+	},
+	"launch": {
+		"configurations": [
+			{
+				"name": "run in gdb",
+				"type": "cppdbg",
+				"request": "launch",
+				"program": "${workspaceFolder:builddir}/instdir/program/soffice.bin",
+				"args": [],
+				"stopAtEntry": false,
+				"cwd": "${workspaceFolder:builddir}",
+				"environment": [
+					{
+						// added in disabled form for convenience/as an example
+						// (proper name is just SAL_LOG),
+						// see https://docs.libreoffice.org/sal/html/sal_log.html
+						"name": "SAL_LOG_DISABLED",
+						"value": "+INFO.ucb+WARN"
+					}
+				],
+				"externalConsole": false,
+				"MIMode": "gdb",
+				"miDebuggerPath": "/usr/libexec/gdb",
+				"setupCommands": [
+					{
+						"description": "Enable prett-printing for gdb",
+						"text": "-enable-pretty-printing",
+						"ignoreFailures": true
+					}
+				],
+				"preLaunchTask": "full make"
+			},
+			{
+				// FIXME: not happy here when creating the profile while running in debugger
+				// no problem passing the profile dir once it was launched outside debugger once,
+				// but clearing out the user-profile dir needs to be triggered manually
+				"name": "run in gdb with clear userprofile",
+				//	"preLaunchTask": "remove profile-dir",
+				"type": "cppdbg",
+				"request": "launch",
+				"program": "${workspaceFolder:builddir}/instdir/program/soffice.bin",
+				"args": [
+					"-env:UserInstallation=file:///${workspaceFolder:builddir}/vs-code-temporary-user-profile"
+				],
+				"stopAtEntry": false,
+				"cwd": "${workspaceFolder:builddir}",
+				"environment": [
+					{
+						"name": "SAL_LOG_DISABLED",
+						"value": "+INFO.ucb+WARN"
+					}
+				],
+				"externalConsole": false,
+				"MIMode": "gdb",
+				"miDebuggerPath": "/usr/libexec/gdb",
+				"setupCommands": [
+					{
+						"description": "Enable pretty-printing for gdb",
+						"text": "-enable-pretty-printing",
+						"ignoreFailures": true
+					}
+				]
+			}
+		],
+		"compounds": []
+	}
+}
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 4d801817c36e..ad35a32c752e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13988,7 +13988,8 @@ AC_CONFIG_FILES([config_host.mk
                  bin/officeotron.sh
                  hardened_runtime.xcent
                  instsetoo_native/util/openoffice.lst
-                 sysui/desktop/macosx/Info.plist])
+                 sysui/desktop/macosx/Info.plist
+                 vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
 AC_CONFIG_HEADERS([config_host/config_buildid.h])
 AC_CONFIG_HEADERS([config_host/config_box2d.h])
 AC_CONFIG_HEADERS([config_host/config_clang.h])


More information about the Libreoffice-commits mailing list