fix(java): give java a default nvim-dap config (#4261)

## Description

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->
Currently, there are no Java configurations for nvim-dap upon enabling
the Java extras.

This requires debugging configurations to be setup manually afterwards.

(This is unlike many other language extras which do have nvim-dap
support "out of the box")

This pr creates an initial configuration for nvim-dap which lets it
attach to a debugging process on port 5005.
(such as a spring boot application) More can be added if there are any
experienced Java devs here.

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->
None

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
Error message:

![image](https://github.com/user-attachments/assets/5922cf48-6ac7-4a2a-8785-1f9b958089e4)

Java remote debugging open:

![image](https://github.com/user-attachments/assets/dfbe7c5b-2308-4aa4-a236-487605e4c75a)


## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
This commit is contained in:
Michael Kwan 2024-11-26 03:13:01 -05:00 committed by GitHub
parent cdf3f1f2bd
commit c9102bc351
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,6 +40,20 @@ return {
{ {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
optional = true, optional = true,
opts = function()
-- Simple configuration to attach to remote java debug process
-- Taken directly from https://github.com/mfussenegger/nvim-dap/wiki/Java
local dap = require("dap")
dap.configurations.java = {
{
type = "java",
request = "attach",
name = "Debug (Attach) - Remote",
hostName = "127.0.0.1",
port = 5005,
},
}
end,
dependencies = { dependencies = {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",