Skip to content

Commit 7ab1007

Browse files
fix: minor type issues
1 parent fed6d4a commit 7ab1007

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

lua/rest-nvim/client/curl/cli.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ local progress = require("fidget.progress")
2121
---@param on_exit fun(sc: vim.SystemCompleted) Called asynchronously when the luarocks command exits. asynchronously. Receives SystemCompleted object, see return of SystemObj:wait().
2222
---@param opts? vim.SystemOpts
2323
---@package
24-
---@diagnostic disable-next-line: unused-local
25-
function curl.cli(args, on_exit, opts) end
26-
27-
curl.cli = nio.create(function(args, on_exit, opts)
24+
function curl.cli(args, on_exit, opts)
2825
opts = opts or {}
2926
opts.detach = false
3027
opts.text = true
@@ -43,7 +40,7 @@ curl.cli = nio.create(function(args, on_exit, opts)
4340
}
4441
on_exit(sc)
4542
end
46-
end, 3)
43+
end
4744

4845
---@private
4946
local parser = {}

lua/rest-nvim/parser/init.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ end
235235
---failed.
236236
---@param node TSNode Tree-sitter request node
237237
---@param source Source
238-
---@param context? rest.Context
238+
---@param ctx? rest.Context
239239
---@return rest.Request|nil
240-
function M.parse(node, source, context)
240+
function M.parse(node, source, ctx)
241241
assert(node:type() == "section")
242-
context = context or Context:new()
242+
ctx = ctx or Context:new()
243243
-- request should not include error
244244
if node:has_error() then
245245
logger.error(utils.ts_node_error_log(node))
@@ -253,7 +253,7 @@ function M.parse(node, source, context)
253253
local body
254254
local body_node = req_node:field("body")[1]
255255
if body_node then
256-
body = M.parse_body(body_node, source, context)
256+
body = M.parse_body(body_node, source, ctx)
257257
if not body then
258258
logger.error("parsing body failed")
259259
return nil
@@ -266,7 +266,7 @@ function M.parse(node, source, context)
266266
end
267267
local url = expand_variables(
268268
assert(get_node_field_text(req_node, "url", source)),
269-
context,
269+
ctx,
270270
config.encode_url and utils.escape or nil
271271
)
272272

@@ -275,17 +275,17 @@ function M.parse(node, source, context)
275275
for child, _ in node:iter_children() do
276276
local node_type = child:type()
277277
if node_type == "pre_request_script" then
278-
M.parse_pre_request_script(child, source, context)
278+
M.parse_pre_request_script(child, source, ctx)
279279
elseif node_type == "res_handler_script" then
280-
table.insert(handlers, M.parse_request_handler(child, source, context))
280+
table.insert(handlers, M.parse_request_handler(child, source, ctx))
281281
elseif node_type == "request_separator" then
282282
name = get_node_field_text(child, "value", source)
283283
elseif node_type == "comment" and get_node_field_text(child, "name", source) == "name" then
284284
name = get_node_field_text(child, "value", source) or name
285285
end
286286
end
287287

288-
local headers = parse_headers(req_node, source, context)
288+
local headers = parse_headers(req_node, source, ctx)
289289
-- HACK: check if url doesn't have host
290290
if headers["host"] and url[1] == "/" then
291291
url = headers["host"]..url
@@ -294,7 +294,7 @@ function M.parse(node, source, context)
294294
---@type rest.Request
295295
return {
296296
name = name,
297-
context = context,
297+
context = ctx,
298298
method = method,
299299
url = url,
300300
http_version = get_node_field_text(req_node, "version", source),

lua/rest-nvim/ui/panes.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---@mod rest-nvim.ui.panes Small internal library to create pane style window
22

3-
local utils = require("rest-nvim.utils")
4-
53
---@class rest.ui.panes.Pane
64
---@field name string
75
---@field bufnr number

0 commit comments

Comments
 (0)