From 2e417f3ca9dc6e6ff1ed7708cf9d802e18581944 Mon Sep 17 00:00:00 2001 From: Vlad Protsenko Date: Wed, 15 May 2024 13:34:21 +0200 Subject: [PATCH] Make default luacheck settings overridable --- script/core/diagnostics/luacheck.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/script/core/diagnostics/luacheck.lua b/script/core/diagnostics/luacheck.lua index 541899565..4e8ff0f00 100644 --- a/script/core/diagnostics/luacheck.lua +++ b/script/core/diagnostics/luacheck.lua @@ -43,24 +43,29 @@ return function (uri, callback) local global_path = nil local config = lcconfig.load_config(path, global_path) or {options={stds={},files={},globals={}}} - -- get editor provided globals - local editor_config = { + local editor_defaults = { options = { - stds = {}, - files = {}, + unused_args = false, + max_line_length = false, ignore = { - "212", -- unused args "611", -- line contains only whitespace "612", -- line contains trailing whitespace "614", -- trailing whitespace in a comment - "631" -- line is too long }, + } + } + + -- get editor provided globals + local editor_config = { + options = { + stds = {}, + files = {}, globals = lspconfig.get(workspace.rootUri, 'Lua.diagnostics.globals') or {}, } } -- create final config stack combining LuaCheck config, Defold globals and editor globals - config_stack = lcconfig.stack_configs({ config, editor_config }) + config_stack = lcconfig.stack_configs({ editor_defaults, config, editor_config }) end local text = files.getText(uri)