From e84356ec46b639ebb1362082f86d8aff1beae24c Mon Sep 17 00:00:00 2001 From: Jonathan Percival Date: Fri, 15 Sep 2023 14:44:15 -0600 Subject: [PATCH] Update VS Code format on save --- .vscode/config/eclipse-java-google-style.xml | 337 ------------------- .vscode/extensions.json | 3 +- .vscode/settings.json | 13 + .vscode/tasks.json | 34 ++ 4 files changed, 48 insertions(+), 339 deletions(-) delete mode 100644 .vscode/config/eclipse-java-google-style.xml create mode 100644 .vscode/tasks.json diff --git a/.vscode/config/eclipse-java-google-style.xml b/.vscode/config/eclipse-java-google-style.xml deleted file mode 100644 index 2d1ee43f6..000000000 --- a/.vscode/config/eclipse-java-google-style.xml +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 5a87bd965..0de07454c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -8,10 +8,9 @@ "streetsidesoftware.code-spell-checker", "streetsidesoftware.code-spell-checker-scientific-terms", "streetsidesoftware.code-spell-checker-medical-terms", - "shengchen.vscode-checkstyle", "sonarsource.sonarlint-vscode", "redhat.fabric8-analytics", - "Vehmloewff.custom-format" + "pucelle.run-on-save" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [ diff --git a/.vscode/settings.json b/.vscode/settings.json index 203ff17b7..72383f980 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -92,11 +92,24 @@ "editor.detectIndentation": false, "editor.foldingImportsByDefault": true, "editor.tabSize": 4, + "editor.formatOnSave": true, "java.configuration.updateBuildConfiguration": "automatic", "java.dependency.packagePresentation": "hierarchical", "java.jdt.ls.vmargs": "-Xmx32G -XX:+UseG1GC -XX:+UseStringDeduplication", "java.compile.nullAnalysis.mode": "automatic", "json.schemaDownload.enable": true, + "runOnSave.commands": [ + { + "match": ".*\\.java$", + "command": "./mvnw spotless:apply -DspotlessFiles=${file}", + "runIn": "backend", + "runningStatusMessage": "Formatting ${fileBasename}", + "finishStatusMessage": "${fileBasename} formatted" + }, + ], + "[java]": { + "editor.formatOnSave": false + }, "[cql]": { "editor.formatOnSave": false }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..3c33efdf1 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,34 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "group": "none", + "label": "java (format) Apply formating to project", + "command": [ + "./mvnw spotless:apply" + ], + "problemMatcher": [] + }, + { + "type": "shell", + "group": "none", + "label": "java (format) Apply formating to active file", + "command": [ + "./mvnw spotless:apply -DspotlessFiles=${file}" + ], + "problemMatcher": [] + }, + { + "type": "java (build)", + "paths": [ + "${workspace}" + ], + "isFullBuild": true, + "group": "build", + "problemMatcher": [], + "label": "java (build): Build Workspace", + "detail": "$(tools) Build all the Java projects in workspace." + } + ] +} \ No newline at end of file