Skip to content
New issue

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

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

Already on GitHub? # to your account

Bug: formatter errors are not handled correctly #215

Closed
mariemachtmiau opened this issue Dec 6, 2024 · 6 comments · Fixed by #217
Closed

Bug: formatter errors are not handled correctly #215

mariemachtmiau opened this issue Dec 6, 2024 · 6 comments · Fixed by #217
Labels
question Further information is requested

Comments

@mariemachtmiau
Copy link

Details

When running HurlRunner the split opens but nothing happens. Debugged it and found it was getting stuck here

local stdout = vim.fn.systemlist(formatters[type], body)

It tries to format html, even when setting formatters = {}, in setup. Also doesn't seem to handle prettier not existing right, it just gets stuck (even with debug the last log is the one from L119.
It works when I change the html formatter to { "cat" }, but that's permanent, I'd like it to dynamically format if the executable exists and just ignore it if not (basically exactly what the code should already be doing).

When running the commands manually vim.v.shell_error ~= 0 is true, so it should normally work.

NVIM v0.10.2
Copy link
Contributor

sweep-ai bot commented Dec 6, 2024

❌ The ticket to PR workflow is no longer supported. We have moved to a new chat interface in private beta. Please contact us at team@sweep.dev to try it out.

📖 For more information on how to use Sweep, please read our documentation.

Tracking ID: 892484dfae

@mariemachtmiau mariemachtmiau changed the title Sweep: formatter errors are not handled correctly Bug: formatter errors are not handled correctly Dec 6, 2024
@jellydn
Copy link
Owner

jellydn commented Dec 6, 2024

Could you share your config? @mariemachtmiau Also run :checkhealth hurl and share the output with me. For example, here is my output.


==============================================================================
hurl:                                           require("hurl.health").check()

hurl.nvim health check ~
- OK jq found
- OK prettier found
- OK treesitter[hurl]: installed
- OK hurl version > 4.3.0 found
- OK hurl.nvim: All good!

@jellydn jellydn added question Further information is requested and removed sweep labels Dec 6, 2024
@mariemachtmiau
Copy link
Author

My config is basically just

    require("hurl").setup({
      fixture_vars = {},
      formatters = {
        -- NOTE: for now use cat as error handling is broken when formatter is not found
        html = { "cat" },
      },
    })

(also had debug and notifications turned on before when debugging). I use Nixvim to configure my Neovim and used the tag v2.0.0 to build the plugin.

Checkhealth:

hurl: require("hurl.health").check()

hurl.nvim health check ~
- OK jq found
- ERROR prettier not found
- OK treesitter[hurl]: installed
- OK hurl version > 4.3.0 found
- OK hurl.nvim: All good!

@mariemachtmiau
Copy link
Author

Logs:

hurl: running current file
hurl: running request
hurl: looking for { "vars.env" } in [...]
hurl: looking for { "vars.env" } in /tmp/vars.env
hurl: running command: hurl /tmp/test.hurl --verbose
hurl: request finished
formatting body with html

Everything works completely fine with HurlVerbose and HurlVeryVerbose btw, also json (cuz it skips formatting there).

@jellydn jellydn closed this as completed in 53fb537 Dec 7, 2024
@jellydn
Copy link
Owner

jellydn commented Dec 7, 2024

Thanks @mariemachtmiau It should be okay now.

@mariemachtmiau
Copy link
Author

Thanks for the quick fix @jellydn :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants