Skip to content

Commit

Permalink
Make default luacheck settings overridable
Browse files Browse the repository at this point in the history
  • Loading branch information
vlaaad committed May 15, 2024
1 parent bf4bbaa commit 2e417f3
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions script/core/diagnostics/luacheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e417f3

Please sign in to comment.