diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-08 11:51:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-08 11:51:49 +0800 |
commit | fe9dfabffeb6460f41c9f74fbeb4093db67bed4a (patch) | |
tree | ae793962f1ff0d08929f4393f877dedc997fda46 /server-beta/src/core/diagnostics/newfield-call.lua | |
parent | 444851fc1adb2fe3a0f952807cb4b644e18790c1 (diff) | |
download | lua-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.lua | 24 |
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 |