ray-x / web-tools.nvim

Neovim plugin for web developers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hurl - Support header along with formatter

jellydn opened this issue · comments

What

The formatter won't work if enable the header on the body.

return {
  {
    "ray-x/web-tools.nvim",
    ft = "hurl",
    cmd = { "HurlRun", "TagRename" },
    dependencies = {
      { "ray-x/guihua.lua", build = "cd lua/fzy && make", opts = { maps = {
        close_view = "q",
      } } },
    },
    opts = {
      -- debug = true,
      hurl = {
        floating = true,
        show_headers = false, -- NOTE: Formatter does not work with well with headers
        formatters = { -- format the result by file type
          json = { "jq" },
          html = { "prettier", "--parser", "html" },
        },
      },
    },
    keys = {
      { "<leader>cRa", "<cmd>HurlRun<CR>", desc = "Run API requests" },
      { "<leader>cRt", "<cmd>TagRename<CR>", desc = "Rename HTML tag" },
      -- Run API request in visual mode
      { "<leader>cr", ":HurlRun<CR>", desc = "Run API request", mode = "v" },
    },
  },
}

Why

It would be good if we could support header and along with formatter. It's super useful for debugging on development.

How

I guess we could split the content into 2 parts: body & header. Only apply the formatter for the body.

commented

Thanks for the suggestions. It should been fixed in the latest version.

Great. Thanks. It works.