Skip to content

Commit

Permalink
set lint diagnostic to vim.diagnostic close #10
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Jul 17, 2023
1 parent c51b772 commit d9cc11d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lua/guard/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local filetype = require('guard.filetype')
local spawn = require('guard.spawn').try_spawn
local ns = api.nvim_create_namespace('Guard')
local get_prev_lines = require('guard.util').get_prev_lines
local vd = vim.diagnostic

local function do_lint(buf)
buf = buf or api.nvim_get_current_buf()
Expand Down Expand Up @@ -31,12 +32,7 @@ local function do_lint(buf)
if not api.nvim_buf_is_valid(buf) then
return
end
for _, item in ipairs(results or {}) do
api.nvim_buf_set_extmark(buf, ns, item.lnum - 1, 0, {
virt_text = { { item.message, 'Diagnostic' .. vim.diagnostic.severity[item.severity] } },
hl_mode = 'combine',
})
end
vd.set(ns, buf, results)
end)
end))
end
Expand Down

0 comments on commit d9cc11d

Please sign in to comment.