Skip to content

Commit

Permalink
fix: use math.huge instead of div by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Jan 11, 2024
1 parent 6e4f775 commit eac4855
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/null-ls/helpers/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ local make_diagnostic = function(entries, defaults, attr_adapters, params, offse
-- we need to convert the column number to a byte index.
-- See: https://github.com/nvimtools/none-ls.nvim/issues/19#issuecomment-1820127436
if entries["col"] ~= nil and content_line ~= nil then
local col = tonumber(entries["col"]) or (1 / 0)
local col = tonumber(entries["col"]) or math.huge
col = math.min(col, string.len(content_line))
local byte_index_col = vim.str_byteindex(content_line, col)
entries["col"] = tostring(byte_index_col)
Expand Down

0 comments on commit eac4855

Please sign in to comment.