From d915336df4419153821ba4f7a10e74044635777d Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Wed, 14 Aug 2024 01:20:44 +0300 Subject: [PATCH] neovim: add spring-boot ls --- neovim/configs/language-server.nix | 6 +++-- neovim/plugins/default.nix | 1 + neovim/plugins/spring-boot.nix | 40 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 neovim/plugins/spring-boot.nix diff --git a/neovim/configs/language-server.nix b/neovim/configs/language-server.nix index 4c72d3c..69a67e7 100644 --- a/neovim/configs/language-server.nix +++ b/neovim/configs/language-server.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let inherit (lib.nix2lua) call; in { @@ -48,7 +48,9 @@ let inherit (lib.nix2lua) call; in root_dir = call "${config.plugin.nvim-lspconfig.varName}.util.root_pattern" [ "deno.json" "deno.jsonc" ]; }; # java - jdtls = { cmd = [ "jdtls" ]; }; + jdtls = { + cmd = [ "${pkgs.jdt-language-server}/bin/jdtls" ]; + }; # json jsonls = { }; # css, scss, less diff --git a/neovim/plugins/default.nix b/neovim/plugins/default.nix index 5ad1883..de08d71 100644 --- a/neovim/plugins/default.nix +++ b/neovim/plugins/default.nix @@ -1,5 +1,6 @@ { imports = [ ./ollama.nix + ./spring-boot.nix ]; } diff --git a/neovim/plugins/spring-boot.nix b/neovim/plugins/spring-boot.nix new file mode 100644 index 0000000..0324d00 --- /dev/null +++ b/neovim/plugins/spring-boot.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: + + +let + inherit (lib.nix2lua) pipe1 call0 call1; + inherit (pkgs) vimUtils fetchFromGitHub; + + spring-boot-nvim = vimUtils.buildVimPlugin { + pname = "spring-boot"; + version = "2024-08-10"; + src = fetchFromGitHub { + owner = "JavaHello"; + repo = "spring-boot.nvim"; + rev = "995a705becbc711b703f9ab344745ececf6471a3"; + hash = "sha256-Hri6WQnWTmFwlOUCVG8O1eELn9FhlvVpUC9lt+uIGkc="; + }; + }; +in + +{ + plugin.spring-boot-nvim = { + enable = true; + package = spring-boot-nvim; + name = "spring_boot"; + }; + + plugin.nvim-lspconfig.beforeSetup = [ + (pipe1 config.plugin.spring-boot-nvim.var (call1 "setup" { + java_cmd = "${pkgs.jdk22}/bin/java"; + log_file = "/tmp/spring-boot.log"; + })) + (pipe1 config.plugin.spring-boot-nvim.var (call0 "init_lsp_commands")) + ]; + + plugins.language-server.lspconfig.serverSettings.jdtls = { + init_options = { + bundles = (pipe1 config.plugin.spring-boot-nvim.var (call0 "java_extensions")); + }; + }; +}