@@ -32,24 +32,17 @@ local function handler(params)
32
32
})
33
33
end
34
34
35
- local log_module_ok , log = pcall (require , " claudecode.logger" )
36
- if not log_module_ok then
37
- return {
38
- code = - 32603 , -- Internal error
39
- message = " Internal error" ,
40
- data = " Failed to load logger module" ,
41
- }
42
- end
35
+ local logger = require (" claudecode.logger" )
43
36
44
- log .debug (" getDiagnostics handler called with params: " .. vim .inspect (params ))
37
+ logger .debug (" getDiagnostics handler called with params: " .. vim .inspect (params ))
45
38
46
39
-- Extract the uri parameter
47
40
local diagnostics
48
41
49
42
if not params .uri then
50
43
-- Get diagnostics for all buffers
51
- log .debug (" Getting diagnostics for all open buffers" )
52
44
diagnostics = vim .diagnostic .get ()
45
+ logger .debug (" Getting diagnostics for all open buffers" )
53
46
else
54
47
-- Remove file:// prefix if present
55
48
local uri = params .uri
@@ -62,15 +55,15 @@ local function handler(params)
62
55
local bufnr = vim .fn .bufnr (filepath )
63
56
if bufnr == - 1 then
64
57
-- File is not open in any buffer, throw an error
65
- log .debug (" File buffer must be open to get diagnostics: " .. filepath )
58
+ logger .debug (" File buffer must be open to get diagnostics: " .. filepath )
66
59
error ({
67
60
code = - 32001 ,
68
61
message = " File not open in buffer" ,
69
62
data = " File must be open in Neovim to retrieve diagnostics: " .. filepath ,
70
63
})
71
64
else
72
65
-- Get diagnostics for the specific buffer
73
- log .debug (" Getting diagnostics for bufnr: " .. bufnr )
66
+ logger .debug (" Getting diagnostics for bufnr: " .. bufnr )
74
67
diagnostics = vim .diagnostic .get (bufnr )
75
68
end
76
69
end
0 commit comments