summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/newline-call.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/core/diagnostics/newline-call.lua')
-rw-r--r--script/core/diagnostics/newline-call.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/script/core/diagnostics/newline-call.lua b/script/core/diagnostics/newline-call.lua
index c2c8bd66..807f76a2 100644
--- a/script/core/diagnostics/newline-call.lua
+++ b/script/core/diagnostics/newline-call.lua
@@ -3,8 +3,9 @@ local guide = require 'core.guide'
local lang = require 'language'
return function (uri, callback)
- local ast = files.getAst(uri)
+ local ast = files.getAst(uri)
local lines = files.getLines(uri)
+ local text = files.getText(uri)
if not ast or not lines then
return
end
@@ -20,6 +21,10 @@ return function (uri, callback)
if not source.next then
return
end
+ if text:sub(args.start, args.start) ~= '('
+ or text:sub(args.finish, args.finish) ~= ')' then
+ return
+ end
local nodeRow = guide.positionOf(lines, node.finish)
local argRow = guide.positionOf(lines, args.start)
@@ -29,9 +34,9 @@ return function (uri, callback)
if #args == 1 then
callback {
- start = args.start,
+ start = node.start,
finish = args.finish,
- message = lang.script.DIAG_PREVIOUS_CALL,
+ message = lang.script('DIAG_PREVIOUS_CALL', text:sub(node.start, node.finish), text:sub(args.start, args.finish)),
}
end
end)