Skip to content
Open
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
75 changes: 43 additions & 32 deletions docs/core/crash-course.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ browser-style single-file tab.
**Tip:** Renaming or moving a Java file via `r` / `m` triggers LSP file operations — JDTLS automatically updates all imports and references
across the project. This may modify many buffers at once. Save them all with `:wall`.

**Preview tip:** `P` uses Neo-tree's native preview mode, so you can scan files without leaving the tree. Press `<Esc>` to close the preview.
**Preview tip:** `P` uses Neo-tree's native preview mode, so you can scan files without leaving the tree. Press `<Esc>` to close Neo-tree.

---

Expand Down Expand Up @@ -728,7 +728,7 @@ After `gd`, `gR`, `gy`, or `gI`, Glance opens a results list with a file preview
| `<C-u>` / `<C-d>` | Scroll preview up / down |
| `<CR>` | Jump to selected result |
| `v` / `s` / `t` | Open in vsplit / split / new tab |
| `o` | Refresh preview |
| `o` | Preview selected location |
| `<leader>l` | Switch between list and preview |
| `q` / `Q` / `<Esc>` | Close Glance |

Expand Down Expand Up @@ -795,26 +795,29 @@ After `gd`, `gR`, `gy`, or `gI`, Glance opens a results list with a file preview

## Debugging

| Key | Action |
|--------------|----------------------------|
| `<leader>db` | Toggle breakpoint |
| `<leader>dB` | Breakpoint with condition |
| `<leader>dc` | Continue / Start debugging |
| `<leader>dC` | Run to cursor |
| `<leader>di` | Step into |
| `<leader>do` | Step out |
| `<leader>dO` | Step over |
| `<leader>dg` | Go to line (no execute) |
| `<leader>dl` | Run last |
| `<leader>dp` | Pause |
| `<leader>dr` | Toggle REPL |
| `<leader>dt` | Terminate |
| `<leader>ds` | Session info |
| `<leader>dj` | Up (call stack) |
| `<leader>dk` | Down (call stack) |
| `<leader>dw` | Hover widgets |
| `<leader>du` | Toggle DAP UI |
| `<leader>de` | Evaluate expression |
| Key | Action |
|---------------|----------------------------|
| `<leader>db` | Toggle breakpoint |
| `<leader>dB` | Breakpoint with condition |
| `<leader>dc` | Continue / Start debugging |
| `<leader>dC` | Run to cursor |
| `<leader>di` | Step into |
| `<leader>do` | Step out |
| `<leader>dO` | Step over |
| `<leader>dg` | Go to line (no execute) |
| `<leader>dl` | Run last |
| `<leader>dp` | Pause |
| `<leader>dr` | Toggle REPL |
| `<leader>dt` | Terminate |
| `<leader>ds` | Session info |
| `<leader>dj` | Down (call stack) |
| `<leader>dk` | Up (call stack) |
| `<leader>dw` | Hover widgets |
| `<leader>du` | Toggle DAP UI |
| `<leader>dU` | Toggle DAP UI keep-open |
| `<leader>de` | Evaluate expression |
| `<leader>dgt` | Debug Go test |
| `<leader>dgl` | Debug last Go test |

---

Expand All @@ -825,27 +828,34 @@ After `gd`, `gR`, `gy`, or `gI`, Glance opens a results list with a file preview
| `<leader>tt` | Run file |
| `<leader>tT` | Run all test files |
| `<leader>tr` | Run nearest test |
| `<leader>td` | Debug nearest test |
| `<leader>tp` | Run package |
| `<leader>tP` | Debug package |
| `<leader>tq` | Run file tests sequentially |
| `<leader>tl` | Run last |
| `<leader>tL` | Debug last |
| `<leader>tf` | Debug file |
| `<leader>tD` | Debug all test files |
| `<leader>ta` | Attach to running test |
| `<leader>tF` | Run failed tests |
| `<leader>ts` | Toggle summary |
| `<leader>to` | Show output |
| `<leader>tO` | Toggle output panel |
| `<leader>tc` | Clear output panel |
| `<leader>tS` | Stop (interactive) |
| `<leader>tw` | Toggle watch |

### Java-specific

| Key | Action |
|--------------|---------------------|
| `<leader>jr` | Run Main |
| `<leader>ji` | Init Project |
| `<leader>ju` | Update Project |
| `<leader>jc` | Stop Main |
| `<leader>jt` | Test Current Class |
| `<leader>jm` | Test Current Method |
| `<leader>jv` | View Test Report |
| Key | Action |
|--------------|--------------------|
| `<leader>jr` | Run Main |
| `<leader>jd` | Debug Main |
| `<leader>ji` | Init Project |
| `<leader>ju` | Update Project |
| `<leader>jc` | Stop Main |
| `<leader>jl` | Toggle Runner Logs |
| `<leader>ja` | Attach Remote JVM |

`:JavaInitProject [dir]` prompts for Maven/Gradle, project directory, artifact,
group id, and package, then opens the generated `Main.java`.
Expand Down Expand Up @@ -918,7 +928,7 @@ require('util.java_debug').debug_main() -- Debug main
| "Port already in use" | Stale session — close nvim or `killall java` |
| Breakpoints not hitting | Check `:LspInfo` for compilation errors, or check logs: `tail -f ~/.local/state/nvim/nvim-java.log` |

**See also:** `~/.config/nvim/JAVA_DEBUGGING.md` for complete reference.
**See also:** `docs/java/java-debugging.md` for complete reference.

---

Expand Down Expand Up @@ -970,6 +980,7 @@ Notes:
| `<leader>GC` | Find committed conflict markers |
| `<leader>GQ` | Finish `git mergetool` |
| `<leader>GA` | Abort `git mergetool` |
| `<leader>Gb` | Diff vs branch/ref |
| `<leader>Gm` | Diff vs main/master |
| `<leader>GM` | Diff vs origin/main |
| `<leader>Gq` | Close Diffview |
Expand Down
30 changes: 16 additions & 14 deletions docs/core/plugin-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ editor.lua
│ Maven/Gradle source roots when available
├── neo-tree.nvim ── file explorer (<leader>e cwd, <leader>E root)
│ ├── native preview mode ── `P` float preview, `l` focus, `<C-f>`/`<C-b>` scroll
│ ├── native preview mode ── `P` float preview, `l` focus, `<C-d>`/`<C-u>` scroll
│ ├── nvim-window-picker ── `s` in tree = pick window to open file in
│ ├── open mappings reveal current file by default; `<leader>ue` toggles that session-local behavior
│ ├── `Y` copies absolute path with unnamed-register fallback when clipboard is unavailable
Expand Down Expand Up @@ -366,6 +366,7 @@ git.lua
| `<leader>GC` | Find committed conflict markers |
| `<leader>GQ` | Finish `git mergetool` |
| `<leader>GA` | Abort `git mergetool` |
| `<leader>Gb` | Diff vs branch/ref |
| `<leader>Gm` | Diff vs main/master |
| `<leader>GM` | Diff vs origin/main |
| `<leader>Gq` | Close Diffview |
Expand All @@ -389,7 +390,9 @@ dap.lua
Java DAP is provided by nvim-java (java_debug_adapter = true)
```

**DAP keymaps** (`<leader>d*`): b/B breakpoint, c continue, i step-into, O step-over, o step-out, r REPL, u UI, U keep UI open on exit, e eval, t terminate
**DAP keymaps** (`<leader>d*`): b/B breakpoint, c continue, C run-to-cursor, g goto line without executing, i step-into, j down stack frame, k up stack
frame, l run last, O step-over, o step-out, p pause, r REPL, s session, t terminate, w widgets, u UI, U keep UI open on exit, e eval, gt debug Go test, gl
debug last Go test

---

Expand All @@ -399,14 +402,14 @@ Java DAP is provided by nvim-java (java_debug_adapter = true)
neotest.lua
neotest
├── neotest-java ── Maven/Gradle test runner
├── neotest-go ── Go test runner
├── neotest-golang ── Go test runner
└── neotest-python ── Python test runner
util/neotest_scope.lua ── scoped discovery + file/package target helpers
```

**Neotest keymaps** (`<leader>t*`): tt run file, tT run all, tr nearest, tp run package, tq run file tests sequentially, tl last, tF run failed, ts summary, to
output, tO output panel, tS stop (interactive
picker), tw watch
**Neotest keymaps** (`<leader>t*`): tt run file, tT run all, tr nearest, td debug nearest, tp run package, tP debug package, tq run file tests sequentially,
tl last, tL debug last, tf debug file, tD debug all, ta attach, tF run failed, ts summary, to output, tO output panel, tc clear output panel, tS stop
(interactive), tw watch

---

Expand All @@ -432,11 +435,10 @@ util/java_project_config.lua

lsp.lua excludes jdtls from mason-lspconfig (nvim-java owns it)
vim.g.lspconfig_jdtls_enabled = false (options.lua)
JVM: -Xms1g / -Xmx4g (prevents OOM on refactoring)
JVM: -Xms2G / -Xmx8G (prevents OOM on refactoring)
```

**Java keymaps** (`<leader>j*`): ji init project, ju update project, jr run main, jd debug main, jc stop, jl logs, ja attach remote, jt test class, jm test
method, jv view report
**Java keymaps** (`<leader>j*`): ji init project, ju update project, jr run main, jd debug main, jc stop, jl logs, ja attach remote

---

Expand Down Expand Up @@ -538,9 +540,9 @@ leetcode.lua
├── MunifTanjim/nui.nvim
└── nvim-tree/nvim-web-devicons
Keymaps: <leader>Ll menu, <leader>Lr run, <leader>Ls submit,
<leader>Ld daily, <leader>Ln random, <leader>Lt tabs,
<leader>Lp topic picker, <leader>LR DSA roadmap,
<leader>LU update cookies
<leader>Ld daily, <leader>Ln random, <leader>Lc console,
<leader>Li info, <leader>Lt tabs, <leader>Le/<leader>Lm/<leader>Lh
difficulty lists, <leader>LR DSA roadmap, <leader>LU update cookies
```

---
Expand Down Expand Up @@ -613,7 +615,7 @@ undotree.lua
undotree ── visual undo history tree → <leader>U

marks.lua
marks.nvim ── persistent marks with guttersigns, ]' / [' nav
marks.nvim ── persistent marks with guttersigns, m] / m[ nav

auto-save.lua
auto-save.nvim ── auto-save enabled by default (<leader>ua toggle)
Expand Down Expand Up @@ -695,7 +697,7 @@ lazy.nvim
├── TESTING
│ └── neotest
│ ├── neotest-java
│ ├── neotest-go
│ ├── neotest-golang
│ └── neotest-python
├── LEETCODE
Expand Down
2 changes: 1 addition & 1 deletion docs/core/prepequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ On Neovim 0.12+, run inside Neovim instead:
:GoInstallDeps
```

Installs: `gomodifytags`, `iferr` — used by gopher.nvim for struct tag generation and `if err != nil` snippets.
Installs: `gomodifytags`, `iferr`, `impl`, `gotests`, and `json2go` for gopher.nvim helpers.

---

Expand Down
16 changes: 9 additions & 7 deletions docs/core/session-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Update this file when:
runtime `PATH` values.
- `timeoutlen` is intentionally set to `500` to make leader sequences less
timing-sensitive with the heavy `<leader>` workflow.
- `smoothscroll` is enabled for smoother wrapped-line scrolling on supported
Neovim versions.
- Mouse support is disabled by default (`mouse=`) and can be toggled with
`<leader>um` for temporary GUI/terminal mouse use.
- Plain `j/k` are remapped in [lua/config/keymaps.lua](/home/konkov/.config/nvim/lua/config/keymaps.lua:61).
Expand Down Expand Up @@ -253,7 +255,9 @@ Update this file when:
(`E:`, `W:`, `I:`, `H:`, `+`, `~`, `-`) so they remain visible without
depending on icon fonts or a specific theme.
- Lualine Java status intentionally stays a minimal colored `●`: green for
attached/idle JDTLS, yellow when LSP status is busy, red when unavailable.
attached/idle JDTLS, yellow when Neovim reports recent LSP progress, red when
unavailable. The yellow state is based on `vim.lsp.status()`, so it is a
global LSP progress signal rather than a JDTLS-only busy check.
- `nvim-notify` background is derived from the active float/normal highlights
via the local `NotifyBackground` refresh hook instead of a TokyoNight-specific
hex color, so fade animations and popup contrast survive theme switches.
Expand Down Expand Up @@ -396,12 +400,10 @@ Update this file when:
handled, so renamed variables do not leave stale inlay hints behind.
- Inline diagnostics are provided by `tiny-inline-diagnostic.nvim`, enabled on
LSP attach, and toggled with `<leader>ud`.
- LSP inlay hints render at end-of-line through `nvim-lsp-endhints` instead of
Neovim's native inline positions. This avoids inline hint text colliding with
renamed/edited variables while preserving the normal `vim.lsp.inlay_hint`
enable/disable API and the local `<leader>uh` toggle. `nvim-lsp-endhints` is
loaded as a `nvim-lspconfig` dependency so its handler override is installed
before `LspAttach` enables hints.
- LSP inlay hints are managed by
[lua/util/inlay_hints.lua](/home/konkov/.config/nvim/lua/util/inlay_hints.lua:1)
through Neovim's native `vim.lsp.inlay_hint` API and toggled with
`<leader>uh`.
- Noice is allowed to own command/message UI, but hover/signature rendering is
intentionally disabled there to avoid conflicts with the chosen editing setup.
- `<C-CR>` and `<leader>Hy` open Yanky's Telescope `yank_history` picker through
Expand Down
2 changes: 1 addition & 1 deletion docs/plans/live-hunks-view-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hunk-header parser.
- `TextChanged`
- `TextChangedI`
- `BufWritePost`
- `User GitsignsUpdate` if available
- `User GitSignsUpdate` if available
- `WinScrolled`
- Keep a per-source-buffer state table:
- source buffer
Expand Down
2 changes: 1 addition & 1 deletion lua/config/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ opt.showmode = false
opt.laststatus = 3
opt.fillchars = { eob = " " }

-- Disable lspconfig jdtls (we use nvim-jdtls)
-- Disable lspconfig jdtls (we use nvim-java)
vim.g.lspconfig_jdtls_enabled = false

-- Better search
Expand Down
47 changes: 43 additions & 4 deletions lua/neotest-java/core/spec_builder/compiler/client_provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,45 @@ local logger = require("neotest-java.logger")
local function ClientProvider(deps)
local client

local function normalize(path)
if not path or path == "" then
return nil
end
return vim.uv.fs_realpath(path) or vim.fs.normalize(path)
end

local function path_has_prefix(path, prefix)
path = normalize(path)
prefix = normalize(prefix)
if not path or not prefix then
return false
end
if path == prefix then
return true
end
local with_sep = prefix:sub(-1) == "/" and prefix or (prefix .. "/")
return path:sub(1, #with_sep) == with_sep
end

local function client_matches_cwd(lsp_client, cwd)
local root = lsp_client and lsp_client.config and lsp_client.config.root_dir
local cwd_string = cwd and cwd:to_string()
return lsp_client
and lsp_client.initialized
and root
and cwd_string
and (path_has_prefix(cwd_string, root) or path_has_prefix(root, cwd_string))
end

local function find_client_for_cwd(cwd)
for _, lsp_client in ipairs(deps.get_clients({ name = "jdtls" })) do
if client_matches_cwd(lsp_client, cwd) then
return lsp_client
end
end
return nil
end

local function find_any_java_file(dir)
return Path(
assert(
Expand Down Expand Up @@ -37,14 +76,14 @@ local function ClientProvider(deps)

return function(cwd)
local started = deps.hrtime()
if client and client.initialized then
if client_matches_cwd(client, cwd) then
logger.warn(("[timing] reused existing jdtls client in %.1f ms"):format((deps.hrtime() - started) / 1e6))
return client
end

client = deps.get_clients({ name = "jdtls" })[1]
if client and client.initialized then
logger.warn(("[timing] found active jdtls client in %.1f ms"):format((deps.hrtime() - started) / 1e6))
client = find_client_for_cwd(cwd)
if client then
logger.warn(("[timing] found matching jdtls client in %.1f ms"):format((deps.hrtime() - started) / 1e6))
return client
end

Expand Down
1 change: 0 additions & 1 deletion lua/plugins/auto-save.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ return {
version = "^1.0.0",
cmd = "ASToggle",
event = { "InsertLeave", "TextChanged" },
notify_on_error_block = false,
opts = {
enabled = true, -- Start enabled, toggle with <leader>ua
trigger_events = {
Expand Down
Loading