From 988c74ec5665250c572dcc6bae018ed0ea180c25 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:11:18 +0200 Subject: feat: Add pre-commit hook for linting and formatting (#1132) * feat: Add pre-commit hook for linting and formatting * format with prettier --- utils/bin/jdtls | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'utils') diff --git a/utils/bin/jdtls b/utils/bin/jdtls index 2b0f226a..961d2df5 100755 --- a/utils/bin/jdtls +++ b/utils/bin/jdtls @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC2116 # NOTE: # This doesn't work as is on Windows. You'll need to create an equivalent `.bat` file instead @@ -7,7 +8,8 @@ # If you're not using Linux you'll need to adjust the `-configuration` option # to point to the `config_mac' or `config_win` folders depending on your system. -case Darwin in +OS="$(uname -s)" +case "$OS" in Linux) CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_linux" ;; @@ -32,7 +34,7 @@ location of your Java installation." fi else JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + command -v java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." @@ -46,10 +48,10 @@ GRADLE_HOME=$HOME/gradle "$JAVACMD" \ -Declipse.product=org.eclipse.jdt.ls.core.product \ -Dlog.protocol=true \ -Dlog.level=ALL \ - -javaagent:$HOME/.local/share/nvim/lspinstall/java/lombok.jar \ + -javaagent:"$HOME/.local/share/nvim/lspinstall/java/lombok.jar" \ -Xms1g \ -Xmx2G \ - -jar $(echo "$JAR") \ + -jar "$(echo "$JAR")" \ -configuration "$CONFIG" \ -data "${1:-$HOME/workspace}" \ --add-modules=ALL-SYSTEM \ -- cgit v1.2.3