Skip to content

add callbacks on start/stop request#214

Merged
teto merged 2 commits intorest-nvim:mainfrom
teto:callbacks
Jul 11, 2023
Merged

add callbacks on start/stop request#214
teto merged 2 commits intorest-nvim:mainfrom
teto:callbacks

Conversation

@teto
Copy link
Copy Markdown
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
Copy Markdown
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