-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Getting errors while running in simple hurl file with :HurlVerbose #89
Comments
🚀 Here's the PR! #90See Sweep's progress at the progress dashboard! ⚡ Sweep Basic Tier: I'm using GPT-4. You have 5 GPT-4 tickets left for the month and 3 for the day. (tracking ID:
a1a2415165 )For more GPT-4 tickets, visit our payment portal. For a one week free trial, try Sweep Pro (unlimited GPT-4 tickets). Tip I can email you next time I complete a pull request if you set up your email here! Actions (click)
GitHub Actions✓Here are the GitHub Actions logs prior to making any changes: Sandbox logs for
|
FEATURES *hurl.nvim-features* | |
- 🚀 Execute HTTP requests directly from `.hurl` files. | |
- 👁🗨 Multiple display modes for API response: popup or split. | |
- 🌈 Highly customizable through settings. | |
USAGE *hurl.nvim-usage* | |
Add the following configuration to your Neovim setup with lazy.nvim | |
<https://github.com/folke/lazy.nvim>: | |
>lua | |
{ | |
"jellydn/hurl.nvim", | |
dependencies = { "MunifTanjim/nui.nvim" }, | |
ft = "hurl", | |
opts = { | |
-- Show debugging info | |
debug = false, | |
-- Show notification on run | |
show_notification = false, | |
-- Show response in popup or split | |
mode = "split", | |
-- Default formatter | |
formatters = { | |
json = { 'jq' }, -- Make sure you have install jq in your system, e.g: brew install jq | |
html = { | |
'prettier', -- Make sure you have install prettier in your system, e.g: npm install -g prettier | |
'--parser', | |
'html', | |
}, | |
}, | |
}, | |
keys = { | |
-- Run API request | |
{ "<leader>A", "<cmd>HurlRunner<CR>", desc = "Run All requests" }, | |
{ "<leader>a", "<cmd>HurlRunnerAt<CR>", desc = "Run Api request" }, | |
{ "<leader>te", "<cmd>HurlRunnerToEntry<CR>", desc = "Run Api request to entry" }, | |
{ "<leader>tm", "<cmd>HurlToggleMode<CR>", desc = "Hurl Toggle Mode" }, | |
{ "<leader>tv", "<cmd>HurlVerbose<CR>", desc = "Run Api in verbose mode" }, | |
-- Run Hurl request in visual mode | |
{ "<leader>h", ":HurlRunner<CR>", desc = "Hurl Runner", mode = "v" }, | |
}, | |
} | |
< | |
Lines 388 to 421 in e3c0fb4
-- Run Hurl in verbose mode and send output to quickfix | |
utils.create_cmd('HurlVerbose', function(opts) | |
-- It should be the same logic with run at current line but with verbose flag | |
-- The response will be sent to quickfix | |
local result = http.find_http_verb_positions_in_buffer() | |
if result.current > 0 and result.start_line and result.end_line then | |
utils.log_info( | |
'hurl: running request at line ' .. result.start_line .. ' to ' .. result.end_line | |
) | |
opts.fargs = opts.fargs or {} | |
opts.fargs = vim.list_extend(opts.fargs, { '--verbose' }) | |
-- Clear quickfix list | |
vim.fn.setqflist({}, 'r', { | |
title = 'hurl', | |
lines = {}, | |
}) | |
run_at_lines(result.start_line, result.end_line, opts.fargs, function(code, data, event) | |
utils.log_info('hurl: verbose callback ' .. vim.inspect(code) .. vim.inspect(data)) | |
vim.fn.setqflist({}, 'a', { | |
title = 'hurl - data', | |
lines = data, | |
}) | |
vim.fn.setqflist({}, 'a', { | |
title = 'hurl - event', | |
lines = event, | |
}) | |
vim.cmd('copen') | |
end) | |
else | |
utils.log_info('hurl: not HTTP method found in the current line' .. result.start_line) | |
utils.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO) | |
end |
Step 2: ⌨️ Coding
Modify lua/hurl/main.lua with contents:
• To prevent the attempt to concatenate a nil value and to handle the error more gracefully, change the log and notification lines to check if `result.start_line` is nil before using it. If `result.start_line` is nil, provide a generic message that does not attempt to use it.
• Replace the existing lines 419 and 420 with the following code snippet: ```lua if result.start_line then utils.log_info('hurl: not HTTP method found in the current line ' .. result.start_line) else utils.log_info('hurl: no HTTP method found in the current line') end utils.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO) ```
• This change ensures that if `result.start_line` is nil, the code does not attempt to concatenate it, thus avoiding the error. It also provides a clear notification to the user that no HTTP method was found in the current line, regardless of whether `result.start_line` is nil.--- +++ @@ -353,7 +353,11 @@ ) run_at_lines(result.start_line, result.end_line, opts.fargs) else - utils.log_info('hurl: not HTTP method found in the current line' .. result.start_line) + if result.start_line then + utils.log_info('hurl: not HTTP method found in the current line ' .. result.start_line) + else + utils.log_info('hurl: no HTTP method found in the current line') + end utils.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO) end end, { nargs = '*', range = true }) @@ -416,7 +420,11 @@ vim.cmd('copen') end) else - utils.log_info('hurl: not HTTP method found in the current line' .. result.start_line) + if result.start_line then + utils.log_info('hurl: not HTTP method found in the current line ' .. result.start_line) + else + utils.log_info('hurl: no HTTP method found in the current line') + end utils.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO) end end, { nargs = '*', range = true })
- Running GitHub Actions for
lua/hurl/main.lua
⋯ Edit
Check lua/hurl/main.lua with contents:Ran GitHub Actions for fed85aa9c948dbff083e30212f8b568f03daa58f:
• pandoc to vimdoc: ⋯
Step 3: 🔁 Code Review
I have finished reviewing the code for completeness. I did not find errors for sweep/getting_errors_while_running_in_simple_h
.
🎉 Latest improvements to Sweep:
- New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
- Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
- Use the GitHub issues extension for creating Sweep issues directly from your editor.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Hi @TimPelgrim Thank you for your report. Could you check again with latest version? It should work now. |
Details
Have tried with multiple files, each resulting in the following error:
I installed with the basic config using LazyVim, specificly this lua file:
The text was updated successfully, but these errors were encountered: