summaryrefslogtreecommitdiff
path: root/server/src/core/diagnostics.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core/diagnostics.lua')
-rw-r--r--server/src/core/diagnostics.lua33
1 files changed, 21 insertions, 12 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua
index a6672c0b..6a87a25b 100644
--- a/server/src/core/diagnostics.lua
+++ b/server/src/core/diagnostics.lua
@@ -1,4 +1,5 @@
local lang = require 'language'
+local config = require 'config'
local DiagnosticSeverity = {
Error = 1,
@@ -40,6 +41,9 @@ local function searchUndefinedGlobal(results, callback)
if type(index) ~= 'string' then
goto NEXT_VAR
end
+ if config.config.diagnostics.globals[index] then
+ goto NEXT_VAR
+ end
local lIndex = index:lower()
if lIndex == 'log' or lIndex == 'arg' or lIndex == '' then
goto NEXT_VAR
@@ -97,25 +101,30 @@ local function searchSpaces(vm, lines, callback)
for i = 1, #lines do
local line = lines:line(i)
- if line:find '^[ \t]+$' then
- local start, finish = lines:range(i)
- if isInString(vm, start, finish) then
+ if config.config.diagnostics.spaceOnlyLine then
+ if line:find '^[ \t]+$' then
+ local start, finish = lines:range(i)
+ if isInString(vm, start, finish) then
+ goto NEXT_LINE
+ end
+ callback(start, finish, lang.script.DIAG_LINE_ONLY_SPACE)
goto NEXT_LINE
end
- callback(start, finish, lang.script.DIAG_LINE_ONLY_SPACE)
- goto NEXT_LINE
end
- local pos = line:find '[ \t]+$'
- if pos then
- local start, finish = lines:range(i)
- start = start + pos - 1
- if isInString(vm, start, finish) then
+ if config.config.diagnostics.postSpcae then
+ local pos = line:find '[ \t]+$'
+ if pos then
+ local start, finish = lines:range(i)
+ start = start + pos - 1
+ if isInString(vm, start, finish) then
+ goto NEXT_LINE
+ end
+ callback(start, finish, lang.script.DIAG_LINE_POST_SPACE)
goto NEXT_LINE
end
- callback(start, finish, lang.script.DIAG_LINE_POST_SPACE)
- goto NEXT_LINE
end
+
::NEXT_LINE::
end
end