Add google-java-format for linting java
parent
d805419714
commit
47936f7267
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
JAR="$HOME/lsp/java/google-java-format/google-java-format.jar"
|
||||||
|
|
||||||
|
if [[ ! -f $JAR ]]; then
|
||||||
|
echo "Google Java format is not installed! Install by running:"
|
||||||
|
echo ""
|
||||||
|
echo "javatoolinstall google-java-format"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
java \
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
|
||||||
|
-jar $JAR $@
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
TOOL=$1
|
||||||
|
VERSION=$2
|
||||||
|
|
||||||
|
case $TOOL in
|
||||||
|
google-java-format)
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
VERSION="v1.11.0"
|
||||||
|
fi
|
||||||
|
mkdir -p $HOME/lsp/java/google-java-format
|
||||||
|
wget -O - https://github.com/google/google-java-format/releases/download/v1.11.0/google-java-format-1.11.0-all-deps.jar > $HOME/lsp/java/google-java-format/google-java-format.jar
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -1,6 +1 @@
|
||||||
require('lsp.jdtls_setup').setup()
|
require('lsp.jdtls_setup').setup()
|
||||||
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.softtabstop = 4
|
|
||||||
vim.opt.expandtab = true
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ local common_config = require("lsp.server_config")
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
require'jdtls.setup'.add_commands()
|
|
||||||
require'jdtls'.setup_dap()
|
require'jdtls'.setup_dap()
|
||||||
|
require'jdtls.setup'.add_commands()
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
|
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
|
|
Loading…
Reference in New Issue