summaryrefslogtreecommitdiff
path: root/.vscode
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-12-13 16:01:55 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-12-15 11:56:11 +0100
commit591bad42866fb9beaa24f34ee746e011cba40f99 (patch)
treeafee691e1d2af4f8c4552417ed3baea971e07ab0 /.vscode
parentcc5becc37dc4828e09f4d2f2af48b8482f7efaa3 (diff)
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@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to '.vscode')
-rw-r--r--.vscode/vs-code-template.code-workspace.in176
1 files changed, 176 insertions, 0 deletions
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