Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

add callbacks on start/stop request #214

Merged
merged 2 commits into from
Jul 11, 2023
Merged

add callbacks on start/stop request #214

merged 2 commits into from
Jul 11, 2023

Conversation

teto
Copy link
Collaborator

@teto teto commented Jul 11, 2023

This is a quick & dirty implementation of #214, e.g., rest-nvim throws events when

  • launching a request
  • finishing a request

This is what I intented to test it with

local start_time = 0

local on_start_request =  function (req)
  -- vim.loop.gettimeofday()
  -- vim.fn.reltime()
 start_time = vim.loop.now()
 print("starting request")
end

local on_stop_request =  function  (...)
 print("finished request")
 -- TODO displayu time taken
end

vim.api.nvim_create_autocmd("User", {
pattern = "RestStartRequest",
once = true,
  callback = function()
    print("IT STARTED")
  end,
})

teto added 2 commits July 11, 2023 17:32
add events upon request start/stop so that users can customize rest.nvim
without modifying the plugin too much.
@teto teto changed the title WIP: add callbacks add callbacks on start/stop request Jul 11, 2023
@teto
Copy link
Collaborator Author

teto commented Jul 11, 2023

this might not be perfect but there is another PR I wanna submit and I got limited time. I tested this quickly and it looked ok, we can fix it later if we wanna pass more information in callbacks

@teto teto merged commit c349020 into rest-nvim:main Jul 11, 2023
2 checks passed
@teto teto deleted the callbacks branch July 11, 2023 18:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant