Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ Yep! That's all :)

</details>

## :keyboard: Commands

<details>

<summary>:pushpin: details</summary>

- `JavaDapConfig` - DAP is autoconfigured on start up, but in case you want to force configure it again, you can use this API
- `JavaTestRunCurrentClass` - Run the test class in the active buffer
- `JavaTestDebugCurrentClass` - Debug the test class in the active buffer
- `JavaTestRunCurrentMethod` - Run the test method on the cursor
- `JavaTestDebugCurrentMethod` - Debug the test method on the cursor
- `JavaTestViewLastReport` - Open the last test report in a popup window

</details>

## :computer: APIs

<details>
Expand Down Expand Up @@ -125,7 +140,7 @@ require('java').test.debug_current_method()
- `view_report` - Open the last test report in a popup window

```lua
require('java').test.view_report()
require('java').test.view_last_report()
```

</details>
Expand Down
2 changes: 1 addition & 1 deletion lua/java.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ M.test.debug_current_class = test.debug_current_class
M.test.run_current_method = test.run_current_method
M.test.debug_current_method = test.debug_current_method

M.test.view_report = test.view_report
M.test.view_last_report = test.view_last_report

----------------------------------------------------------------------
-- Manipulate --
Expand Down
2 changes: 1 addition & 1 deletion lua/java/api/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function M.run_current_method()
.run()
end

function M.view_report()
function M.view_last_report()
if M.last_report then
M.last_report:show_report()
end
Expand Down
26 changes: 21 additions & 5 deletions plugin/java.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
-- vim.api.nvim_create_user_command(
-- 'MyFirstFunction',
-- require('plugin_name').hello,
-- {}
-- )
local java = require('java')

local function c(cmd, callback, opts)
vim.api.nvim_create_user_command(cmd, callback, opts or {})
end

local cmd_map = {
JavaDapConfig = { java.dap.config_dap },

JavaTestRunCurrentClass = { java.test.run_current_class },
JavaTestDebugCurrentClass = { java.test.debug_current_class },

JavaTestRunCurrentMethod = { java.test.run_current_method },
JavaTestDebugCurrentMethod = { java.test.debug_current_method },

JavaTestViewLastReport = { java.test.view_last_report },
}

for cmd, details in pairs(cmd_map) do
c(cmd, details[1], details[2])
end