summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-30 14:43:24 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-30 14:43:24 +0800
commit4e05002a2abf4947903ff047f100e921fee5799e (patch)
tree227110befecf7b5f073f578c17944a440c734ba2 /script
parent744ce5d0a5a307ab7f100a2f76e934bbaf05a499 (diff)
downloadlua-language-server-4e05002a2abf4947903ff047f100e921fee5799e.zip
cleanup
Diffstat (limited to 'script')
-rw-r--r--script/brave/work.lua2
-rw-r--r--script/jsonrpc.lua4
-rw-r--r--script/proto/proto.lua10
3 files changed, 8 insertions, 8 deletions
diff --git a/script/brave/work.lua b/script/brave/work.lua
index 7af36fda..24debe83 100644
--- a/script/brave/work.lua
+++ b/script/brave/work.lua
@@ -8,7 +8,7 @@ local thread = require 'bee.thread'
brave.on('loadProto', function ()
local jsonrpc = require 'jsonrpc'
while true do
- local proto, err = jsonrpc.decode(io.read, log.error)
+ local proto, err = jsonrpc.decode(io.read)
--log.debug('loaded proto', proto.method)
if not proto then
brave.push('protoerror', err)
diff --git a/script/jsonrpc.lua b/script/jsonrpc.lua
index 8b8be6f2..583bb6e2 100644
--- a/script/jsonrpc.lua
+++ b/script/jsonrpc.lua
@@ -37,8 +37,8 @@ local function readProtoHead(reader)
return head
end
-function m.decode(reader, errHandle)
- local head, err = readProtoHead(reader, errHandle)
+function m.decode(reader)
+ local head, err = readProtoHead(reader)
if not head then
return nil, err
end
diff --git a/script/proto/proto.lua b/script/proto/proto.lua
index 6010ef19..e380f54f 100644
--- a/script/proto/proto.lua
+++ b/script/proto/proto.lua
@@ -38,7 +38,7 @@ function m.response(id, res)
data.result = res == nil and json.null or res
local buf = jsonrpc.encode(data)
--log.debug('Response', id, #buf)
- io.stdout:write(buf)
+ io.write(buf)
end
function m.responseErr(id, code, message)
@@ -56,7 +56,7 @@ function m.responseErr(id, code, message)
}
}
--log.debug('ResponseErr', id, #buf)
- io.stdout:write(buf)
+ io.write(buf)
end
function m.notify(name, params)
@@ -65,7 +65,7 @@ function m.notify(name, params)
params = params,
}
--log.debug('Notify', name, #buf)
- io.stdout:write(buf)
+ io.write(buf)
end
function m.awaitRequest(name, params)
@@ -76,7 +76,7 @@ function m.awaitRequest(name, params)
params = params,
}
--log.debug('Request', name, #buf)
- io.stdout:write(buf)
+ io.write(buf)
local result, error = await.wait(function (resume)
m.waiting[id] = resume
end)
@@ -94,7 +94,7 @@ function m.request(name, params, callback)
params = params,
}
--log.debug('Request', name, #buf)
- io.stdout:write(buf)
+ io.write(buf)
m.waiting[id] = function (result, error)
if error then
log.warn(('Response of [%s] error [%d]: %s'):format(name, error.code, error.message))