Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoshihou514 committed Aug 8, 2024
1 parent a3edac0 commit c122927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lua/guard/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function M.from_json(opts)
opts.severities[attr_value(mes, attr.severity)],
opts.source,
tonumber(attr_value(mes, attr.lnum_end or attr.lnum)) - opts.offset,
tonumber(attr_value(mes, attr.col_end or attr.lnum)) - opts.offset,
tonumber(attr_value(mes, attr.col_end or attr.lnum)) - opts.offset
)
end, offences or {})

Expand Down
7 changes: 3 additions & 4 deletions test/command_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local api = vim.api
local same = assert.are.same

describe('commands', function()

require('guard.filetype')('lua'):fmt({
cmd = 'stylua',
args = { '-' },
Expand Down Expand Up @@ -45,20 +44,20 @@ describe('commands', function()
same(api.nvim_buf_get_lines(bufnr, 0, -1, false), { 'local a = 42' })

-- disable
vim.cmd("GuardDisable")
vim.cmd('GuardDisable')
api.nvim_buf_set_lines(bufnr, 0, -1, false, {
'local a',
' =42',
})
vim.cmd("silent! write")
vim.cmd('silent! write')
vim.wait(500)
same(api.nvim_buf_get_lines(bufnr, 0, -1, false), {
'local a',
' =42',
})

-- enable
vim.cmd("GuardEnable")
vim.cmd('GuardEnable')
-- make changes to trigger format
api.nvim_buf_set_lines(bufnr, 0, -1, false, {
'local a',
Expand Down

0 comments on commit c122927

Please sign in to comment.