Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

New release breaks everything #306

Closed
radvil opened this issue Mar 18, 2024 · 51 comments
Closed

New release breaks everything #306

radvil opened this issue Mar 18, 2024 · 51 comments
Labels
bug Something isn't working good first issue Good for newcomers v2 rest.nvim v2 issues

Comments

@radvil
Copy link

radvil commented Mar 18, 2024

Seems like the neweset version breaks everything, all dependencies, options,everything.

Can you make a new branch associated to previous version before the breaking changes ??
It's so pain in the ass to re adjusting my configuration, like I dont have time.

Please make a new branch. Thanks

@radvil
Copy link
Author

radvil commented Mar 18, 2024

Also I got these errors

[rest.nvim] WARN: Unrecognized  configs found in setup: { "keybinds.2", "keybinds.1" }
[rest.nvim] Dependency 'lua-curl' was not found. Default HTTP client won't work
[rest.nvim] Dependency 'xml2lua' was not found. rest.nvim will be completely unable to use XML bodies in your requests
[rest.nvim] Dependency 'nvim-nio' was not found. rest.nvim will not work asynchronously
[rest.nvim] Dependency 'mimetypes' was not found. rest.nvim will  be completely unable to recognize the file type of external body files

@8uff3r
Copy link

8uff3r commented Mar 18, 2024

I added the dependencies to luarocks.nvim and it's working, I use lazy.nvim so this is my config:

  {
    "vhyrro/luarocks.nvim",
    opts = {
      rocks = {  "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, -- Specify LuaRocks packages to install
    },
  }

@radvil
Copy link
Author

radvil commented Mar 18, 2024

Thanks, I ll try that. This should be clarified in the documentation.

@radvil
Copy link
Author

radvil commented Mar 18, 2024

I added the dependencies to luarocks.nvim and it's working, I use lazy.nvim so this is my config:

  {
    "vhyrro/luarocks.nvim",
    opts = {
      rocks = {  "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, -- Specify LuaRocks packages to install
    },
  }

This works, but the keybinds options seems like still broken. still have that error message, but it's fine, gotta setup them manually for now

@NTBBloodbath
Copy link
Member

Hey, I'm very sorry that everything broke, but it was for improvement and it was necessary, nothing will break again!

Could you send your keybind setup? I'm busy right now so I can't help much, but as soon as I can I'll take a look. Also thanks @8uff3r for helping there! :)

@radvil
Copy link
Author

radvil commented Mar 18, 2024

Hey, I'm very sorry that everything broke, but it was for improvement and it was necessary, nothing will break again!

Could you send your keybind setup? I'm busy right now so I can't help much, but as soon as I can I'll take a look. Also thanks @8uff3r for helping there! :)

It's okay for breaking changes, I like a new result preview, however it is better to make a stable release for the previous version that doesn't break, because I needed to search to the whole commit history just to make everything works as the previous one again.

Anyway, here is my config options:

    opts = {
      client = "curl",
      env_file = ".env",
      env_pattern = "\\.env$",
      env_edit_command = "tabedit",
      encode_url = true,
      skip_ssl_verification = false,
      custom_dynamic_variables = {},
      logs = {
        level = "info",
        save = true,
      },
      highlight = {
        enable = true,
        timeout = 750,
      },
      result = {
        split = {
          in_place = false,
          horizontal = false,
          stay_in_current_window_after_split = true,
        },
        behavior = {
          decode_url = true,
          show_info = {
            url = true,
            headers = true,
            http_info = true,
            curl_command = true,
          },
          formatters = {
            json = "jq",
            html = function(body)
              if vim.fn.executable("tidy") == 0 then
                return body, { found = false, name = "tidy" }
              end
              local fmt_body = vim.fn.system({
                "tidy",
                "-i",
                "-q",
                "--tidy-mark", "no",
                "--show-body-only", "auto",
                "--show-errors", "0",
                "--show-warnings", "0",
                "-",
              }, body):gsub("\n$", "")

              return fmt_body, { found = true, name = "tidy" }
            end,
          },
        },
      },
      keybinds = {
        { "<localleader>rr", "<cmd>Rest run<cr>",      "Run request under the cursor", },
        { "<localleader>rl", "<cmd>Rest run last<cr>", "Re-run latest request", },
      }
    },

I just pasted everything from the default config based on the new README.

@radvil
Copy link
Author

radvil commented Mar 18, 2024

I leave this comment here, just in case anyone else that want to revert to previous version.
This is latest commit that works 91badd46c60df6bd9800c809056af2d80d33da4c

@8uff3r
Copy link

8uff3r commented Mar 18, 2024

Hey, I'm very sorry that everything broke, but it was for improvement and it was necessary, nothing will break again!

Could you send your keybind setup? I'm busy right now so I can't help much, but as soon as I can I'll take a look. Also thanks @8uff3r for helping there! :)

It's okay for breaking changes, I like a new result preview, however it is better to make a stable release for the previous version that doesn't break, because I needed to search to the whole commit history just to make everything works as the previous one again.

Anyway, here is my config options:

    opts = {
      client = "curl",
      env_file = ".env",
      env_pattern = "\\.env$",
      env_edit_command = "tabedit",
      encode_url = true,
      skip_ssl_verification = false,
      custom_dynamic_variables = {},
      logs = {
        level = "info",
        save = true,
      },
      highlight = {
        enable = true,
        timeout = 750,
      },
      result = {
        split = {
          in_place = false,
          horizontal = false,
          stay_in_current_window_after_split = true,
        },
        behavior = {
          decode_url = true,
          show_info = {
            url = true,
            headers = true,
            http_info = true,
            curl_command = true,
          },
          formatters = {
            json = "jq",
            html = function(body)
              if vim.fn.executable("tidy") == 0 then
                return body, { found = false, name = "tidy" }
              end
              local fmt_body = vim.fn.system({
                "tidy",
                "-i",
                "-q",
                "--tidy-mark", "no",
                "--show-body-only", "auto",
                "--show-errors", "0",
                "--show-warnings", "0",
                "-",
              }, body):gsub("\n$", "")

              return fmt_body, { found = true, name = "tidy" }
            end,
          },
        },
      },
      keybinds = {
        { "<localleader>rr", "<cmd>Rest run<cr>",      "Run request under the cursor", },
        { "<localleader>rl", "<cmd>Rest run last<cr>", "Re-run latest request", },
      }
    },

I just pasted everything from the default config based on the new README.

You can use lazy.nvim to setup your keybinds with keys:

  {
    "rest-nvim/rest.nvim",
    keys = {
      { "<leader>rr", "<cmd>Rest run<cr>", desc = "Run REST request" },
    },
  },

@NTBBloodbath
Copy link
Member

however it is better to make a stable release for the previous version that doesn't break, because I needed to search to the whole commit history just to make everything works as the previous one again.

In the repository there are tags and semantic releases that you can use in your plugin manager to rollback to the previous stable release :)


Now, that bug is a little weird, I'll definitely take a look at it as soon as I get home, thanks for reporting it and also for providing a commit in case someone wants to rollback that way, that is appreciated.

@radvil
Copy link
Author

radvil commented Mar 18, 2024

however it is better to make a stable release for the previous version that doesn't break, because I needed to search to the whole commit history just to make everything works as the previous one again.

In the repository there are tags and semantic releases that you can use in your plugin manager to rollback to the previous stable release :)

Now, that bug is a little weird, I'll definitely take a look at it as soon as I get home, thanks for reporting it and also for providing a commit in case someone wants to rollback that way, that is appreciated.

Oh, my bad, I didn't check the release tags, haha. Sorry for that

@NTBBloodbath NTBBloodbath added bug Something isn't working good first issue Good for newcomers v2 rest.nvim v2 issues labels Mar 18, 2024
@NTBBloodbath
Copy link
Member

@radvil I think I fixed the keybinds configuration table issue, could you please update and check if the issue persists in your end?

@NTBBloodbath
Copy link
Member

I added the dependencies to luarocks.nvim and it's working, I use lazy.nvim so this is my config:

  {
    "vhyrro/luarocks.nvim",
    opts = {
      rocks = {  "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, -- Specify LuaRocks packages to install
    },
  }

btw @8uff3r, does your lazy's setup have this? It should be running the build.lua from the repository that handles our luarocks dependencies installation automatically, not sure if this is the default value for it tho.

install = {
  missing = true,
}

@8uff3r
Copy link

8uff3r commented Mar 18, 2024

I added the dependencies to luarocks.nvim and it's working, I use lazy.nvim so this is my config:

  {
    "vhyrro/luarocks.nvim",
    opts = {
      rocks = {  "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, -- Specify LuaRocks packages to install
    },
  }

btw @8uff3r, does your lazy's setup have this? It should be running the build.lua from the repository that handles our luarocks dependencies installation automatically, not sure if this is the default value for it tho.

install = {
  missing = true,
}

No I don't have that in my config but I according to lazy's docs it should be the default

@cyaconi
Copy link

cyaconi commented Mar 18, 2024

Could you please tell me what I am doing wrong? I keep getting the same OP errors with this configuration in Lazyvim:

return {
  {
    "vhyrro/luarocks.nvim",
    opts = {
      rocks = { "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, 
    },
    config = function()
      require("luarocks").setup({})
    end,
  },
  {
    "rest-nvim/rest.nvim",
    event = "VeryLazy",
    ft = { "http" },
    dependencies = {
      {
        "luarocks.nvim",
      },
      {
        "folke/which-key.nvim",
        optional = true,
        opts = {
          defaults = {
            ["<leader>r"] = { name = "+rest" },
          },
        },
      },
    },
    config = function()
      require("rest-nvim").setup()
    end,
    keys = {
      { "<leader>rr", "<Plug>RestNvim", desc = "Run rest http request under cursor" },
      { "<leader>rc", "<Plug>RestNvimPreview", desc = "Return the cURL command for the request under cursor" },
      { "<leader>rd", "<cmd>RestSelectEnv dev.env<cr>", desc = "Select dev.env file for rest testing" },
      { "<leader>rs", "<cmd>RestSelectEnv stg.env<cr>", desc = "Select stg.env file for rest testing" },
    },
  },
}

@8uff3r
Copy link

8uff3r commented Mar 18, 2024

Could you please tell me what I am doing wrong? I keep getting the same OP errors with this configuration in Lazyvim:

return {
  {
    "vhyrro/luarocks.nvim",
    opts = {
      rocks = { "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, 
    },
    config = function()
      require("luarocks").setup({})
    end,
  },
  {
    "rest-nvim/rest.nvim",
    event = "VeryLazy",
    ft = { "http" },
    dependencies = {
      {
        "luarocks.nvim",
      },
      {
        "folke/which-key.nvim",
        optional = true,
        opts = {
          defaults = {
            ["<leader>r"] = { name = "+rest" },
          },
        },
      },
    },
    config = function()
      require("rest-nvim").setup()
    end,
    keys = {
      { "<leader>rr", "<Plug>RestNvim", desc = "Run rest http request under cursor" },
      { "<leader>rc", "<Plug>RestNvimPreview", desc = "Return the cURL command for the request under cursor" },
      { "<leader>rd", "<cmd>RestSelectEnv dev.env<cr>", desc = "Select dev.env file for rest testing" },
      { "<leader>rs", "<cmd>RestSelectEnv stg.env<cr>", desc = "Select stg.env file for rest testing" },
    },
  },
}

In your luarocks.nvim config, you should remove this part:

config = function() 
    require("luarocks").setup({})
 end,

So that it would be like this:

{
     "vhyrro/luarocks.nvim",
      opts = {
          rocks = { "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, 
      },
}

The removed part is overriding the opts

@cyaconi
Copy link

cyaconi commented Mar 19, 2024

Thanks, @8uff3r. It didn't work, though, and I'm still getting these dependency errors:

[rest.nvim] Dependency 'lua-curl' was not found. Default HTTP client won't work
[rest.nvim] Dependency 'xml2lua' was not found. rest.nvim will be completely unable to use XML bodies in your requests
[rest.nvim] Dependency 'nvim-nio' was not found. rest.nvim will not work asynchronously
[rest.nvim] Dependency 'mimetypes' was not found. rest.nvim will  be completely unable to recognize the file type of external body files

It looks like Luarocks isn't installing them as it should. Is there any workaround or anything I can do to help troubleshoot?

@NTBBloodbath
Copy link
Member

Thanks, @8uff3r. It didn't work, though, and I'm still getting these dependency errors:

[rest.nvim] Dependency 'lua-curl' was not found. Default HTTP client won't work
[rest.nvim] Dependency 'xml2lua' was not found. rest.nvim will be completely unable to use XML bodies in your requests
[rest.nvim] Dependency 'nvim-nio' was not found. rest.nvim will not work asynchronously
[rest.nvim] Dependency 'mimetypes' was not found. rest.nvim will  be completely unable to recognize the file type of external body files

It looks like Luarocks isn't installing them as it should. Is there any workaround or anything I can do to help troubleshoot?

Hi, apologies for the problems!

That's extremely rare, could you post what your :checkhealth rest-nvim tells about the installation and also what OS are you currently using? I saw someone had a similar problem and I want to be sure how to deal with that situation.

I think the other person uses MacOS, if you do too then I will take my MacBook and do some installation tests since it has worked well for me on Linux and I want to rule out any problems with luarocks.nvim and MacOS.

@pepe-cadena
Copy link

:checkhealth rest-nvim macOS Sonoma:
Captura de pantalla 2024-03-19 a la(s) 7 45 37

@vhyrro
Copy link
Contributor

vhyrro commented Mar 19, 2024

Hey, developer of luarocks.nvim here:

Lazy will only re-run build files if they failed or if there is a newer version of the plugin in question. If you ever feel like something went wrong, :Lazy build luarocks.nvim followed by :Lazy build rest.nvim will attempt to forcefully build both plugins -- this will also display any errors to your console if they occur.

Could you all try and rebuild with the commands above and see if you get any specific errors messages? That should help in the debugging process.

Additionally, I've been working on a new version of the project in the go-away-python branch, which should also come with more stable compilation on MacOS machines. If you'd like to test the new release to see if it perhaps fixes anything, do the following:

  • Open the lazy UI by running :Lazy
  • Press x over the luarocks.nvim plugin to entirely remove it from the filesystem
  • Replace your config to use the go-away-python branch:
    {
      "vhyrro/luarocks.nvim",
      branch = "go-away-python",
      config = function()
        require("luarocks").setup({})
      end,
    },
  • Save, quit, re-enter Neovim and run :Lazy sync (if it doesn't run automatically)

Let me know of any errors that you encounter along the way :)

@radvil
Copy link
Author

radvil commented Mar 19, 2024

@radvil I think I fixed the keybinds configuration table issue, could you please update and check if the issue persists in your end?

Hi, I've tried the latest version just now, the keybinds issue no longer exists, now I can hit my keymap, but the still can not read my default env file related to #308. Thanks

@Akstrov
Copy link

Akstrov commented Mar 20, 2024

I am using neovim nightly 0.10 on my ubuntu wsl and keep getting this error

Failed to run `config` for luarocks.nvim
...cal/share/nvim/lazy/luarocks.nvim/lua/luarocks/rocks.lua:27: [luarocks] Failed to install from rockspec
Warning: falling back to wget - install luasec >= 1.1 to get native HTTPS support
Error: Failed installing dependency: https://luarocks.org/lua-curl-0.3.13-1.src.rock - Could not find header file for CURL
  No file curl/curl.h in /usr/local/include
  No file curl/curl.h in /usr/include
  No file curl/curl.h in /include
You may have to install CURL in your system and/or pass CURL_DIR or CURL_INCDIR to the luarocks command.
Example: luarocks install lua-curl CURL_DIR=/usr/local
Missing dependencies for neovim-rocks-user-rockspec 0.0-0:
   lua-curl (not installed)
   mimetypes (not installed)
   xml2lua (not installed)
neovim-rocks-user-rockspec 0.0-0 depends on lua-curl (not installed)
Installing https://luarocks.org/lua-curl-0.3.13-1.src.rock
# stacktrace:
  - /luarocks.nvim/lua/luarocks/rocks.lua:27 _in_ **install**
  - /luarocks.nvim/lua/luarocks/rocks.lua:55 _in_ **ensure**
  - /luarocks.nvim/lua/luarocks.lua:25 _in_ **setup**
  - ~/.config/nvim/lua/config/lazy.lua:9
  - ~/.config/nvim/init.lua:2
Failed to source `/home/akstrov/.local/share/nvim/lazy/rest.nvim/plugin/rest-nvim.lua`
vim/_editor.lua:0: /home/akstrov/.config/nvim/init.lua..nvim_exec2() called at /home/akstrov/.config/nvim/init.lua:0../home/akstrov/.local/share/nvim/lazy/rest.nvim/plugin/rest-nvim.lua: Vim(source):[rest.nvim] WARN: Dependency 'lua-curl' was not found. Default HTTP client won't work
# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.config/nvim/lua/config/lazy.lua:9
  - ~/.config/nvim/init.lua:2

here is my config:

return {
  {
    "vhyrro/luarocks.nvim",
    branch = "go-away-python",
    opts = {
      rocks = { "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, -- Specify LuaRocks packages to install
    },
    config = function()
      require("luarocks").setup({})
    end,
  },
  {
    "rest-nvim/rest.nvim",
    ft = "http",
    lazy = false,
    keys = {
      {
        "<leader>rr",
        "<cmd>Rest run<cr>",
        desc = "RestNvim Run",
      },
      {
        "<leader>rl",
        "<cmd>Rest last<cr>",
        desc = "RestNvim Run Last",
      },
    },
    dependencies = { "luarocks.nvim" },
    config = function()
      require("rest-nvim").setup()
    end,
  },
}

this is my checkhealth rest-nvim

rest-nvim: require("rest-nvim.health").check()

Installation ~
- OK Found `luarocks` installed in your system
- OK Found Luarocks PATHs in your Neovim's Lua `package.path`
- ERROR Dependency `mimetypes` was not found (rest.nvim will be completely unable to recognize the file type of external body files)
  - ADVICE:
    - Install it through `luarocks --local install mimetypes`
- ERROR Dependency `lua-curl` was not found (Default HTTP client won't work)
  - ADVICE:
    - Install it through `luarocks --local install lua-curl`
- OK Dependency `nvim-nio` was found
- OK Dependency `nvim-treesitter` was found
- ERROR Dependency `xml2lua` was not found (rest.nvim will be completely unable to use XML bodies in your requests)
  - ADVICE:
    - Install it through `luarocks --local install xml2lua`
- OK Tree-sitter `http` parser is installed

Configuration ~
- OK No unrecognized configuration options were found
- OK Formatter for `html` is set to `tidy` and rest.nvim found it in your system
- OK Formatter for `json` is set to `jq` and rest.nvim found it in your system

@NTBBloodbath
Copy link
Member

I am using neovim nightly 0.10 on my ubuntu wsl and keep getting this error

Failed to run `config` for luarocks.nvim
...cal/share/nvim/lazy/luarocks.nvim/lua/luarocks/rocks.lua:27: [luarocks] Failed to install from rockspec
Warning: falling back to wget - install luasec >= 1.1 to get native HTTPS support
Error: Failed installing dependency: https://luarocks.org/lua-curl-0.3.13-1.src.rock - Could not find header file for CURL
  No file curl/curl.h in /usr/local/include
  No file curl/curl.h in /usr/include
  No file curl/curl.h in /include
You may have to install CURL in your system and/or pass CURL_DIR or CURL_INCDIR to the luarocks command.
Example: luarocks install lua-curl CURL_DIR=/usr/local
Missing dependencies for neovim-rocks-user-rockspec 0.0-0:
   lua-curl (not installed)
   mimetypes (not installed)
   xml2lua (not installed)
neovim-rocks-user-rockspec 0.0-0 depends on lua-curl (not installed)
Installing https://luarocks.org/lua-curl-0.3.13-1.src.rock
# stacktrace:
  - /luarocks.nvim/lua/luarocks/rocks.lua:27 _in_ **install**
  - /luarocks.nvim/lua/luarocks/rocks.lua:55 _in_ **ensure**
  - /luarocks.nvim/lua/luarocks.lua:25 _in_ **setup**
  - ~/.config/nvim/lua/config/lazy.lua:9
  - ~/.config/nvim/init.lua:2
Failed to source `/home/akstrov/.local/share/nvim/lazy/rest.nvim/plugin/rest-nvim.lua`
vim/_editor.lua:0: /home/akstrov/.config/nvim/init.lua..nvim_exec2() called at /home/akstrov/.config/nvim/init.lua:0../home/akstrov/.local/share/nvim/lazy/rest.nvim/plugin/rest-nvim.lua: Vim(source):[rest.nvim] WARN: Dependency 'lua-curl' was not found. Default HTTP client won't work
# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.config/nvim/lua/config/lazy.lua:9
  - ~/.config/nvim/init.lua:2

here is my config:

return {
  {
    "vhyrro/luarocks.nvim",
    branch = "go-away-python",
    opts = {
      rocks = { "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }, -- Specify LuaRocks packages to install
    },
    config = function()
      require("luarocks").setup({})
    end,
  },
  {
    "rest-nvim/rest.nvim",
    ft = "http",
    lazy = false,
    keys = {
      {
        "<leader>rr",
        "<cmd>Rest run<cr>",
        desc = "RestNvim Run",
      },
      {
        "<leader>rl",
        "<cmd>Rest last<cr>",
        desc = "RestNvim Run Last",
      },
    },
    dependencies = { "luarocks.nvim" },
    config = function()
      require("rest-nvim").setup()
    end,
  },
}

this is my checkhealth rest-nvim

rest-nvim: require("rest-nvim.health").check()

Installation ~
- OK Found `luarocks` installed in your system
- OK Found Luarocks PATHs in your Neovim's Lua `package.path`
- ERROR Dependency `mimetypes` was not found (rest.nvim will be completely unable to recognize the file type of external body files)
  - ADVICE:
    - Install it through `luarocks --local install mimetypes`
- ERROR Dependency `lua-curl` was not found (Default HTTP client won't work)
  - ADVICE:
    - Install it through `luarocks --local install lua-curl`
- OK Dependency `nvim-nio` was found
- OK Dependency `nvim-treesitter` was found
- ERROR Dependency `xml2lua` was not found (rest.nvim will be completely unable to use XML bodies in your requests)
  - ADVICE:
    - Install it through `luarocks --local install xml2lua`
- OK Tree-sitter `http` parser is installed

Configuration ~
- OK No unrecognized configuration options were found
- OK Formatter for `html` is set to `tidy` and rest.nvim found it in your system
- OK Formatter for `json` is set to `jq` and rest.nvim found it in your system

Hi, I think your system is missing the cURL development headers. Could you try installing them (sudo apt install libcurl4-gnutls-dev) and check if the issue persists?

@Akstrov
Copy link

Akstrov commented Mar 20, 2024

Hi, I think your system is missing the cURL development headers. Could you try installing them (sudo apt install libcurl4-gnutls-dev) and check if the issue persists?

I still get the same error

here is my curl hearder file:
image

@tochamateusz
Copy link

luarocks --local install Lua-cURL CURL_INCDIR=/usr/include/x86_64-linux-gnu/

@vhyrro
Copy link
Contributor

vhyrro commented Mar 22, 2024

Fixes for Broken Luarocks

Firstly, this issue will be pinned to the project's issues for the next week or so such that people with broken configurations can quickly access the solution.

Secondly, luarocks.nvim has pushed a breaking change (the last one we will push in a while), thus also affecting rest.nvim. I know two breakages in the span of a few days is mildly infuriating, but bear with us here!

The new breaking change drops the python dependency, speeds up the installation process by several times and properly supports all major platforms.

Update your Configuration

The latest config for luarocks.nvim has been greatly simplified. Change your existing configuration for luarocks.nvim to just:

{
  "vhyrro/luarocks.nvim",
  priority = 1000,
  config = true,
},

The high priority is important as it ensures that many versions of the same dependency in your configuration will work as anticipated. This priority should be the highest out of your entire configuration (1000 is probably enough) - we just need to ensure that this plugin loads first out of all the others.

Completely Reinstall luarocks.nvim

This affect lazy users predominantly. Open up the lazy UI with :Lazy, navigate over to luarocks.nvim and press x on it to delete it. Do the same for rest.nvim. Afterwards restart your Neovim for lazy.nvim to reinstall the plugins. This will remove the old hererocks installation and install a fresh version of luarocks from scratch, this time without python. Afterwards, rest.nvim will install all of the rocks automatically.

Tip

If the installation processes are failing run :Lazy build luarocks.nvim followed by :Luarocks build rest.nvim manually.
This is just a quirk of lazy and its build script invocations.

If you encounter any errors, please post them either here or on the luarocks.nvim issue tracker!

@mesa123123
Copy link

mesa123123 commented Mar 22, 2024

I've gone through all of this and I'm still getting errors, even went as far as manually installing lua rocks outside nvim and nothign has worked:
Here's my check health for the rest.nvim:
Screenshot_2024-03-22_22-14-55

Not sure what it means by package path and I don't see anything in the read me like its been advised I check.

Stumped here sorry.

I'll be uninstalling these plugins for a while until the next, probs on nvim 0.10's release i'll reinstall as I'll switch across to nvim_rocks with that too :)

@vhyrro
Copy link
Contributor

vhyrro commented Mar 23, 2024

Trying to use an external luarocks is not usually a good idea and will likely cause things to break when installing rocks for lua 5.1 -- that's just how it is :/

@mesa123123 if you run :Lazy build luarocks.nvim, what sort of errors do you get? That would help me in debugging this thing :)

@mesa123123
Copy link

Oh damn! Really?
That's rather annoying!

Give me a few moments and I'll try and get the errors back up 🙂

@alexxShandsome
Copy link

As much as this plugin need to improve, but not like this where everything breaks. I just like it back then where curl is just the main dependency.

Thankfully there's still another plugin that I can substitute for this which is vim-rest-console

@vhyrro
Copy link
Contributor

vhyrro commented Mar 23, 2024

@alexxShandsome this is precisely why rest.nvim is versioned. Feel free to stay on the older version while the situation gets cleaned up :)

@NTBBloodbath NTBBloodbath pinned this issue Mar 23, 2024
@mesa123123
Copy link

mesa123123 commented Mar 23, 2024

Hey @vhyrro just getting some stats for you:

Here's my neofetch:
image

Here's my nvim --version:
image

output of messages command:
image

output of manual builds 1nvim -l /build.lua`:
build.lua for rest:
image

build.lua for luarocks:
image

@mesa123123
Copy link

mesa123123 commented Mar 23, 2024

Error that pops up when I open nvim after install:
image

and same in the notifications telescope:
image

@rodhash
Copy link

rodhash commented Mar 23, 2024

You could lazy load it only for "http" filetype so Nvim won't try to load "rest" for every file / buffer

@vhyrro
Copy link
Contributor

vhyrro commented Mar 23, 2024

@mesa123123 thanks for the error logs! I can't seem to figure out why things aren't working though just from the logs. It could be lazy yet again doing unexpected things during the build process, which would be a big shame. Could you also post your configuration, how you set up luarocks.nvim and rest.nvim? Thanks for your time in helping debug all this :)

@mesa123123
Copy link

mesa123123 commented Mar 23, 2024

Hey @vhyrro my configs are in my dotfiles but the lines that rest.nvim is dealing with are these in the init.lua:

Under plugin install lines [152-164]:

    {
      "vhyrro/luarocks.nvim",
      priority = 1000,
      config = true,
    },
    {
      "rest-nvim/rest.nvim",
      ft = "http",
      dependencies = { "luarocks.nvim" },
      config = function()
        require("rest-nvim").setup()
      end,
    },

and keymaps highlighted [lines 1735-1742]:

---------------------------------"
-- Http Execution - rest.nvim
---------------------------------"

require("rest-nvim").setup({})
norm_keyset("<leader>xhx", "RestNvim", "Run Http Under Cursor")
norm_keyset("<leader>xhp", "RestNvimPreview", "Preview Curl Command From Http Under Cursor")
norm_keyset("<leader>xhx", "RestNvim", "Re-Run Last Http Command")

Also definition of norm_keyset:

-- Abstraction for the vast majority of my keymappings
local function norm_keyset(key, command, wkdesc)
	keymap.set("n", key, "<cmd>" .. command .. "<CR>", { silent = true, noremap = true, desc = wkdesc })
end

@mesa123123
Copy link

Just saw I've setup rest.nvim twice, I'm going to check if this is the problem :/

@mesa123123
Copy link

Nope...

image

Similar errors

@vhyrro
Copy link
Contributor

vhyrro commented Mar 23, 2024

@mesa123123 pushed a fix which I think might resolve the issue! As usual remove the luarocks.nvim and rest.nvim plugins with x in the :Lazy UI, restart Neovim and see if the installation succeeds this time 😅

@mesa123123
Copy link

Heres what pops up for me:

image

I'm not sure what the go is sadly :/

@mesa123123
Copy link

Tried to install luarocks on its own and then rest and still same error popping up :/

@NTBBloodbath
Copy link
Member

Hey @mesa123123, just noticed I had to modify the build.lua script to adopt some breaking changes in the luarocks.nvim plugin, could you please try again? Let's hope this one does the trick and my apologies for the inconveniences :)

@mesa123123
Copy link

No dice sorry :/

image

Maybe its my config?

@mesa123123
Copy link

Also no need to apologise! This is part of being in open source! All part of it :D

@mesa123123
Copy link

mesa123123 commented Mar 25, 2024

OK so I think I got it working:

Basically I've added paths to my package path so nvim knows where to look for my paths:

-- Package Path Upgrade
----------
-- Rocks installed through luarocks.nvim
package.path = package.path .. ";" .. plugin_path .. "/luarocks.nvim/.rocks/share/lua/6.1/?.lua;"
package.path = package.path .. ";" .. plugin_path .. "/luarocks.nvim/.rocks/share/lua/5.1/?/?.lua;"
-- Rocks installed through local luarocks
package.path = package.path .. ";" .. fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;"
----------

And it seems to work now! Or at least my errors are all about treesitter!

19:49:02 msg_show   e http.http Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/share/nvim/runtime/filetype.lua:25: BufNewFile Autocommands for "*"..FileType Autocommands for "http"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 229 for language http
stack traceback:
	[C]: in function '_ts_parse_query'
	/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: in function 'get'
	/usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:114: in function 'new'
	/usr/share/nvim/runtime/lua/vim/treesitter.lua:61: in function '_create_parser'
	/usr/share/nvim/runtime/lua/vim/treesitter.lua:131: in function 'get_parser'
	/usr/share/nvim/runtime/lua/vim/treesitter.lua:460: in function 'start'
	...m/lazy/nvim-treesitter/lua/nvim-treesitter/highlight.lua:20: in function 'attach'
	...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
	...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
	...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
	[C]: in function 'nvim_exec_autocmds'
	...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:157: in function <...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:156>
	[C]: in function 'xpcall'
	.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
	...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:156: in function 'trigger'
	...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:87: in function <...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:72>
	[C]: in function 'nvim_cmd'
	/usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:24>
	[C]: in function 'nvim_buf_call'
	/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
	[C]: in function 'nvim_cmd'
	/usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:24>
	[C]: in function 'nvim_buf_call'
	/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
	[C]: in function 'nvim_buf_call'
	/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>

Thats the output I get when I open a .http file

@kevinm6
Copy link
Contributor

kevinm6 commented Mar 26, 2024

I arrive a little later, but I figure out a way to make it works on macOS using previous comments and advice.
(the config is based on Lazy.nvim)

  {
    "vhyrro/luarocks.nvim”,
    -- explicit tell Lazy the module name due to error on calling
    --  the module with the suffix ‘.nvim’; in this way Lazy will call < require “luarocks”.setup({}) >
    name = "luarocks”,
    config = true
  },
  {
    "rest-nvim/rest.nvim",
    dependencies = { "luarocks" },
    ft = { "http", "https" },
    config = function(_, o)
      require "rest-nvim".setup(o)
    end
  }

With this config all the build and installation is done correctly.

@caenrique
Copy link

with all the breaking changes, it would be nice to have documentation on how to migrate from the previous setup

@nezudevv
Copy link

nezudevv commented Apr 2, 2024

I seem to be getting an error as well. Not sure if it's related to this new release but sharing just in case. I am also stuck trying to get past it.

Here is the error message. It seems to be a tree-sitter parsing issue but cannot for the life of me get passed this.
Happens when running :Rest run while hilghighting the request line in a HTTP file.

[rest.nvim] ERROR: The tree-sitter node at the range [0:0 - 25] has a syntax error and cannot be parsed
Error executing Lua callback: .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: attempt to index local 'req_node' (a nil value)
stack traceback:
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: in function 'traverse_request'
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:432: in function 'parse'
        ...al/share/nvim/lazy/rest.nvim/lua/rest-nvim/functions.lua:61: in function 'exec'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:44: in function 'impl'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:182: in function <...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:165>
My nvim setup: 

 {
    "vhyrro/luarocks.nvim",
    branch = "go-away-python",
    lazy = false,
  },
  {
    "rest-nvim/rest.nvim",
    ft = "http",
    dependencies = { "luarocks.nvim" },
    config = function()
      require("rest-nvim").setup()
    end,
  },

And treesitter: 
 {
    "nvim-treesitter/nvim-treesitter",
    ensure_installed = { "lua", "xml", "http", "json", "graphql" },
    opts = overrides.treesitter,
  },

I should say that I've also tried several other iterations of configs setup that have been suggested in this thread, all with the same result.

@cyaconi
Copy link

cyaconi commented Apr 2, 2024

I seem to be getting an error as well. Not sure if it's related to this new release but sharing just in case. I am also stuck trying to get past it.

Here is the error message. It seems to be a tree-sitter parsing issue but cannot for the life of me get passed this. Happens when running :Rest run while hilghighting the request line in a HTTP file.

[rest.nvim] ERROR: The tree-sitter node at the range [0:0 - 25] has a syntax error and cannot be parsed
Error executing Lua callback: .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: attempt to index local 'req_node' (a nil value)
stack traceback:
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: in function 'traverse_request'
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:432: in function 'parse'
        ...al/share/nvim/lazy/rest.nvim/lua/rest-nvim/functions.lua:61: in function 'exec'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:44: in function 'impl'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:182: in function <...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:165>
My nvim setup: 

 {
    "vhyrro/luarocks.nvim",
    branch = "go-away-python",
    lazy = false,
  },
  {
    "rest-nvim/rest.nvim",
    ft = "http",
    dependencies = { "luarocks.nvim" },
    config = function()
      require("rest-nvim").setup()
    end,
  },

And treesitter: 
 {
    "nvim-treesitter/nvim-treesitter",
    ensure_installed = { "lua", "xml", "http", "json", "graphql" },
    opts = overrides.treesitter,
  },

I should say that I've also tried several other iterations of configs setup that have been suggested in this thread, all with the same result.

Check trailing spaces in your http file, delete them even in --{% and --%} lines if you're using script variables. I struggled with the same issue until I realized that removing trailing spaces solves many of the treesitter's errors. Same with JSONs, make sure they are well formatted too.

@nezudevv
Copy link

nezudevv commented Apr 3, 2024

I seem to be getting an error as well. Not sure if it's related to this new release but sharing just in case. I am also stuck trying to get past it.
Here is the error message. It seems to be a tree-sitter parsing issue but cannot for the life of me get passed this. Happens when running :Rest run while hilghighting the request line in a HTTP file.

[rest.nvim] ERROR: The tree-sitter node at the range [0:0 - 25] has a syntax error and cannot be parsed
Error executing Lua callback: .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: attempt to index local 'req_node' (a nil value)
stack traceback:
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: in function 'traverse_request'
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:432: in function 'parse'
        ...al/share/nvim/lazy/rest.nvim/lua/rest-nvim/functions.lua:61: in function 'exec'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:44: in function 'impl'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:182: in function <...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:165>
My nvim setup: 

 {
    "vhyrro/luarocks.nvim",
    branch = "go-away-python",
    lazy = false,
  },
  {
    "rest-nvim/rest.nvim",
    ft = "http",
    dependencies = { "luarocks.nvim" },
    config = function()
      require("rest-nvim").setup()
    end,
  },

And treesitter: 
 {
    "nvim-treesitter/nvim-treesitter",
    ensure_installed = { "lua", "xml", "http", "json", "graphql" },
    opts = overrides.treesitter,
  },

I should say that I've also tried several other iterations of configs setup that have been suggested in this thread, all with the same result.

Check trailing spaces in your http file, delete them even in --{% and --%} lines if you're using script variables. I struggled with the same issue until I realized that removing trailing spaces solves many of the treesitter's errors. Same with JSONs, make sure they are well formatted too.

@cyaconi I have made sure that all of the white space has been cleared, there were none so unfortunately that isn't the issue :/

@kevinm6
Copy link
Contributor

kevinm6 commented Apr 3, 2024

@nezudevv try to change luarocks.nvim to

{
    "vhyrro/luarocks.nvim”,
    name =luarocks’,
    opts = {
      rocks = { "lua-curl", "nvim-nio", "mimetypes", "xml2lua" }
    }
}

Before reloading this config, in the Lazy dashboard go over luarocks.nvim and rest.nvim and press x to remove the plugins and clean their directories.
After that close and reopen Neovim !

If this is not working, try to send here the content of the file you’re trying to run via rest.nvim

@rest-nvim rest-nvim locked and limited conversation to collaborators Apr 4, 2024
@NTBBloodbath NTBBloodbath converted this issue into discussion #348 Apr 4, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working good first issue Good for newcomers v2 rest.nvim v2 issues
Projects
None yet
Development

No branches or pull requests