summaryrefslogtreecommitdiff
path: root/server-beta/src/core/diagnostics/duplicate-index.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/duplicate-index.lua
parent444851fc1adb2fe3a0f952807cb4b644e18790c1 (diff)
downloadlua-language-server-fe9dfabffeb6460f41c9f74fbeb4093db67bed4a.zip
修正一些bug
Diffstat (limited to 'server-beta/src/core/diagnostics/duplicate-index.lua')
-rw-r--r--server-beta/src/core/diagnostics/duplicate-index.lua68
1 files changed, 34 insertions, 34 deletions
diff --git a/server-beta/src/core/diagnostics/duplicate-index.lua b/server-beta/src/core/diagnostics/duplicate-index.lua
index 8ebe0dee..76b1c958 100644
--- a/server-beta/src/core/diagnostics/duplicate-index.lua
+++ b/server-beta/src/core/diagnostics/duplicate-index.lua
@@ -9,8 +9,8 @@ return function (uri, callback)
return
end
- local mark = {}
guide.eachSourceType(ast.ast, 'table', function (source)
+ local mark = {}
for _, obj in ipairs(source) do
if obj.type == 'tablefield'
or obj.type == 'tableindex' then
@@ -23,40 +23,40 @@ return function (uri, callback)
end
end
end
- end)
- for name, defs in pairs(mark) do
- local sname = name:match '^.|(.+)$'
- if #defs > 1 and sname then
- local related = {}
- for i = 1, #defs do
- local def = defs[i]
- related[i] = {
- start = def.start,
- finish = def.finish,
- uri = uri,
- }
- end
- for i = 1, #defs - 1 do
- local def = defs[i]
- callback {
- start = def.start,
- finish = def.finish,
- related = related,
- message = lang.script('DIAG_DUPLICATE_INDEX', sname),
- level = define.DiagnosticSeverity.Hint,
- tags = { define.DiagnosticTag.Unnecessary },
- }
- end
- for i = #defs, #defs do
- local def = defs[i]
- callback {
- start = def.start,
- finish = def.finish,
- related = related,
- message = lang.script('DIAG_DUPLICATE_INDEX', sname),
- }
+ for name, defs in pairs(mark) do
+ local sname = name:match '^.|(.+)$'
+ if #defs > 1 and sname then
+ local related = {}
+ for i = 1, #defs do
+ local def = defs[i]
+ related[i] = {
+ start = def.start,
+ finish = def.finish,
+ uri = uri,
+ }
+ end
+ for i = 1, #defs - 1 do
+ local def = defs[i]
+ callback {
+ start = def.start,
+ finish = def.finish,
+ related = related,
+ message = lang.script('DIAG_DUPLICATE_INDEX', sname),
+ level = define.DiagnosticSeverity.Hint,
+ tags = { define.DiagnosticTag.Unnecessary },
+ }
+ end
+ for i = #defs, #defs do
+ local def = defs[i]
+ callback {
+ start = def.start,
+ finish = def.finish,
+ related = related,
+ message = lang.script('DIAG_DUPLICATE_INDEX', sname),
+ }
+ end
end
end
- end
+ end)
end