Neovim plugin for codanna semantic code search. Supports Telescope, mini.pick, and snacks.nvim pickers.
- codanna CLI
- Neovim 0.10+
- One of: snacks.nvim, telescope.nvim, or mini.pick
{
"kyleking/codanna.nvim",
dependencies = {
-- Use one of:
"folke/snacks.nvim",
-- "nvim-telescope/telescope.nvim",
-- "echasnovski/mini.pick",
},
opts = {
preferred_picker = "snacks", -- "snacks", "telescope", or "mini"
},
keys = {
{ "<leader>cs", "<cmd>CodannaSearch<cr>", desc = "Semantic Search" },
{ "<leader>cy", "<cmd>CodannaSymbols<cr>", desc = "Symbols" },
{ "<leader>cc", "<cmd>CodannaCallers<cr>", desc = "Find Callers" },
{ "<leader>cC", "<cmd>CodannaCalls<cr>", desc = "Get Calls" },
{ "<leader>ci", "<cmd>CodannaImpact<cr>", desc = "Analyze Impact" },
{ "<leader>cd", "<cmd>CodannaDocuments<cr>", desc = "Documents" },
},
}require("codanna").setup({
codanna_path = "codanna", -- Path to codanna binary
timeout_ms = 10000, -- Command timeout
cache_ttl_ms = 5000, -- Cache TTL for results
preferred_picker = nil, -- nil = auto-detect, or "snacks"/"telescope"/"mini"
})| Command | Description |
|---|---|
:CodannaSearch [query] |
Semantic code search |
:CodannaSymbols [query] |
Search indexed symbols |
:CodannaCallers [symbol] |
Find callers (uses word under cursor if no argument) |
:CodannaCalls [symbol] |
Get outgoing calls from symbol |
:CodannaImpact [symbol] |
Analyze impact of changes to symbol |
:CodannaDocuments [query] |
Search documentation |
Before using, index your project with codanna:
cd /path/to/your/project
codanna init
codanna index .Supported languages: Rust, Python, JS, TS, Go, Java, C, C++, C#, Swift, Kotlin, PHP, GDScript
mise run test # Run unit tests
mise run test-integration # Run integration tests (requires codanna CLI)
mise run setup-test-repos # Setup test repositories for integration tests
mise run test-telescope # Test with Telescope
mise run test-mini # Test with mini.pick
mise run test-snacks # Test with snacks.nvim
# Or test with your own project:
mise run test-telescope PROJECT=/path/to/your/projectSee DEVELOPMENT.md for detailed development guide.
Cause: The codanna CLI tool is not installed or not in PATH.
Solution:
- Install codanna: https://github.com/bartolli/codanna
- Ensure it's in your PATH:
which codanna - Or specify full path in setup:
require("codanna").setup({ codanna_path = "/full/path/to/codanna", })
Cause: Project hasn't been indexed, or index is out of date.
Solution:
cd /path/to/your/project
codanna init # Initialize codanna in this project
codanna index . # Index all files in current directoryRe-run search after indexing.
Cause: None of the supported picker plugins are installed.
Solution: Install at least one of:
- snacks.nvim:
{ "folke/snacks.nvim" } - telescope.nvim:
{ "nvim-telescope/telescope.nvim" } - mini.pick:
{ "echasnovski/mini.nvim" }
Possible causes:
- Query too short: Minimum 3 characters required for live search
- Language not supported: Check if your file types are supported (Rust, Python, JS, TS, Go, Java, C, C++, C#, Swift, Kotlin, PHP, GDScript)
- Files excluded: Check
.codannaignore- might be excluding your files - Stale index: Re-run
codanna index .to update
Solutions:
-
Increase cache TTL to reduce repeated queries:
require("codanna").setup({ cache_ttl_ms = 10000, -- Cache results for 10 seconds })
-
Adjust debounce for live search:
require("codanna.telescope").config.debounce_ms = 300
-
Limit result count:
require("codanna").semantic_search({ limit = 20 })
Cause: Codanna output format changed or contains unexpected data.
Solution:
- Check codanna version:
codanna --version - Try running codanna directly:
codanna mcp semantic_search_with_context "query:test" --json - Check for errors in
:messages - File an issue with the error details
Cause: Cursor is not on a valid symbol.
Solution:
- Ensure cursor is on a word (function name, class, etc.)
- Or provide symbol explicitly:
:CodannaCallers my_function_name
Cause: Plugin not loaded or commands not registered.
Solution:
- Check if plugin loaded:
:lua =require("codanna") - Verify commands exist:
:command Codanna - Try
:checkhealthto diagnose issues - Ensure plugin directory is in runtimepath
Solution: Clear the cache manually:
:lua require("codanna.core").clear_cache()
:lua require("codanna.core").invalidate_index_cache()Or restart Neovim.
Contributions welcome! See DEVELOPMENT.md for development setup and guidelines.
MIT