summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-09 11:46:48 +0800
committersumneko <sumneko@hotmail.com>2019-04-09 11:46:48 +0800
commit035d88af85a343c234d50a646835d55e1277d602 (patch)
treedbd9484648c1c1d0ac92689ccfc4dff8644fa4a5 /server
parent2dd91ba29a26b2b4fc7f07def2b3edbb962248d9 (diff)
downloadlua-language-server-035d88af85a343c234d50a646835d55e1277d602.zip
库函数以函数为参数时,立即跑一边传入的函数
Diffstat (limited to 'server')
-rw-r--r--server/main.lua2
-rw-r--r--server/src/service.lua2
-rw-r--r--server/src/vm/vm.lua14
3 files changed, 16 insertions, 2 deletions
diff --git a/server/main.lua b/server/main.lua
index dd0c53d3..1895f804 100644
--- a/server/main.lua
+++ b/server/main.lua
@@ -21,7 +21,7 @@ local function tryDebugger()
log.info('Debugger startup, listen port: 11411')
end
-pcall(tryDebugger)
+--pcall(tryDebugger)
require 'utility'
require 'global_protect'
diff --git a/server/src/service.lua b/server/src/service.lua
index bd8f1216..5b7465d3 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -359,7 +359,7 @@ function mt:compileAst(obj)
log.debug(message)
rpc:notify('window/showMessage', {
type = 3,
- message = lang.script('PARSER_CRASH', err:match 'grammar%.lua%:%d+%:(.+)' or err),
+ message = lang.script('PARSER_CRASH', err:match '%.lua%:%d+%:(.+)' or err),
})
if message:find 'not enough memory' then
self:restartDueToMemoryLeak()
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index 2a223d42..dfdac390 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -278,6 +278,20 @@ function mt:callLibrary(func, values, source, lib)
elseif lib.special == 'seeall' then
self:callSeeAll(func, values)
end
+ else
+ -- 如果lib的参数中有function,则立即执行function
+ if lib.args then
+ local args
+ for i = 1, #lib.args do
+ local value = values[i]
+ if value and value:getFunction() then
+ if not args then
+ args = createMulti()
+ end
+ self:call(value, args, source)
+ end
+ end
+ end
end
end