Skip to content

nvim-java/nvim-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β˜• nvim-java

Neovim Lua Java Gradle Apache Maven

No need to put up with jdtls nonsense anymore. Just install and start writing public static void main(String[] args).

πŸ’« Features

  • βœ… Diagnostics & Auto Completion
  • βœ… Automatic DAP debug configuration
  • βœ… Running tests

πŸ’‘ Why

  • Uses nvim-lspconfig to setup jdtls
  • Realtime server settings updates is possible using neoconf
  • Everything necessary will be installed automatically (except JDKs)
  • Uses jdtls and auto loads jdtls plugins from mason.nvim
    • Supported plugins are,
      • lombok
      • java-test
      • java-debug-adapter
  • Typed & documented APIs

πŸ”¨ How to Install

πŸ“Œ details

Pre-requisites

  • Python 3.9 - for running jdtls wrapper launch script

Install the plugin

Using lazy.nvim

return {
  'nvim-java/nvim-java',
  dependencies = {
    'nvim-java/nvim-java-core',
    'neovim/nvim-lspconfig',
    'williamboman/mason.nvim',
    'mfussenegger/nvim-dap',
  },
  event = 'VeryLazy',
  opts = {},
}

Setup jdtls like you would usually do

require('lspconfig').jdtls.setup({})

Yep! That's all :)

πŸ’» APIs

πŸ“Œ details

DAP

  • config_dap - DAP is autoconfigured on start up, but in case you want to force configure it again, you can use this API
require('java').dap.config_dap()

Test

  • run_current_test_class - Run the test class in the active buffer
require('java').test.run_current_test_class()
  • debug_current_test_class - Debug the test class in the active buffer
require('java').test.debug_current_test_class()

πŸ“‘ Projects Acknowledgement

nvim-jdtls is a plugin that follows "Keep it simple, stupid!" approach. If you love customizing things by yourself, then give nvim-jdtls a try. I may or may not have copied some code πŸ˜‰ Beauty of Open source!