Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Fix luacheck issues (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Nov 29, 2019
1 parent c10c0b7 commit af24091
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Don't report unused self arguments of methods.
self = false

ignore = {
"212/_.*", -- unused argument, for vars with "_" prefix
}

-- vim: ft=lua tw=80 sw=2 et
8 changes: 4 additions & 4 deletions nvim/msgpack_rpc_stream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function MsgpackRpcStream.new(stream)
_session = mpack.Session({
unpack = mpack.Unpacker({
ext = {
[0] = function(c, s) return Buffer.new(mpack.unpack(s)) end,
[1] = function(c, s) return Window.new(mpack.unpack(s)) end,
[2] = function(c, s) return Tabpage.new(mpack.unpack(s)) end
[0] = function(_c, s) return Buffer.new(mpack.unpack(s)) end,
[1] = function(_c, s) return Window.new(mpack.unpack(s)) end,
[2] = function(_c, s) return Tabpage.new(mpack.unpack(s)) end
}
})
}),
Expand All @@ -76,7 +76,7 @@ function MsgpackRpcStream:read_start(request_cb, notification_cb, eof_cb)
if not data then
return eof_cb()
end
local type, id_or_cb
local type, id_or_cb, method_or_error, args_or_result
local pos = 1
local len = #data
while pos <= len do
Expand Down
12 changes: 6 additions & 6 deletions nvim/session.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('coxpcall')
local coxpcall = require('coxpcall')
local uv = require('luv')
local MsgpackRpcStream = require('nvim.msgpack_rpc_stream')

Expand Down Expand Up @@ -30,7 +30,7 @@ local function coroutine_exec(func, ...)
end

resume(coroutine.create(function()
local status, result, flag = copcall(func, unpack(args))
local status, result, flag = coxpcall.pcall(func, unpack(args))
if on_complete then
coroutine.yield(function()
-- run the completion callback on the main thread
Expand Down Expand Up @@ -148,12 +148,12 @@ end
function Session:_blocking_request(method, args)
local err, result

local function on_request(method, args, response)
table.insert(self._pending_messages, {'request', method, args, response})
local function on_request(method_, args_, response)
table.insert(self._pending_messages, {'request', method_, args_, response})
end

local function on_notification(method, args)
table.insert(self._pending_messages, {'notification', method, args})
local function on_notification(method_, args_)
table.insert(self._pending_messages, {'notification', method_, args_})
end

self._msgpack_rpc_stream:write(method, args, function(e, r)
Expand Down
4 changes: 2 additions & 2 deletions test/session_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ do
socket_file = string.format("/tmp/nvim.socket-%d", math.random(1000,9999))
end

function test_session(description, session_factory, session_destroy)
local function test_session(description, session_factory, session_destroy)
local get_api_info = function (session)
local ok, res = session:request('vim_get_api_info')
return ok, unpack(res)
Expand Down Expand Up @@ -112,7 +112,7 @@ function test_session(description, session_factory, session_destroy)
local requested = 0
local _, channel_id, _ = get_api_info(session)

local function on_request(method, args)
local function on_request(method)
assert.are.same("method", method)
requested = requested + 1
if requested < 10 then
Expand Down

0 comments on commit af24091

Please sign in to comment.