@@ -73,7 +73,7 @@ describe("Tool: get_diagnostics", function()
73
73
74
74
it (" should return formatted diagnostics if available" , function ()
75
75
local mock_diagnostics = {
76
- { bufnr = 1 , lnum = 10 , col = 5 , severity = 1 , message = " Error message 1" , source = " linter1" },
76
+ { bufnr = 1 , lnum = 10 , col = 5 , severity = 1 , message = " Error message 1" , source = " linter1" },
77
77
{ bufnr = 2 , lnum = 20 , col = 15 , severity = 2 , message = " Warning message 2" , source = " linter2" },
78
78
}
79
79
_G .vim .diagnostic .get = spy .new (function ()
@@ -95,7 +95,7 @@ describe("Tool: get_diagnostics", function()
95
95
-- Check the first diagnostic was encoded with 1-indexed values
96
96
local first_call_args = _G .vim .json .encode .calls [1 ].vals [1 ]
97
97
expect (first_call_args .filePath ).to_be (" /path/to/file_for_buf_1.lua" )
98
- expect (first_call_args .line ).to_be (11 ) -- 10 + 1 for 1-indexing
98
+ expect (first_call_args .line ).to_be (11 ) -- 10 + 1 for 1-indexing
99
99
expect (first_call_args .character ).to_be (6 ) -- 5 + 1 for 1-indexing
100
100
expect (first_call_args .severity ).to_be (1 )
101
101
expect (first_call_args .message ).to_be (" Error message 1" )
@@ -107,7 +107,7 @@ describe("Tool: get_diagnostics", function()
107
107
108
108
it (" should filter out diagnostics with no file path" , function ()
109
109
local mock_diagnostics = {
110
- { bufnr = 1 , lnum = 10 , col = 5 , severity = 1 , message = " Error message 1" , source = " linter1" },
110
+ { bufnr = 1 , lnum = 10 , col = 5 , severity = 1 , message = " Error message 1" , source = " linter1" },
111
111
{ bufnr = 99 , lnum = 20 , col = 15 , severity = 2 , message = " Warning message 2" , source = " linter2" }, -- This one will have no path
112
112
}
113
113
_G .vim .diagnostic .get = spy .new (function ()
@@ -140,7 +140,7 @@ describe("Tool: get_diagnostics", function()
140
140
expect (err ).to_be_table ()
141
141
expect (err .code ).to_be (- 32000 )
142
142
assert_contains (err .message , " Feature unavailable" )
143
- assert_contains (err .data , " LSP or vim.diagnostic.get not available" )
143
+ assert_contains (err .data , " Diagnostics not available in this editor version/configuration. " )
144
144
end )
145
145
146
146
it (" should error if vim.diagnostic is not available" , function ()
@@ -199,8 +199,8 @@ describe("Tool: get_diagnostics", function()
199
199
expect (success ).to_be_false ()
200
200
expect (err ).to_be_table ()
201
201
expect (err .code ).to_be (- 32001 )
202
- expect (err .message ).to_be (" File not open in buffer " )
203
- assert_contains (err .data , " File must be open in Neovim to retrieve diagnostics: /unknown/file.lua" )
202
+ expect (err .message ).to_be (" File not open" )
203
+ assert_contains (err .data , " File must be open to retrieve diagnostics: /unknown/file.lua" )
204
204
205
205
-- Should have used vim.uri_to_fname and checked for buffer but not called vim.diagnostic.get
206
206
assert .spy (_G .vim .uri_to_fname ).was_called_with (" file:///unknown/file.lua" )
0 commit comments