Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Commit

Permalink
diagnostics: convert columns to bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
name-snrl committed Jun 3, 2023
1 parent 77e53bc commit fc97e7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/null-ls/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ local handle_multiple_file_diagnostics = function(namespace, diagnostics)
end

local handle_diagnostics = function(id, diagnostics, bufnr, multiple_files)
for _, diagnostic in ipairs(diagnostics) do
local start_line = vim.api.nvim_buf_get_lines(bufnr, diagnostic.lnum, diagnostic.lnum + 1, false)[1]
local end_line = vim.api.nvim_buf_get_lines(bufnr, diagnostic.end_lnum, diagnostic.end_lnum + 1, false)[1]
diagnostic.col = vim.str_byteindex(start_line, diagnostic.col)
diagnostic.end_col = vim.str_byteindex(end_line, diagnostic.end_col)
end
local namespace = get_namespace(id)
if multiple_files then
handle_multiple_file_diagnostics(namespace, diagnostics)
Expand Down

0 comments on commit fc97e7d

Please sign in to comment.