Closed t-eichmann closed 3 months ago
Oh, I missed that one. Will be implementing this now. Give me 5 minutes to get a coffee ☕ an then we will rock this!
There will be a .set_default_env(env)
function exposed.
If you omit the env and call it like .set_default_env()
it'll show a telescope picker, if you have one installed, otherwise you can simply call it with your desired env
key.
That sounds nice, do you plan a way to display the currently selected environment? Maybe added to the overlay that displays request execution time or a possibility to display it in the status bar.
or a possibility to display it in the status bar
That would be awesome. Can you open up another issue with "Display selected environment in statusbar", please?
If I have an http-client.env.json and try to run a request without selecting an environment first I get an error message kulala.nvim/lua/kulala/parser/env.lua:27: attempt to concatenate local 'selected_env_name' (a nil value)
It might be good idea to display a warning if no environment is selected and/or store the last used environment somewhere.
If I have an http-client.env.json and try to run a request without selecting an environment first I get an error message
kulala.nvim/lua/kulala/parser/env.lua:27: attempt to concatenate local 'selected_env_name' (a nil value)
It might be good idea to display a warning if no environment is selected and/or store the last used environment somewhere.
Can you check if that's already fixed with the latest commits?
I was thinking of persisting the selected value also.. but then I decided against it,
because I was thinking that you might have different key names in different projects and that would cause headaches. It should always default to dev
on a frest start of neovim :)
The issue is still there. Can you maybe give us an option in the configuration to specify a default environment? On my system my development environment is tagged 'local' while 'dev' is one of our development servers, so having it default to 'dev' would in my special case be rather inconvenient.
The option is already there:
https://github.com/mistweaverco/kulala.nvim?tab=readme-ov-file#simple-configuration
I see why there is a problem, I have to extend the table, will fix asap.
Also, I have other weird behavior. Directly after starting neovim and navigating to my .http file I can not select an environment using lua require('kulala').set_selected_env()
, the telescope picker just doesn't open. If I run a request, getting that error message, suddenly the picker works again.
The option is already there:
https://github.com/mistweaverco/kulala.nvim?tab=readme-ov-file#simple-configuration
I see why there is a problem, I have to extend the table, will fix asap.
Sorry, I missed that option. Anyways, even after setting a deault in my configuration I have the problem with the environment picker.
That's weird, can you double check, if you're on the latest commit, because I had this bug where the picker would not show up too, that was because the env wasn't loaded, because I previously only loaded the env on a request start.
Then I added this line https://github.com/mistweaverco/kulala.nvim/blob/main/lua/kulala/init.lua?plain=1#L12
To make sure the env gets loaded when setup is called.
Yes, I am on the latest commit and checked, the mentioned line is there, but the problem persists. Might be something with my system configuration in general, I just installed lualine to check if displaying the selected environment works (I used the statusbar from mini.nvim before, but am open to change) and that doesn't seem to work either.
Nevermind the issues with the statusbar, that was just me being to stupid to configure lualine correctly.
Can you upload a minimal reproducible example of your config and a .http file somewhere? Or join the Discord server an upload it there? I want to fix that nasty 🤢 bug
My lazy configuration file for kulala
return {
'mistweaverco/kulala.nvim',
opts = { default_env = 'local' },
config = function()
local kulala = require 'kulala'
vim.keymap.set('n', '<leader>pr', kulala.run, { desc = 'Send HTTP [R]equest' })
vim.keymap.set('n', '<leader>pt', kulala.toggle_view, { desc = '[T]oggle View headers/body' })
vim.keymap.set('n', '<leader>pe', kulala.set_selected_env, { desc = 'Select [E]nvironment' })
end,
}
dependencies = { 'nvim-telescope/telescope.nvim' }, Basic envirnment file:
{
"local": {
"host": "https://api.isevenapi.xyz"
}
}
HTTP-file
GET {{host}}/api/iseven/12/
Accept: application/json
Or do you need my entire nvim config?
Ah, you need to call the Kulala setup function, even if empty. It sets most things up.
Something like this should work
return {
'mistweaverco/kulala.nvim',
config = function()
local kulala = require 'kulala'
kulala.setup({ default_env = 'local' })
vim.keymap.set('n', '<leader>pr', kulala.run, { desc = 'Send HTTP [R]equest' })
vim.keymap.set('n', '<leader>pt', kulala.toggle_view, { desc = '[T]oggle View headers/body' })
vim.keymap.set('n', '<leader>pe', kulala.set_selected_env, { desc = 'Select [E]nvironment' })
end,
}
Thanks, now it works, again me being to stupid to set things up correctly. Sorry for causing you extra work.
No worries, all good.
You came along with quite a good catches, so I owe you one. Thanks for beta testing this little baby!
The thanks goes right back to you, with your relentless work in the last days you made my Postman setup entirely obsolete, that's more than I could wish for.
As described here https://learn.microsoft.com/en-us/aspnet/core/test/http-files?view=aspnetcore-8.0#environment-files environment files in the http-client.env.json format allow to specify different environments (in the example dev and remote). Is there a way to address/load different environments specified in these files in .http files? That would be a pretty neat feature if it doesn't already exist.