Skip to content

Commit

Permalink
fix: diagnostic float would not open if scope=cursor (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jan 14, 2024
1 parent c4cc824 commit a1af7a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/oil/mutator/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ M.try_write_changes = function(confirm, cb)
local was_modified = vim.bo.modified
local buffers = view.get_all_buffers()
local all_diffs = {}
---@type table<integer, oil.ParseError[]>
local all_errors = {}

mutation_in_progress = true
Expand Down
5 changes: 4 additions & 1 deletion lua/oil/mutator/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ M.parse = function(bufnr)
name = name:lower()
end
if seen_names[name] then
table.insert(errors, { message = "Duplicate filename", lnum = i - 1, col = 0 })
table.insert(errors, { message = "Duplicate filename", lnum = i - 1, end_lnum = i, col = 0 })
else
seen_names[name] = true
end
Expand All @@ -200,6 +200,7 @@ M.parse = function(bufnr)
table.insert(errors, {
message = err,
lnum = i - 1,
end_lnum = i,
col = 0,
})
goto continue
Expand All @@ -221,6 +222,7 @@ M.parse = function(bufnr)
table.insert(errors, {
message = message,
lnum = i - 1,
end_lnum = i,
col = 0,
})
goto continue
Expand Down Expand Up @@ -273,6 +275,7 @@ M.parse = function(bufnr)
table.insert(errors, {
message = "Paths cannot start with '/'",
lnum = i - 1,
end_lnum = i,
col = 0,
})
goto continue
Expand Down
4 changes: 4 additions & 0 deletions tests/parser_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ describe("parser", function()
{
message = "Malformed ID at start of line",
lnum = 0,
end_lnum = 1,
col = 0,
},
}, errors)
Expand All @@ -126,6 +127,7 @@ describe("parser", function()
{
message = "No filename found",
lnum = 0,
end_lnum = 1,
col = 0,
},
}, errors)
Expand All @@ -143,6 +145,7 @@ describe("parser", function()
{
message = "Duplicate filename",
lnum = 1,
end_lnum = 2,
col = 0,
},
}, errors)
Expand All @@ -161,6 +164,7 @@ describe("parser", function()
{
message = "Duplicate filename",
lnum = 1,
end_lnum = 2,
col = 0,
},
}, errors)
Expand Down

0 comments on commit a1af7a1

Please sign in to comment.