Line data Source code
1 : -- lua/yoda/commands/diagnostics.lua
2 : -- Diagnostic and troubleshooting commands
3 :
4 1 : local M = {}
5 :
6 1 : function M.setup()
7 : -- Run all Yoda diagnostics
8 22 : vim.api.nvim_create_user_command("YodaDiagnostics", function()
9 2 : require("yoda-diagnostics").run_all()
10 13 : end, { desc = "Run Yoda.nvim diagnostics to check LSP and AI integration" })
11 :
12 : -- AI configuration check
13 22 : vim.api.nvim_create_user_command("YodaAICheck", function()
14 1 : require("yoda-diagnostics.ai").display_detailed_check()
15 12 : end, { desc = "Check AI API configuration and diagnose issues" })
16 :
17 : -- Completion engine status
18 22 : vim.api.nvim_create_user_command("YodaCmpStatus", function()
19 : local logger = require("yoda-logging.logger")
20 : logger.set_strategy("console")
21 : logger.set_level("info")
22 :
23 : logger.info("🔍 Checking completion engine status...")
24 :
25 : -- Check if blink.cmp is loaded (replaces nvim-cmp in this distro)
26 : local blink_ok, _ = pcall(require, "blink.cmp")
27 : if blink_ok then
28 : logger.info("✅ blink.cmp loaded successfully")
29 : else
30 : logger.error("❌ blink.cmp failed to load")
31 : end
32 :
33 : -- Check LSP clients for completion capability
34 : local clients = vim.lsp.get_clients()
35 : logger.info("🔌 LSP clients with completion capability:")
36 : for _, client in ipairs(clients) do
37 : if client.server_capabilities.completionProvider then
38 : logger.info(" ✅ " .. client.name)
39 : else
40 : logger.info(" ❌ " .. client.name .. " (no completion)")
41 : end
42 : end
43 11 : end, { desc = "Check completion engine status" })
44 12 : end
45 :
46 1 : return M
|