1
1
--- Tool implementation for getting diagnostics.
2
2
3
+ -- NOTE: Its important we don't tip off Claude that we're dealing with Neovim LSP diagnostics because it may adjust
4
+ -- line and col numbers by 1 on its own (since it knows nvim LSP diagnostics are 0-indexed). By calling these
5
+ -- "editor diagnostics" and converting to 1-indexed ourselves we (hopefully) avoid incorrect line and column numbers
6
+ -- in Claude's responses.
3
7
local schema = {
4
- description = " Get Neovim LSP diagnostics (errors, warnings) from open buffers " ,
8
+ description = " Get language diagnostics (errors, warnings) from the editor " ,
5
9
inputSchema = {
6
10
type = " object" ,
7
11
properties = {
@@ -28,7 +32,7 @@ local function handler(params)
28
32
error ({
29
33
code = - 32000 ,
30
34
message = " Feature unavailable" ,
31
- data = " LSP or vim.diagnostic.get not available in this Neovim version/configuration." ,
35
+ data = " Diagnostics not available in this editor version/configuration." ,
32
36
})
33
37
end
34
38
@@ -55,8 +59,8 @@ local function handler(params)
55
59
logger .debug (" File buffer must be open to get diagnostics: " .. filepath )
56
60
error ({
57
61
code = - 32001 ,
58
- message = " File not open in buffer " ,
59
- data = " File must be open in Neovim to retrieve diagnostics: " .. filepath ,
62
+ message = " File not open" ,
63
+ data = " File must be open to retrieve diagnostics: " .. filepath ,
60
64
})
61
65
else
62
66
-- Get diagnostics for the specific buffer
0 commit comments