Skip to content

Commit

Permalink
fix: make sure line is always a string passed to get_line_col
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 31, 2024
1 parent bda8de4 commit 5a12185
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/trouble/sources/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ function M.locations_to_items(client, locs)
local lines = Util.get_lines({ rows = vim.tbl_keys(t.rows), buf = buf }) or {}
for _, loc in ipairs(t.locs) do
local range = loc.range or loc.targetSelectionRange
local line = lines[range.start.line + 1]
local end_line = lines[range["end"].line + 1]
local line = lines[range.start.line + 1] or ""
local end_line = lines[range["end"].line + 1] or ""
local pos = { range.start.line + 1, get_line_col(line, range.start.character, client.offset_encoding) }
local end_pos = { range["end"].line + 1, get_line_col(end_line, range["end"].character, client.offset_encoding) }
ret[#ret + 1] = Item.new({
Expand Down

0 comments on commit 5a12185

Please sign in to comment.