mistweaverco / kulala.nvim

A minimal 🤏 HTTP-client 🐼 interface 🖥️ for Neovim ❤️.
https://kulala.mwco.app
MIT License
562 stars 26 forks source link

Treesitter error when running any call #40

Closed franksl closed 2 weeks ago

franksl commented 1 month ago

Hi, I just installed this plugin as a replacement for the discontinued rest.nvim. Whenever I try to run a call on a simple http file I get this error: image

I tried reinstalling almost everything but with no success, Thanks, Franck

gorillamoe commented 1 month ago

Did you run

:TSInstall http

And after that in the file you're at :set ft=http?

There is an automatic way of doing it like this: https://kulala.mwco.app/#/requirements?id=optional-requirements

franksl commented 1 month ago

You're right, thanks! I skipped the requirements section in the docs, hoping to find the full procedure in the Install section, my bad. The http call now starts but it ignores my .env file. I put the .env in the same directory as the .http file, is this correct? Thanks, Frank

gorillamoe commented 1 month ago

It is indeed correct. Can you share your config with me and obfuscate sensitive information?

gorillamoe commented 1 month ago

By config, I mean the http file and the .env filw

franksl commented 1 month ago

Sure, the .env file is as simple as this:

BASEURL=https://mydomain.api.com/v2
USERNAME=myusername
PASSWORD=mypwd

I first tried this kind of http file:

POST {{BASEURL}}/api/my/login
Content-Type:application/json

{
    "username": "{{USERNAME}}",
    "password": "{{PASSWORD}}"
}

It seems to make the call but I don't understand which values are being used, is there a way to get the full call detail?

gorillamoe commented 1 month ago

is there a way to get the full call detail?

Yes, set debug = true in the options table in the kulala.setup function.

The request will be stored in your data dir in nvim/tmp/kulala/request.txt

On my machine it points to $HOME/.local/share/nvim/tmp/kulala/request.txt

franksl commented 1 month ago

By looking at the request.txt it seems that only the {{USERNAME}} variable was replaced, the other ones are still displayed as placeholders, Frank

gorillamoe commented 1 month ago

Will take a look when I'm back home. Will take about 3hrs I guess.

gorillamoe commented 1 month ago

I published v1.6.1 and this is working for me now:

POST https://httpbin.org/post HTTP/1.1
content-type: application/json
accept: application/json

{
  "username": "{{USERNAME}}",
  "password": "{{PASSWORD}}"
}

dotenv

USERNAME=gorillamoe
PASSWORD=xxxxxxxxxxxxxxx=yyyyy1
franksl commented 1 month ago

Hi, Thanks a lot for your support! I tried last version but when I run I get this: image

Thanks

gorillamoe commented 1 month ago

did you call kulala.setup() in your plugin manager of choice?

franksl commented 1 month ago

Yes, my actual Lazy config is:

return {
    {
        'mistweaverco/kulala.nvim',
        lazy = false,
        config = function()
            local kulala = require('kulala')
            kulala.setup({
                debug = true,
                additional_curl_options = {"-v"}
            })
            vim.keymap.set('n', "<leader>rr", kulala.run)
        end
    }
}
gorillamoe commented 1 month ago

Perfect, thanks, can you try v1.6.2

franksl commented 1 month ago

It gives me the same error... :(

gorillamoe commented 1 month ago

Aaaah, I think the additional_curl_options = {"-v"} setup option is causing this.

Can you try removing it?

If I add the verbose flag in my setup, I get like 3mio errors :see_no_evil:

franksl commented 1 month ago

I left setup() with no parameters but the error still perists..

gorillamoe commented 1 month ago

Your :lua vim.print(require("kulala.globals").VERSION) says 1.6.1 and you're at least on nvim 0.10.0 right?

franksl commented 1 month ago

The command says 1.6.2 and my version is 0.10.0, Thanks

gorillamoe commented 1 month ago

I'm running out of ideas, can you try v2.0.1 and see if it works?

franksl commented 1 month ago

Hi, sorry for the late response, still have the same error with 2.3.0... I'll try rewriting my tests..

gorillamoe commented 1 month ago

Can you try the companion tool https://github.com/mistweaverco/kulala-fmt

Maybe this helps 🤷🏾

gorillamoe commented 1 month ago

Any updates here?