Skip to content

Latest commit

 

History

History
123 lines (89 loc) · 3.9 KB

File metadata and controls

123 lines (89 loc) · 3.9 KB

java-maven-test.nvim

Neovim plugin that allows you to easily search and execute your tests

Lua Neovim 0.10 Work In Progress

Table of Contents

The problem ⚠️

You open Neovim, your preferred editor, with the intention of running tests without having to leave your preferred environment.

The solution 🏆

This Neovim plugin, java-maven-test.nvim, integrates with telescope.nvim and nvim-treesitter to facilitate interactive fuzzy searching and execution of Java tests within a class.

asciicast

Repository structure 📂

java-maven-test.nvim/
├── LICENSE
├── lua
│   └── java-maven-test
│       ├── commands.lua    # Commands exposed to Neovim
│       ├── ui.lua          # UI logic (pickers and layout)
│       ├── init.lua        # Plugin entry point
│       ├── notify.lua      # Notification-related logic
│       ├── mvn.lua         # Maven-related logic
│       └── util.lua        # Utility functions
└── README.md

Functionalities ⛏️

  • Execute test case under the cursor
  • Execute all test in a given class
  • Fuzzy find trough all tests in a class and pick which one to execute
  • Notifications message about test results

Installation ⭐

  • Make sure you have Neovim v0.9.0 or greater. ❗
  • Dependecies: treesiter && telescope && plenary (telescope dep)
  • Install using you plugin manager

Vim - Plug

Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'

Plug 'nvim-treesitter/nvim-treesitter'

Plug 'rcarriga/nvim-notify'

Plug 'jkeresman01/java-maven-test.nvim'

Packer

 use {
  'nvim-telescope/telescope.nvim', tag = '0.1.8',
-- or                            , branch = '0.1.x',
   requires = { {'nvim-lua/plenary.nvim'} }
 }

 use 'nvim-treesitter/nvim-treesitter'
 use 'rcarriga/nvim-notify'

 use 'jkeresman01/java-maven-test.nvim'

Commands 🎹

Following commands have been exposed to Neovim:

Commands

:MavenTest                  -- Launch picker (select your test case from UI)
:MavenTestAtCursor          -- Execute test at cursor
:MavenTestAllInClass        -- Execute all tests in class

Setup 🔧

Set the keybindings as you see fit, here is one example:

require('java-maven-test').setup()

vim.keymap.set("n", "<leader>ft", "<cmd>MavenTest<CR>")
vim.keymap.set("n", "<leader>rt", "<cmd>MavenTestAtCursor<CR>")
vim.keymap.set("n", "<leader>ra", "<cmd>MavenTestAllInClass<CR>")

Keybindings Action
<leader>rt Execute test under the cursor
<leader>ra Execute all tests in currently opened class
<leader>ft Fuzzy find trough tests in a given class and execute selected one