jellydn / hurl.nvim

Hurl.nvim is a Neovim plugin designed to run HTTP requests directly from `.hurl` files. Elevate your API development workflow by executing and viewing responses without leaving your editor.
https://gyazo.com/19492e8b5366cec3f22d5fd97a63f37a
MIT License
148 stars 15 forks source link

Getting errors while running in simple hurl file with :HurlVerbose #89

Closed TimPelgrim closed 6 months ago

TimPelgrim commented 6 months ago

Details

Have tried with multiple files, each resulting in the following error:

Error executing Lua callback: ...lgrim/.local/share/nvim/lazy/hurl.nvim/lua/hurl/main.lua:419: attempt to concatenate field 'start_line' (a nil value)
stack traceback:
    ...lgrim/.local/share/nvim/lazy/hurl.nvim/lua/hurl/main.lua:419: in function <...lgrim/.local/share/nvim/lazy/hurl.nvim/lua/hurl/main.lua:390>

I installed with the basic config using LazyVim, specificly this lua file:


return {
  "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" },
  },
}```

<details open>
<summary>Checklist</summary>

- [X] Modify `lua/hurl/main.lua` ✓ https://github.com/jellydn/hurl.nvim/commit/fed85aa9c948dbff083e30212f8b568f03daa58f [Edit](https://github.com/jellydn/hurl.nvim/edit/sweep/getting_errors_while_running_in_simple_h/lua/hurl/main.lua#L419-L420)
- [ ] Running GitHub Actions for `lua/hurl/main.lua` ⋯  [Edit](https://github.com/jellydn/hurl.nvim/edit/sweep/getting_errors_while_running_in_simple_h/lua/hurl/main.lua#L419-L420)
</details>
sweep-ai[bot] commented 6 months ago

🚀 Here's the PR! #90

See 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 e3c0fb4
Checking lua/hurl/main.lua for syntax errors... ✅ lua/hurl/main.lua has no syntax errors! 1/1 ✓
Checking lua/hurl/main.lua for syntax errors...
✅ lua/hurl/main.lua has no syntax errors!

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/jellydn/hurl.nvim/blob/e3c0fb4ed2a0dcda7508cb22a74aa2fa8d91f5eb/doc/hurl.nvim.txt#L21-L68 https://github.com/jellydn/hurl.nvim/blob/e3c0fb4ed2a0dcda7508cb22a74aa2fa8d91f5eb/lua/hurl/main.lua#L388-L421

Step 2: ⌨️ Coding

--- 
+++ 
@@ -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 })

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.

jellydn commented 6 months ago

Hi @TimPelgrim Thank you for your report. Could you check again with latest version? It should work now.