diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a6c617..48715b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [2.1.0](https://github.com/nvim-java/nvim-java/compare/v2.0.2...v2.1.0) (2025-01-26) + + +### Features + +* add sync ui select util ([#345](https://github.com/nvim-java/nvim-java/issues/345)) ([c616f72](https://github.com/nvim-java/nvim-java/commit/c616f72fa2ea0ad9d7798e1d7cab56aa6de56108)) + + +### Bug Fixes + +* **dap:** do not override previously defined user config ([#342](https://github.com/nvim-java/nvim-java/issues/342)) ([4d810a5](https://github.com/nvim-java/nvim-java/commit/4d810a546c262ca8f60228dc98ba51f81f5649c6)) + ## [2.0.2](https://github.com/nvim-java/nvim-java/compare/v2.0.1...v2.0.2) (2024-12-24) diff --git a/README.md b/README.md index 6d4108b..b2bce7f 100644 --- a/README.md +++ b/README.md @@ -356,7 +356,7 @@ want, following options are available }, jdtls = { - version = 'v1.37.0', + version = 'v1.43.0', }, lombok = { @@ -366,7 +366,7 @@ want, following options are available -- load java test plugins java_test = { enable = true, - version = '0.40.1', + version = '0.43.0', }, -- load java debugger plugins @@ -377,11 +377,13 @@ want, following options are available spring_boot_tools = { enable = true, + version = '1.59.0', }, jdk = { -- install jdk using mason.nvim auto_install = true, + version = '17.0.2', }, notifications = { diff --git a/doc/nvim-java.txt b/doc/nvim-java.txt index 545faef..6d24539 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 14 +*nvim-java.txt* For Neovim >= 0.9.4 Last change: 2024 December 24 ============================================================================== Table of Contents *nvim-java-table-of-contents* @@ -24,9 +24,15 @@ Table of Contents *nvim-java-table-of-contents* Just install and start writing `public static void main(String[] args)`. - [!WARNING] You cannot use `nvim-java` alongside `nvim-jdtls`. So remove + [!CAUTION] You cannot use `nvim-java` alongside `nvim-jdtls`. So remove `nvim-jdtls` before installing this + [!TIP] You can find cool tips & tricks here + https://github.com/nvim-java/nvim-java/wiki/Tips-&-Tricks + + [!NOTE] If you are facing errors while using, please check troubleshoot wiki + https://github.com/nvim-java/nvim-java/wiki/Troubleshooting + DEMO *nvim-java-demo* @@ -106,7 +112,9 @@ COMMANDS *nvim-java-commands* BUILD ~ -- `JavaBuildWorkspace` - Runs a full workspace build +- `JavaBuildBuildWorkspace` - Runs a full workspace build +- `JavaBuildCleanWorkspace` - Clear the workspace cache (for now you have to + close and reopen to restart the language server after the deletion) RUNNER ~ @@ -171,6 +179,14 @@ BUILD ~ require('java').build.build_workspace() < +- `build.clean_workspace` - Clear the workspace cache + (for now you have to close and reopen to restart the language server after + the deletion) + +>lua + require('java').build.clean_workspace() +< + RUNNER ~ @@ -361,23 +377,35 @@ want, following options are available '.git', }, + jdtls = { + version = 'v1.43.0', + }, + + lombok = { + version = 'nightly', + }, + -- load java test plugins java_test = { enable = true, + version = '0.43.0', }, -- load java debugger plugins java_debug_adapter = { enable = true, + version = '0.58.1', }, spring_boot_tools = { enable = true, + version = '1.59.0', }, jdk = { -- install jdk using mason.nvim auto_install = true, + version = '17.0.2', }, notifications = { @@ -408,7 +436,7 @@ want, following options are available -- mason.nvim plugin. -- IF it's not registered correctly, an error will be thrown and nvim-java -- will stop setup - invalid_mason_registry = true, + invalid_mason_registry = false, }, } < diff --git a/lua/java/config.lua b/lua/java/config.lua index b560545..beb552e 100644 --- a/lua/java/config.lua +++ b/lua/java/config.lua @@ -4,8 +4,8 @@ ---@field lombok { version: string } ---@field java_test { enable: boolean, version: string } ---@field java_debug_adapter { enable: boolean, version: string } ----@field spring_boot_tools { enable: boolean } ----@field jdk { auto_install: boolean } +---@field spring_boot_tools { enable: boolean, version: string } +---@field jdk { auto_install: boolean, version: string } ---@field notifications { dap: boolean } ---@field verification { invalid_order: boolean, duplicate_setup_calls: boolean, invalid_mason_registry: boolean } local config = { @@ -23,7 +23,7 @@ local config = { }, jdtls = { - version = 'v1.37.0', + version = 'v1.43.0', }, lombok = { @@ -44,11 +44,13 @@ local config = { spring_boot_tools = { enable = true, + version = '1.55.1', }, jdk = { -- install jdk using mason.nvim auto_install = true, + version = '17.0.2', }, notifications = { diff --git a/lua/java/dap/init.lua b/lua/java/dap/init.lua index 42d78f7..15804a9 100644 --- a/lua/java/dap/init.lua +++ b/lua/java/dap/init.lua @@ -105,7 +105,8 @@ function M:config_dap() end end -- end - nvim_dap.configurations.java = dap_config + nvim_dap.configurations.java = nvim_dap.configurations.java or {} + vim.list_extend(nvim_dap.configurations.java, dap_config) end return M diff --git a/lua/java/startup/mason-dep.lua b/lua/java/startup/mason-dep.lua index b239381..f05e3a5 100644 --- a/lua/java/startup/mason-dep.lua +++ b/lua/java/startup/mason-dep.lua @@ -59,11 +59,14 @@ function M.get_pkg_list(config) }) if config.jdk.auto_install then - deps:push({ name = 'openjdk-17', version = '17.0.2' }) + deps:push({ name = 'openjdk-17', version = config.jdk.version }) end if config.spring_boot_tools.enable then - deps:push({ name = 'spring-boot-tools', version = '1.55.1' }) + deps:push({ + name = 'spring-boot-tools', + version = config.spring_boot_tools.version, + }) end return deps diff --git a/lua/java/utils/ui.lua b/lua/java/utils/ui.lua index d487775..91860d4 100644 --- a/lua/java/utils/ui.lua +++ b/lua/java/utils/ui.lua @@ -26,6 +26,30 @@ function M.select(prompt, values, format_item, opts) end) end +--Sync vim.ui.select function +---@generic T +---@param prompt string +---@param values T[] +---@param format_item? fun(item: T, index: number): string +---@param opts? { return_one: boolean } +---@return T | nil +function M.select_sync(prompt, values, format_item, opts) + opts = opts or { prompt_single = false } + + if not opts.prompt_single and #values == 1 then + return values[1] + end + + local labels = { prompt } + for index, value in ipairs(values) do + table.insert(labels, format_item and format_item(value, index) or value) + end + + local selected_index = vim.fn.inputlist(labels) + + return values[selected_index] +end + ---Async vim.ui.select function ---@generic T ---@param prompt string