Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds initial customizations to support java debugging. #4

Closed
wants to merge 3 commits into from
Closed
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
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div align="center">

![Last commit](https://img.shields.io/github/last-commit/Alexis12119/nvim-config?style=for-the-badge&logo=git&color=000F10&logoColor=dark%20orange&labelColor=302D41)
![Last commit](https://img.shields.io/github/last-commit/anthonydmays/nvim-config?style=for-the-badge&logo=git&color=000F10&logoColor=dark%20orange&labelColor=302D41)

[![](https://img.shields.io/badge/Neovim-0.9+-blueviolet.svg?style=for-the-badge&color=000F10&logo=Neovim&logoColor=green&labelColor=302D41)](https://github.com/neovim/neovim)

![Preview](https://github.com/Alexis12119/nvim-config/assets/74944536/c6a3225a-eb52-4c21-bd9d-12a689173a0f)
![Preview](https://github.com/anthonydmays/nvim-config/assets/74944536/c6a3225a-eb52-4c21-bd9d-12a689173a0f)

</div>

Expand Down Expand Up @@ -53,12 +53,12 @@ Please follow these steps:
- On Linux/MacOS:

```sh
bash <(curl -s https://raw.githubusercontent.com/Alexis12119/nvim-config/main/installer/install.sh)
bash <(curl -s https://raw.githubusercontent.com/anthonydmays/nvim-config/main/installer/install.sh)
```

- On Windows (Powershell):
```ps1
Invoke-WebRequest https://raw.githubusercontent.com/Alexis12119/nvim-config/main/installer/install.ps1 -UseBasicParsing | Invoke-Expression
Invoke-WebRequest https://raw.githubusercontent.com/anthonydmays/nvim-config/main/installer/install.ps1 -UseBasicParsing | Invoke-Expression
```

## ✨ Features
Expand All @@ -81,20 +81,8 @@ Please follow these steps:
- **Keymap Cheatsheet**: Quickly reference keymaps with [which-key.nvim](https://github.com/folke/which-key.nvim).
- **Markdown Preview**: Preview your Markdown files with [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).

## 🌟 Stargazers

I appreciate the support from all the Stargazers!

[![Stargazers](http://reporoster.com/stars/dark/notext/Alexis12119/nvim-config)](https://github.com/Alexis12119/nvim-config/stargazers)

### CREDITS

This Neovim configuration is built upon the foundation of NvChad. Special thanks to the NvChad community and developers for their fantastic work.

- [NvChad](https://github.com/NvChad/NvChad)

> “Make it work, make it right, make it fast.”

\- Kent Beck
Thanks to @Alexis12119 for the excellent starting setup! Checkout the original repo at [Alexis12119/nvim-config](https://github.com/Alexis12119/nvim-config).

---
13 changes: 10 additions & 3 deletions core/autocommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ autocmd("FileType", {
local bufnr = vim.api.nvim_get_current_buf()

local java_debug_path = vim.fn.stdpath "data" .. "/mason/packages/java-debug-adapter/"
local java_test_path = vim.fn.stdpath "data" .. "/mason/packages/java-test/"
local jdtls_path = vim.fn.stdpath "data" .. "/mason/packages/jdtls/"

local bundles = {
vim.fn.glob(java_debug_path .. "extension/server/com.microsoft.java.debug.plugin-*.jar", 1),
};
vim.list_extend(bundles, vim.split(vim.fn.glob(java_test_path .. "extension/server/*.jar", 1), "\n"))

-- NOTE: Decrease the amount of files to improve speed(Experimental).
-- INFO: It's annoying to edit the version again and again.
local equinox_path = vim.split(vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/jdtls/plugins/*jar"), "\n")
Expand Down Expand Up @@ -245,9 +252,7 @@ autocmd("FileType", {
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = require("jdtls.setup").find_root(root_markers),
init_options = {
bundles = {
vim.fn.glob(java_debug_path .. "extension/server/com.microsoft.java.debug.plugin-*.jar", 1),
},
bundles = bundles,
},
settings = {
eclipse = {
Expand Down Expand Up @@ -296,6 +301,8 @@ autocmd("FileType", {
command! -buffer JdtJol lua require('jdtls').jol()
command! -buffer JdtBytecode lua require('jdtls').javap()
command! -buffer JdtJshell lua require('jdtls').jshell()
command! -buffer JavaTestCurrentClass lua require('jdtls').test_class()
command! -buffer JavaTestNearestMethod lua require('jdtls').test_nearest_method()
]]

-- This starts a new client & server,
Expand Down
2 changes: 1 addition & 1 deletion installer/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Clone-Repository {
# Main script
$NvChadRepo = "https://github.com/NvChad/NvChad.git"
$NvChadConfig = "$env:LOCALAPPDATA\nvim"
$ConfigRepo = "https://github.com/Alexis12119/nvim-config.git"
$ConfigRepo = "https://github.com/anthonydmays/nvim-config.git"
$ConfigPlugins = "$env:LOCALAPPDATA\nvim-data\lazy"

# Check if a Neovim configuration already exists
Expand Down
2 changes: 1 addition & 1 deletion installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
config_dir="$HOME/.config/nvim"
config_plugins="$HOME/.local/share/nvim/lazy"
nvchad_repo="https://github.com/NvChad/NvChad.git"
config_repo="https://github.com/Alexis12119/nvim-config.git"
config_repo="https://github.com/anthonydmays/nvim-config.git"

# Function to clone a Git repository with error handling
clone_repository() {
Expand Down
10 changes: 10 additions & 0 deletions plugins/dap/settings/java-debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
local dap = require "dap"
dap.configurations.java = {
{
name = "Launch Java",
javaExec = "java",
request = "launch",
type = "java",
},
{
type = 'java',
request = 'attach',
name = "Debug (Attach) - Remote",
hostName = "127.0.0.1",
port = 5005,
},
}
6 changes: 6 additions & 0 deletions plugins/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ return {
require "custom.plugins.lsp.mason"
end,
},
opts = {
registries = {
"github:nvim-java/mason-registry",
"github:mason-org/mason-registry",
},
},
},
-- Improve Other LSP Functionalities
{
Expand Down
1 change: 1 addition & 0 deletions plugins/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ end
-- File Explorer
return {
"nvim-tree/nvim-tree.lua",
enabled = true,
init = function()
require("core.utils").load_mappings "NvimTree"
end,
Expand Down