Closed garrettkrohn closed 2 weeks ago
The error log isn’t related to formatting. Do you have formatexpr
or formatprg
set for json filetype? That might be the issue here.
rest.nvim uses native gq
command for formatting. If you don’t set formatexpr
or formatprg
option for json filetype, gq
command won’t be able to format response body properly.
Try open json file and type gggqG
. If that doesn’t work that means you don’t have any formatter attached to json filetype.
Comment I wrote in other issue might help.
I should add this check to checkhealth command.
I have formatexpr
already set but not formatprg
.
Formatting was fixed for me when I added the following in my config:
vim.api.nvim_create_autocmd("FileType", {
pattern = { "json" },
callback = function()
vim.api.nvim_set_option_value("formatprg", "jq", { scope = 'local' })
end,
})
But ofcourse I already have jq
installed.
@chardskarth what formatexpr
did you set?
v:lua.vim.lsp.formatexpr()
won’t work.
See this issue: https://github.com/rest-nvim/rest.nvim/issues/414#issuecomment-2308910953
Edit: reference
Closing the issue as this seems to be mainly a vim.lsp.formatexpr()
issue.
If formatting still doesn’t work, please create a new issue with reproducible steps.
Thanks @boltlessengineer thanks for picking this project up!
First off, thank you so much for reviving this project, very excited for it!
I followed the installation instructions, trying both luarocks and lazyvim, but the json responses won't format.
Here are the logs:
I've done as much digging as I can and it seems to be this line: Error while parsing verbose curl output. The odd thing is it prints a blank line, so maybe a blank line is breaking it? Trying to learn more about neovim plugins, but definitely out of my element. Thank you!