diff options
| author | Yochem van Rosmalen <git@yochem.nl> | 2026-03-23 23:48:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-23 18:48:03 -0400 |
| commit | f29b3b5d458b18282b405eb566386ab4b350ded5 (patch) | |
| tree | 526beddb8377445e2ca13c02a4cfa7533aa84861 /scripts/lintcommit.lua | |
| parent | 7c3df3e2ea1390731e5fac5411e3ad7e1de4a3d0 (diff) | |
| download | rneovim-f29b3b5d458b18282b405eb566386ab4b350ded5.tar.gz rneovim-f29b3b5d458b18282b405eb566386ab4b350ded5.tar.bz2 rneovim-f29b3b5d458b18282b405eb566386ab4b350ded5.zip | |
feat(net): vim.net.request(outbuf) writes response to buffer #36164
Problem:
Non-trivial to write output of vim.net.request to buffer. Requires extra
code in plugin/net.lua which can't be reused by other plugin authors.
```
vim.net.request('https://neovim.io', {}, function(err, res)
if not err then
local buf = vim.api.nvim_create_buf(true, false)
if res then
local lines = vim.split(res.body, '\n', { plain = true })
vim.api.nvim_buf_set_lines(buf, 0, -1, true, lines)
end
end
end)
```
Solution:
Accept an optional `outbuf` argument to indicate the buffer to write output
to, similar to `outpath`.
vim.net.request('https://neovim.io', { outbuf = buf })
Other fixes / followups:
- Make plugin/net.lua smaller
- Return objection with close() method
- vim.net.request.Opts class
- vim.validate single calls
- Use (''):format(...) instead of `..`
Diffstat (limited to 'scripts/lintcommit.lua')
0 files changed, 0 insertions, 0 deletions