From a21331d225db1f77919538a2c3a0fdf69bf6de2e Mon Sep 17 00:00:00 2001 From: mace Date: Sun, 11 Oct 2026 14:13:03 +0200 Subject: [PATCH] fix rest.nvim setup --- lua/custom/plugins/init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 260fa2e..9ef31ae 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -94,6 +94,22 @@ return { { -- HTTP REST-Client Interface 'rest-nvim/rest.nvim', + -- The tree-sitter-http rock needs a luarocks build backend inside the hererocks tree, + -- but lazy installs it into the plugin's own tree where luarocks can't find it. + -- Done in `init` because overriding `build` breaks lazy's rockspec handling; lazy + -- retries the failed rockspec build on the next start once the backend is there. + init = function() + local hererocks = require('lazy.core.config').options.rocks.root .. '/hererocks' + local luarocks = hererocks .. '/bin/luarocks' + local backend = hererocks .. '/share/lua/5.1/luarocks/build/treesitter-parser.lua' + if vim.fn.executable(luarocks) == 0 or vim.uv.fs_stat(backend) then + return + end + local result = vim.system({ luarocks, 'install', 'luarocks-build-treesitter-parser' }):wait() + if result.code ~= 0 then + vim.notify('rest.nvim: installing treesitter build backend failed\n' .. result.stderr, vim.log.levels.ERROR) + end + end, }, --- diff view ---