Skip to content

Commit

Permalink
feat: show response time on virtual text
Browse files Browse the repository at this point in the history
Closed #153
  • Loading branch information
jellydn committed Jul 31, 2024
1 parent 9cd1fd0 commit 043a7de
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/hurl/popup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ M.show = function(data, type)
end
end

-- Add response time as virtual text
vim.api.nvim_buf_set_extmark(
popups.top.bufnr,
vim.api.nvim_create_namespace('response_time_ns'),
0,
0,
{
end_line = 1,
id = 1,
virt_text = { { 'Response: ' .. data.response_time .. ' ms', 'Comment' } },
virt_text_pos = 'eol',
}
)

local content = utils.format(data.body, type)
if not content then
utils.log_info('No content')
Expand Down
14 changes: 14 additions & 0 deletions lua/hurl/split.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ M.show = function(data, type)
end
end

-- Add response time as virtual text
vim.api.nvim_buf_set_extmark(
split.bufnr,
vim.api.nvim_create_namespace('response_time_ns'),
0,
0,
{
end_line = 1,
id = 1,
virt_text = { { 'Response: ' .. data.response_time .. ' ms', 'Comment' } },
virt_text_pos = 'eol',
}
)

local content = utils.format(data.body, type)
if not content then
utils.log_info('No content')
Expand Down

0 comments on commit 043a7de

Please sign in to comment.