Skip to content

add callbacks on start/stop request #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
@teto teto deleted the callbacks branch July 11, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant