Skip to content

Nvim 0.12 update - #42

Merged
nikero41 merged 7 commits into
mainfrom
nvim-0.12-update
Mar 29, 2026
Merged

Nvim 0.12 update#42
nikero41 merged 7 commits into
mainfrom
nvim-0.12-update

Conversation

@nikero41

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and refactorings across the codebase, focusing on standardizing buffer-related option naming, improving LSP handler usage, and updating diagnostics and plugin integrations for better maintainability and clarity. The most significant changes are grouped below.

Standardization of Buffer Option Naming

  • Replaced all usages of the buffer option with buf in keymap and plugin configurations for consistency, affecting files such as lua/filetypes.lua, lua/nikero/keymaps.lua, lua/plugins/git.lua, and lua/plugins/harpoon.lua. [1] [2] [3] [4] [5] [6] [7]

LSP Handler and Diagnostic Improvements

  • Updated LSP handler references to use default handlers from vim.lsp.handlers instead of deprecated or direct handler calls in TypeScript and Go plugin configurations, improving future compatibility and code clarity. [1] [2] [3]
  • Improved inlay hint truncation logic in the Go LSP plugin, ensuring correct string handling and consistent use of Neovim's string functions. [1] [2] [3]
  • Changed CodeLens activation to use vim.lsp.codelens.enable(true) instead of refresh() for better alignment with upstream LSP API changes, and updated related plugin attachment logic. [1] [2]

Diagnostic and Treesitter Enhancements

  • Modified diagnostic jump configuration to use an on_jump callback that opens a floating window at the cursor for improved user experience.
  • Refined Treesitter parser initialization to check the parser object directly, simplifying error handling.

Plugin and UI Adjustments

  • Removed the override for vim.lsp.util.stylize_markdown in the UI plugin, possibly to restore default behavior or fix a bug.

These changes collectively enhance code consistency, maintainability, and compatibility with evolving Neovim APIs.

@coderabbitai

coderabbitai Bot commented Mar 29, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved LSP inlay hint handler delegation to use built-in defaults
    • Refined diagnostic jump behavior with cursor-scoped focus control
    • Enhanced LSP diagnostic handler delegation for better integration
    • Simplified parser acquisition error handling
  • Configuration

    • Standardized keymap option naming across features
    • Updated CodeLens activation method
    • Modified markdown stylization in LSP hover rendering

Walkthrough

This pull request updates multiple Neovim configuration files, primarily migrating keymap option names from buffer to buf across plugin integrations, refactoring LSP handler delegation patterns, changing CodeLens behavior from refresh to enable, updating diagnostic jump handling, and adjusting plugin configurations for diagnostic and parser operations.

Changes

Cohort / File(s) Summary
Keymap Option API Migration
lua/filetypes.lua, lua/nikero/keymaps.lua, lua/plugins/git.lua, lua/plugins/harpoon.lua
Standardized keymap option names from buffer to buf across multiple plugin integrations, affecting buffer-scoped keymap registration and conflict detection logic.
LSP Handler Refactoring
lsp/tsgo.lua, lua/plugins/language/typescript.lua
Updated LSP handler delegation to use built-in default handlers (vim.lsp.handlers) instead of deprecated methods; refactored inlay hint truncation logic and diagnostic handler delegation patterns.
CodeLens Behavior Updates
lua/keymaps.lua, lua/plugins/language/support.lua
Changed CodeLens operation from refresh() to enable(true), altering activation mechanism across keymap binding and LSP on\_attach callbacks.
Plugin Configuration & Parser Changes
lua/options.lua, lua/plugins/syntax.lua, lua/plugins/ui.lua
Modified diagnostic jump handler to use explicit on_jump callback, removed pcall exception handling in TreeSitter parser acquisition, and removed markdown stylization override from Noice configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 From buffer to buf the keymaps now fly,
Handlers delegated with a methodical sigh,
CodeLens enabled with newfound delight,
Diagnostics now jumping—no pcall in sight!
The config refreshed, from Neovim to sky.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title references Nvim 0.12 update, which aligns with the PR's primary objective of updating code for Neovim 0.12 compatibility across multiple files and LSP handlers.
Description check ✅ Passed The description comprehensively outlines all major changes in the PR, including buffer option standardization, LSP handler improvements, diagnostic enhancements, and plugin adjustments.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nvim-0.12-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
lua/plugins/harpoon.lua (1)

67-79: ⚠️ Potential issue | 🔴 Critical

vim.keymap.set expects buffer, not buf — keymaps will be global instead of buffer-local.

The native Neovim vim.keymap.set API uses buffer (not buf) to scope keymaps to a specific buffer. Using { buf = cx.bufnr } will cause this option to be silently ignored, making <C-v> and <C-x> apply globally rather than only in the Harpoon menu window.

Fix
 vim.keymap.set(
   "n",
   "<C-v>",
   function() harpoon.ui:select_menu_item({ vsplit = true }) end,
-  { buf = cx.bufnr }
+  { buffer = cx.bufnr }
 )

 vim.keymap.set(
   "n",
   "<C-x>",
   function() harpoon.ui:select_menu_item({ split = true }) end,
-  { buf = cx.bufnr }
+  { buffer = cx.bufnr }
 )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lua/plugins/harpoon.lua` around lines 67 - 79, The mappings for
harpoon.ui:select_menu_item are being set with vim.keymap.set using the wrong
option key — change the option from { buf = cx.bufnr } to { buffer = cx.bufnr }
for both mappings so they become buffer-local; update the two calls to
vim.keymap.set that reference cx.bufnr (the <C-v> and <C-x> mappings) to use the
buffer option instead of buf.
lua/nikero/keymaps.lua (1)

60-68: ⚠️ Potential issue | 🔴 Critical

Neovim API returns buffer, not buf — buffer info will always be nil.

The vim.api.keyset.get_keymap type (returned by nvim_get_keymap and nvim_buf_get_keymap) contains a buffer field, not buf. Reading keymap.buf will always be nil, so buffer-local keymaps won't be correctly identified when loaded from Neovim's keymap API.

🐛 Proposed fix
 opts = {
   desc = keymap.desc,
-  buf = keymap.buf,
+  buf = keymap.buffer,
   silent = keymap.silent == 1 and true or false,
   expr = keymap.expr == 1 and true or false,
   noremap = keymap.noremap == 1 and true or false,
   script = keymap.script == 1 and true or false,
 },
What fields does Neovim's nvim_get_keymap API return for buffer-local keymaps?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lua/nikero/keymaps.lua` around lines 60 - 68, The code is reading keymap.buf
which is always nil because Neovim's keymap API uses the field name buffer;
update the keymap options assembly (where opts is built using keymap.desc,
keymap.buf, etc.) to read keymap.buffer instead of keymap.buf so buffer-local
maps are preserved, keeping the existing truthy checks (e.g., keymap.buffer == 1
and true or false) and leaving other fields (desc, silent, expr, noremap,
script) unchanged.
lua/filetypes.lua (1)

115-120: ⚠️ Potential issue | 🔴 Critical

Remove unsupported buf option from Snacks.keymap.set.

Snacks.keymap.set does not accept a buf option for buffer-local keymaps. According to the official Snacks.nvim API, this method only supports ft (filetype) or lsp (LSP client filter) for scope. The buf parameter is silently ignored, so the keymap will apply globally rather than to the specific buffer. Use either filetype-specific scoping with ft or remove the buffer option and manage the keymap lifecycle separately if buffer-local binding is needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lua/filetypes.lua` around lines 115 - 120, The keymap is being created with
Snacks.keymap.set using a unsupported buf option which is ignored, causing the
"q" mapping to be global; replace the buffer-scoped call by either using
Snacks.keymap.set with the ft or lsp scoping supported by Snacks (e.g., pass ft
= <filetype> to scope to that filetype) or remove the buf option and set a true
buffer-local mapping via vim.api.nvim_buf_set_keymap / vim.keymap.set with the
specific args.buf as the target; ensure the mapped callback still calls
Snacks.bufdelete.delete({ buf = args.buf, force = true }) and that the mapping
is created inside the vim.schedule block so it binds for the intended buffer
only.
🧹 Nitpick comments (1)
lua/keymaps.lua (1)

167-172: Description says "refresh" but action is now "enable".

The keymap description is "LSP CodeLens refresh" but the callback now calls vim.lsp.codelens.enable(true). While enabling does trigger a refresh, the semantic intent differs. Consider updating the description for clarity.

Also note this enables CodeLens globally (no buffer argument), whereas the on_attach in lua/plugins/language/support.lua enables per-buffer with { bufnr = buffer }.

♻️ Suggested description update
 {
   "n",
   "<leader>ll",
   function() vim.lsp.codelens.enable(true) end,
-  { desc = "LSP CodeLens refresh", lsp = { method = "textDocument/codeLens" } },
+  { desc = "LSP CodeLens enable", lsp = { method = "textDocument/codeLens" } },
 },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lua/keymaps.lua` around lines 167 - 172, The keymap currently calls
vim.lsp.codelens.enable(true) but the description says "LSP CodeLens refresh"
and the enable call affects global state (no bufnr) unlike the per-buffer
enabling in on_attach (lua/plugins/language/support.lua); either update the
keymap description to accurately say "LSP CodeLens enable" (or "Enable LSP
CodeLens (global)") or change the callback to perform a refresh/ per-buffer
enable consistent with on_attach (e.g., call vim.lsp.codelens.refresh() for a
refresh action, or call vim.lsp.codelens.enable({ bufnr = <buffer> }) if you can
access the buffer), and update the desc and lsp metadata accordingly to match
the chosen behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@lua/filetypes.lua`:
- Around line 115-120: The keymap is being created with Snacks.keymap.set using
a unsupported buf option which is ignored, causing the "q" mapping to be global;
replace the buffer-scoped call by either using Snacks.keymap.set with the ft or
lsp scoping supported by Snacks (e.g., pass ft = <filetype> to scope to that
filetype) or remove the buf option and set a true buffer-local mapping via
vim.api.nvim_buf_set_keymap / vim.keymap.set with the specific args.buf as the
target; ensure the mapped callback still calls Snacks.bufdelete.delete({ buf =
args.buf, force = true }) and that the mapping is created inside the
vim.schedule block so it binds for the intended buffer only.

In `@lua/nikero/keymaps.lua`:
- Around line 60-68: The code is reading keymap.buf which is always nil because
Neovim's keymap API uses the field name buffer; update the keymap options
assembly (where opts is built using keymap.desc, keymap.buf, etc.) to read
keymap.buffer instead of keymap.buf so buffer-local maps are preserved, keeping
the existing truthy checks (e.g., keymap.buffer == 1 and true or false) and
leaving other fields (desc, silent, expr, noremap, script) unchanged.

In `@lua/plugins/harpoon.lua`:
- Around line 67-79: The mappings for harpoon.ui:select_menu_item are being set
with vim.keymap.set using the wrong option key — change the option from { buf =
cx.bufnr } to { buffer = cx.bufnr } for both mappings so they become
buffer-local; update the two calls to vim.keymap.set that reference cx.bufnr
(the <C-v> and <C-x> mappings) to use the buffer option instead of buf.

---

Nitpick comments:
In `@lua/keymaps.lua`:
- Around line 167-172: The keymap currently calls vim.lsp.codelens.enable(true)
but the description says "LSP CodeLens refresh" and the enable call affects
global state (no bufnr) unlike the per-buffer enabling in on_attach
(lua/plugins/language/support.lua); either update the keymap description to
accurately say "LSP CodeLens enable" (or "Enable LSP CodeLens (global)") or
change the callback to perform a refresh/ per-buffer enable consistent with
on_attach (e.g., call vim.lsp.codelens.refresh() for a refresh action, or call
vim.lsp.codelens.enable({ bufnr = <buffer> }) if you can access the buffer), and
update the desc and lsp metadata accordingly to match the chosen behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 141d0b1a-8a1c-42f7-89b3-052e9c1d875e

📥 Commits

Reviewing files that changed from the base of the PR and between 4d59816 and df6e9e1.

📒 Files selected for processing (11)
  • lsp/tsgo.lua
  • lua/filetypes.lua
  • lua/keymaps.lua
  • lua/nikero/keymaps.lua
  • lua/options.lua
  • lua/plugins/git.lua
  • lua/plugins/harpoon.lua
  • lua/plugins/language/support.lua
  • lua/plugins/language/typescript.lua
  • lua/plugins/syntax.lua
  • lua/plugins/ui.lua
💤 Files with no reviewable changes (1)
  • lua/plugins/ui.lua

@nikero41
nikero41 merged commit bc22a03 into main Mar 29, 2026
3 checks passed
@nikero41
nikero41 deleted the nvim-0.12-update branch March 29, 2026 22:35
@coderabbitai coderabbitai Bot mentioned this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant