summaryrefslogtreecommitdiff
path: root/script-beta/src/core/diagnostics/redundant-value.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/src/core/diagnostics/redundant-value.lua')
-rw-r--r--script-beta/src/core/diagnostics/redundant-value.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/script-beta/src/core/diagnostics/redundant-value.lua b/script-beta/src/core/diagnostics/redundant-value.lua
new file mode 100644
index 00000000..be483448
--- /dev/null
+++ b/script-beta/src/core/diagnostics/redundant-value.lua
@@ -0,0 +1,24 @@
+local files = require 'files'
+local define = require 'proto.define'
+local lang = require 'language'
+
+return function (uri, callback, code)
+ local ast = files.getAst(uri)
+ if not ast then
+ return
+ end
+
+ local diags = ast.diags[code]
+ if not diags then
+ return
+ end
+
+ for _, info in ipairs(diags) do
+ callback {
+ start = info.start,
+ finish = info.finish,
+ tags = { define.DiagnosticTag.Unnecessary },
+ message = lang.script('DIAG_OVER_MAX_VALUES', info.max, info.passed)
+ }
+ end
+end