diff options
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/config.lua | 6 | ||||
-rw-r--r-- | server/src/constant/DiagnosticDefaultSeverity.lua | 16 | ||||
-rw-r--r-- | server/src/constant/DiagnosticSeverity.lua | 6 | ||||
-rw-r--r-- | server/src/core/diagnostics.lua | 8 |
4 files changed, 29 insertions, 7 deletions
diff --git a/server/src/config.lua b/server/src/config.lua index 27d4f36a..176e3ce9 100644 --- a/server/src/config.lua +++ b/server/src/config.lua @@ -1,3 +1,5 @@ +local DiagnosticDefaultSeverity = require 'constant.DiagnosticDefaultSeverity' + local function Boolean(v) if type(v) == 'boolean' then return true, v @@ -90,6 +92,10 @@ local ConfigTemplate = { diagnostics = { globals = {{}, Str2Hash ';'}, disable = {{}, Str2Hash ';'}, + severity = { + table.deepCopy(DiagnosticDefaultSeverity), + Hash(String, String), + }, }, workspace = { ignoreDir = {{}, Str2Hash ';'}, diff --git a/server/src/constant/DiagnosticDefaultSeverity.lua b/server/src/constant/DiagnosticDefaultSeverity.lua new file mode 100644 index 00000000..bc685cf2 --- /dev/null +++ b/server/src/constant/DiagnosticDefaultSeverity.lua @@ -0,0 +1,16 @@ +return { + ['unused-local'] = 'Hint', + ['undefined-global'] = 'Warning', + ['unused-label'] = 'Hint', + ['trailing-space'] = 'Hint', + ['redefined-local'] = 'Hint', + ['newline-call'] = 'Information', + ['redundant-parameter'] = 'Information', + ['ambiguity-1'] = 'Warning', + ['lowercase-global'] = 'Information', + ['undefined-env-child'] = 'Information', + ['duplicate-index'] = 'Warning', + ['empty-block'] = 'Information', + ['redundant-value'] = 'Information', + ['emmy-lua'] = 'Warning', +} diff --git a/server/src/constant/DiagnosticSeverity.lua b/server/src/constant/DiagnosticSeverity.lua new file mode 100644 index 00000000..05bd3659 --- /dev/null +++ b/server/src/constant/DiagnosticSeverity.lua @@ -0,0 +1,6 @@ +return { + Error = 1, + Warning = 2, + Information = 3, + Hint = 4, +} diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua index 828ee1fe..9b6a8c45 100644 --- a/server/src/core/diagnostics.lua +++ b/server/src/core/diagnostics.lua @@ -2,13 +2,7 @@ local lang = require 'language' local config = require 'config' local library = require 'core.library' local buildGlobal = require 'vm.global' - -local DiagnosticSeverity = { - Error = 1, - Warning = 2, - Information = 3, - Hint = 4, -} +local DiagnosticSeverity = require 'constant.DiagnosticSeverity' local mt = {} mt.__index = mt |