Skip to content

Commit

Permalink
feat: move highlight option to per-query options
Browse files Browse the repository at this point in the history
  • Loading branch information
teto committed Jul 6, 2023
1 parent 8373dcd commit 09143ad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lua/rest-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ rest.run_file = function(filename, opts)
return true
end


-- run will retrieve the required request information from the current buffer
-- and then execute curl
-- @param req table see validate_request to check the expected format
-- @param opts table
-- 1. keep_going boolean keep running even when last request failed
rest.run_request = function(req, opts)
local result = req
opts = vim.tbl_deep_extend(
"force", -- use value from rightmost map
{ verbose = false }, -- defaults
{ verbose = false,
highlight = false
}, -- defaults
opts or {}
)

Expand All @@ -83,7 +91,7 @@ rest.run_request = function(req, opts)
LastOpts = Opts
end

if config.get("highlight").enabled then
if opts.highlight then
request.highlight(result.bufnr, result.start_line, result.end_line)
end

Expand Down

0 comments on commit 09143ad

Please sign in to comment.