From 028e870c5a69cf5ee68e4776e9614a664cc65871 Mon Sep 17 00:00:00 2001 From: Srinesh Nisala Date: Sat, 6 Jul 2024 01:32:53 +0530 Subject: [PATCH 1/6] feat: add spring boot tools support (#232) --- README.md | 4 ++++ lazy.lua | 1 + lua/java/config.lua | 5 +++++ lua/java/startup/lspconfig-setup-wrap.lua | 14 ++++++++++++++ lua/java/startup/mason-dep.lua | 17 +++++++++++++---- 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f059ad8..6af665c 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,10 @@ want, following options are available enable = true, }, + spring_boot_tools = { + enable = true, + }, + jdk = { -- install jdk using mason.nvim auto_install = true, diff --git a/lazy.lua b/lazy.lua index f46af6d..a3ea62b 100644 --- a/lazy.lua +++ b/lazy.lua @@ -9,6 +9,7 @@ return { 'MunifTanjim/nui.nvim', 'neovim/nvim-lspconfig', 'mfussenegger/nvim-dap', + 'JavaHello/spring-boot.nvim', { 'williamboman/mason.nvim', opts = { diff --git a/lua/java/config.lua b/lua/java/config.lua index 003d5c5..8844429 100644 --- a/lua/java/config.lua +++ b/lua/java/config.lua @@ -2,6 +2,7 @@ ---@field root_markers string[] ---@field java_test { enable: boolean } ---@field java_debug_adapter { enable: boolean } +---@field spring_boot_tools { enable: boolean } ---@field jdk { auto_install: boolean } ---@field notifications { dap: boolean } ---@field verification { invalid_order: boolean, duplicate_setup_calls: boolean, invalid_mason_registry: boolean } @@ -29,6 +30,10 @@ local config = { enable = true, }, + spring_boot_tools = { + enable = true, + }, + jdk = { -- install jdk using mason.nvim auto_install = true, diff --git a/lua/java/startup/lspconfig-setup-wrap.lua b/lua/java/startup/lspconfig-setup-wrap.lua index f179d67..ab3eb75 100644 --- a/lua/java/startup/lspconfig-setup-wrap.lua +++ b/lua/java/startup/lspconfig-setup-wrap.lua @@ -1,5 +1,6 @@ local lspconfig = require('lspconfig') local log = require('java.utils.log') +local mason_util = require('java-core.utils.mason') local server = require('java-core.ls.servers.jdtls') @@ -23,12 +24,25 @@ function M.setup(config) table.insert(jdtls_plugins, 'java-debug-adapter') end + if config.spring_boot_tools.enable then + table.insert(jdtls_plugins, 'spring-boot-tools') + end + local default_config = server.get_config({ root_markers = config.root_markers, jdtls_plugins = jdtls_plugins, use_mason_jdk = config.jdk.auto_install, }) + if config.spring_boot_tools.enable then + require('spring_boot').setup({ + ls_path = mason_util.get_pkg_path('spring-boot-tools') + .. '/extension/language-server', + }) + + require('spring_boot').init_lsp_commands() + end + org_setup(vim.tbl_extend('force', default_config, user_config)) end end diff --git a/lua/java/startup/mason-dep.lua b/lua/java/startup/mason-dep.lua index 8621732..73353b8 100644 --- a/lua/java/startup/mason-dep.lua +++ b/lua/java/startup/mason-dep.lua @@ -6,6 +6,8 @@ local async = require('java-core.utils.async') local lazy = require('java.ui.lazy') local sync = async.sync +local List = require('java-core.utils.list') + local M = {} ---Install mason package dependencies for nvim-java @@ -42,19 +44,26 @@ function M.refresh_and_install(packages) mason_util.install_pkgs(packages) end +---Returns a list of dependency packages +---@param config java.Config +---@return table function M.get_pkg_list(config) - local dependecies = { + local deps = List:new({ { name = 'jdtls', version = 'v1.31.0' }, { name = 'lombok-nightly', version = 'nightly' }, { name = 'java-test', version = '0.40.1' }, { name = 'java-debug-adapter', version = '0.55.0' }, - } + }) if config.jdk.auto_install then - table.insert(dependecies, { name = 'openjdk-17', version = '17.0.2' }) + deps:push({ name = 'openjdk-17', version = '17.0.2' }) + end + + if config.spring_boot_tools.enable then + deps:push({ name = 'spring-boot-tools', version = '1.55.1' }) end - return dependecies + return deps end return M From 8348857a8151316db5d3e1dcfd73796bae561c58 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:42:50 +0530 Subject: [PATCH 2/6] chore(doc): automatic vimdoc update (#231) Co-authored-by: s1n7ax --- doc/nvim-java.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/nvim-java.txt b/doc/nvim-java.txt index 7364b11..bdb56bc 100644 --- a/doc/nvim-java.txt +++ b/doc/nvim-java.txt @@ -1,4 +1,4 @@ -*nvim-java.txt* For Neovim >= 0.9.4 Last change: 2024 July 03 +*nvim-java.txt* For Neovim >= 0.9.4 Last change: 2024 July 05 ============================================================================== Table of Contents *nvim-java-table-of-contents* @@ -310,6 +310,10 @@ want, following options are available enable = true, }, + spring_boot_tools = { + enable = true, + }, + jdk = { -- install jdk using mason.nvim auto_install = true, From 7ade92c38a517e7fbfe038900617a57898feb257 Mon Sep 17 00:00:00 2001 From: s1n7ax Date: Sat, 6 Jul 2024 01:52:04 +0530 Subject: [PATCH 3/6] chore(doc): update features in readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6af665c..bbd18ce 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Just install and start writing `public static void main(String[] args)`. ## :dizzy: Features +- :white_check_mark: Spring boot tools - :white_check_mark: Diagnostics & Auto Completion - :white_check_mark: Automatic [DAP](https://github.com/mfussenegger/nvim-dap) debug configuration @@ -30,6 +31,7 @@ Just install and start writing `public static void main(String[] args)`. - Realtime server settings updates is possible using [neoconf](https://github.com/folke/neoconf.nvim) - Auto loads necessary `jdtls` plugins - Supported plugins are, + - `spring-boot-tools` - `lombok` - `java-test` - `java-debug-adapter` From 64ffdf8e2ac7cde817ddcc7156bdc0ae173418c2 Mon Sep 17 00:00:00 2001 From: s1n7ax Date: Sat, 6 Jul 2024 01:52:32 +0530 Subject: [PATCH 4/6] refactor: lock spring-boot dep to reviewed commit --- lazy.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lazy.lua b/lazy.lua index a3ea62b..90e58b3 100644 --- a/lazy.lua +++ b/lazy.lua @@ -9,7 +9,10 @@ return { 'MunifTanjim/nui.nvim', 'neovim/nvim-lspconfig', 'mfussenegger/nvim-dap', - 'JavaHello/spring-boot.nvim', + { + 'JavaHello/spring-boot.nvim', + commit = '218c0c26c14d99feca778e4d13f5ec3e8b1b60f0', + }, { 'williamboman/mason.nvim', opts = { From ccf38dbfe41eecd70edfc23cf6acf81ab5707e29 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:53:28 +0530 Subject: [PATCH 5/6] chore(doc): automatic vimdoc update (#234) Co-authored-by: s1n7ax --- doc/nvim-java.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/nvim-java.txt b/doc/nvim-java.txt index bdb56bc..a0c7fc1 100644 --- a/doc/nvim-java.txt +++ b/doc/nvim-java.txt @@ -35,6 +35,7 @@ DEMO *nvim-java-demo* FEATURES *nvim-java-features* +- Spring boot tools - Diagnostics & Auto Completion - Automatic DAP debug configuration @@ -49,6 +50,7 @@ WHY *nvim-java-why* - Realtime server settings updates is possible using neoconf - Auto loads necessary `jdtls` plugins - Supported plugins are, + - `spring-boot-tools` - `lombok` - `java-test` - `java-debug-adapter` From 5b07857ce01df35fceb0b2fb3ebb718060658441 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:58:15 +0530 Subject: [PATCH 6/6] chore(main): release 1.10.0 (#233) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Srinesh Nisala --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 532b1e2..5990832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.10.0](https://github.com/nvim-java/nvim-java/compare/v1.9.1...v1.10.0) (2024-07-05) + + +### Features + +* add spring boot tools support ([#232](https://github.com/nvim-java/nvim-java/issues/232)) ([028e870](https://github.com/nvim-java/nvim-java/commit/028e870c5a69cf5ee68e4776e9614a664cc65871)) + ## [1.9.1](https://github.com/nvim-java/nvim-java/compare/v1.9.0...v1.9.1) (2024-07-05)