LSP autocmds - #44
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds three new LSP server config modules (Emmet, SourceKit, TailwindCSS), centralizes LSP-related autocmds into a new Changes
Sequence DiagramsequenceDiagram
participant Buffer as Buffer Event
participant LSP as LSP Client
participant Autocmd as Autocmds.lsp_setup
participant Config as Config (hide_code_lens_ft)
participant DocColor as DocumentColorHandler
participant Inlay as InlayHintsHandler
participant CodeLens as CodeLensHandler
Buffer->>Autocmd: BufEnter / LspAttach triggers
Autocmd->>LSP: Inspect client & capabilities
Autocmd->>DocColor: Disable document color if configured
Autocmd->>Inlay: Enable inlay hints when supported
Autocmd->>CodeLens: Query Config.hide_code_lens_ft for filetype
CodeLens->>Config: Check allowlist/denylist
alt filetype denied
CodeLens->>LSP: Disable code lens for buffer
else filetype allowed
CodeLens->>LSP: Enable code lens for buffer
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lua/plugins/quickfix.lua (1)
99-108:⚠️ Potential issue | 🔴 CriticalBug:
ipairsdoes not iterate over neotest's string-keyed results.In neotest,
resultsis a dictionary keyed by position ID strings (e.g.,"/path/to/test.lua::test_name"). Usingipairs(results)on a string-keyed table yields nothing—the filter never runs,should_closeis alwaystrue, and Trouble closes after every test run regardless of failures.Use
vim.iter(results)to iterate over the dictionary:🐛 Proposed fix
local should_close = vim.tbl_count( vim - .iter(ipairs(results)) + .iter(results) :filter( function(pos_id, result) return result.status ~= "failed" and tree:get_key(pos_id) end ) :totable() ) == 0🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lua/plugins/quickfix.lua` around lines 99 - 108, The closure-detection logic uses ipairs on neotest's results (string-keyed table) so the filter never runs; update the iterator to vim.iter(results) instead of vim.iter(ipairs(results)) inside the should_close calculation so the filter receives position IDs and result tables correctly (referencing the local should_close, the results variable, and the tree:get_key(pos_id) callback).
🧹 Nitpick comments (1)
lua/nikero/config.lua (1)
4-4: Consider adding type annotation for the new field.The
hide_code_lens_ftfield would benefit from a type annotation in the@classdefinition for better IDE support and documentation.---@class Config +---@field hide_code_lens_ft string[] Filetypes where code lens should be disabled local Config = { transparency = false, hide_code_lens_ft = { "lua" }, }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lua/nikero/config.lua` at line 4, Add a type annotation for the new hide_code_lens_ft field in the module's `@class/`@field docs so editors can infer its type; update the existing class comment (e.g., the NikeroConfig `@class`) to include a line like "@field hide_code_lens_ft string[] — list of filetype names to hide code lenses for" so the hide_code_lens_ft symbol is documented as an array of strings.
🤖 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/plugins/quickfix.lua`:
- Around line 99-108: The closure-detection logic uses ipairs on neotest's
results (string-keyed table) so the filter never runs; update the iterator to
vim.iter(results) instead of vim.iter(ipairs(results)) inside the should_close
calculation so the filter receives position IDs and result tables correctly
(referencing the local should_close, the results variable, and the
tree:get_key(pos_id) callback).
---
Nitpick comments:
In `@lua/nikero/config.lua`:
- Line 4: Add a type annotation for the new hide_code_lens_ft field in the
module's `@class/`@field docs so editors can infer its type; update the existing
class comment (e.g., the NikeroConfig `@class`) to include a line like "@field
hide_code_lens_ft string[] — list of filetype names to hide code lenses for" so
the hide_code_lens_ft symbol is documented as an array of strings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f6b40871-aa48-47f9-9979-fd566727ae7d
📒 Files selected for processing (18)
after/lsp/basedpyright.luaafter/lsp/bashls.luaafter/lsp/clangd.luaafter/lsp/cssls.luaafter/lsp/emmet_language_server.luaafter/lsp/gopls.luaafter/lsp/html.luaafter/lsp/jsonls.luaafter/lsp/lua_ls.luaafter/lsp/omnisharp.luaafter/lsp/sourcekit.luaafter/lsp/tailwindcss.luaafter/lsp/tsgo.luaafter/lsp/yamlls.lualua/autocmds.lualua/nikero/config.lualua/plugins/language/support.lualua/plugins/quickfix.lua
This pull request introduces improvements to Neovim's LSP (Language Server Protocol) and autocmd (autocommand) integration, adds configuration for several language servers, and refactors some utility functions for better code clarity and maintainability. The changes enhance LSP feature handling, streamline keymap processing, and update plugin and option setups.
LSP and Autocmd Enhancements:
lsp_setupmethod inAutocmdsto modularize and improve the setup of LSP-related autocommands, including folding, document colors, inlay hints, and code lens, and invoked it from the main setup function. [1] [2]Autocmds:setupto use iterator-based processing for better readability and efficiency.Language Server Configurations:
emmet_language_server,sourcekit, andtailwindcssto enable language-specific features and settings. [1] [2] [3]hide_code_lens_ftoption to the main config to allow disabling code lens for specific filetypes (e.g., Lua).Utility and Plugin Improvements:
keymaps.luafor clearer naming and usage, replacingfrom_nvim_keymapwithto_keymapand updating all references. [1] [2] [3]Other Notable Changes:
tohtmlplugin from the list of disabled built-in plugins in the main setup.