summaryrefslogtreecommitdiff
path: root/server-beta/src/core/diagnostics/newfield-call.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-08 11:51:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-08 11:51:49 +0800
commitfe9dfabffeb6460f41c9f74fbeb4093db67bed4a (patch)
treeae793962f1ff0d08929f4393f877dedc997fda46 /server-beta/src/core/diagnostics/newfield-call.lua
parent444851fc1adb2fe3a0f952807cb4b644e18790c1 (diff)
downloadlua-language-server-fe9dfabffeb6460f41c9f74fbeb4093db67bed4a.zip
修正一些bug
Diffstat (limited to 'server-beta/src/core/diagnostics/newfield-call.lua')
-rw-r--r--server-beta/src/core/diagnostics/newfield-call.lua24
1 files changed, 13 insertions, 11 deletions
diff --git a/server-beta/src/core/diagnostics/newfield-call.lua b/server-beta/src/core/diagnostics/newfield-call.lua
index 87ece955..75681cbc 100644
--- a/server-beta/src/core/diagnostics/newfield-call.lua
+++ b/server-beta/src/core/diagnostics/newfield-call.lua
@@ -17,17 +17,19 @@ return function (uri, callback)
if field.type == 'call' then
local func = field.node
local args = field.args
- local funcLine = guide.positionOf(lines, func.finish)
- local argsLine = guide.positionOf(lines, args.start)
- if argsLine > funcLine then
- callback {
- start = field.start,
- finish = field.finish,
- message = lang.script('DIAG_PREFIELD_CALL'
- , text:sub(func.start, func.finish)
- , text:sub(args.start, args.finish)
- )
- }
+ if args then
+ local funcLine = guide.positionOf(lines, func.finish)
+ local argsLine = guide.positionOf(lines, args.start)
+ if argsLine > funcLine then
+ callback {
+ start = field.start,
+ finish = field.finish,
+ message = lang.script('DIAG_PREFIELD_CALL'
+ , text:sub(func.start, func.finish)
+ , text:sub(args.start, args.finish)
+ )
+ }
+ end
end
end
end