Skip to content

Commit 09143ad

Browse files
author
Matthieu Coudron
committed
feat: move highlight option to per-query options
1 parent 8373dcd commit 09143ad

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lua/rest-nvim/init.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,19 @@ rest.run_file = function(filename, opts)
5555
return true
5656
end
5757

58+
59+
-- run will retrieve the required request information from the current buffer
60+
-- and then execute curl
61+
-- @param req table see validate_request to check the expected format
62+
-- @param opts table
63+
-- 1. keep_going boolean keep running even when last request failed
5864
rest.run_request = function(req, opts)
5965
local result = req
6066
opts = vim.tbl_deep_extend(
6167
"force", -- use value from rightmost map
62-
{ verbose = false }, -- defaults
68+
{ verbose = false,
69+
highlight = false
70+
}, -- defaults
6371
opts or {}
6472
)
6573

@@ -83,7 +91,7 @@ rest.run_request = function(req, opts)
8391
LastOpts = Opts
8492
end
8593

86-
if config.get("highlight").enabled then
94+
if opts.highlight then
8795
request.highlight(result.bufnr, result.start_line, result.end_line)
8896
end
8997

0 commit comments

Comments
 (0)