Skip to content

Commit b18329c

Browse files
committed
change format of config in meta/3rd
#1607
1 parent 2790486 commit b18329c

File tree

10 files changed

+76
-118
lines changed

10 files changed

+76
-118
lines changed

meta/3rd/Cocos4.0/config.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name = 'Cocos'
22
files = {'cocos'}
3-
configs = {
4-
{
5-
key = 'Lua.runtime.version',
6-
action = 'set',
7-
value = 'LuaJIT',
8-
},
3+
config = {
4+
["Lua.runtime.version"] = "LuaJIT",
95
}

meta/3rd/Defold/config.lua

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,20 @@
11
name = 'Defold'
22
files = {'game.project', '*%.script', '*%.gui_script'}
3-
configs = {
4-
{
5-
key = 'Lua.runtime.version',
6-
action = 'set',
7-
value = 'Lua 5.1',
8-
},
9-
{
10-
key = 'Lua.workspace.library',
11-
action = 'set',
12-
value = {".internal"},
13-
},
14-
{
15-
key = 'Lua.workspace.ignoreDir',
16-
action = 'set',
17-
value = {".internal"},
18-
},
19-
{
20-
key = 'Lua.diagnostics.globals',
21-
action = 'set',
22-
value = {
23-
"on_input",
24-
"on_message",
25-
"init",
26-
"update",
27-
"final"
28-
},
29-
},
30-
{
31-
key = 'files.associations',
32-
action = 'set',
33-
value = {
34-
["*.script"] = "lua",
35-
["*.gui_script"] = "lua",
36-
["*.render_script"] = "lua",
37-
["*.editor_script"] = "lua"
38-
}
3+
config = {
4+
["Lua.runtime.version"] = "Lua 5.1",
5+
["Lua.workspace.library"] = {".internal"},
6+
["Lua.workspace.ignoreDir"] = {".internal"},
7+
["Lua.diagnostics.globals"] = {
8+
"on_input",
9+
"on_message",
10+
"init",
11+
"update",
12+
"final",
3913
},
14+
["files.associations"] = {
15+
["*.script"] = "lua",
16+
["*.gui_script"] = "lua",
17+
["*.render_script"] = "lua",
18+
["*.editor_script"] = "lua",
19+
}
4020
}

meta/3rd/Jass/config.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
words = {'jass%.common'}
2-
configs = {
3-
{
4-
name = 'Lua.runtime.version',
5-
type = 'set',
6-
value = 'Lua 5.3',
7-
},
2+
config = {
3+
["Lua.runtime.version"] = "Lua 5.3",
84
}

meta/3rd/OpenResty/config.lua

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@ words = {
1111
'ngx%.%w+',
1212
}
1313

14-
configs = {
15-
{
16-
key = 'Lua.runtime.version',
17-
action = 'set',
18-
value = 'LuaJIT',
19-
},
20-
{
21-
key = 'Lua.diagnostics.globals',
22-
action = 'add',
23-
value = 'ngx',
14+
config = {
15+
["Lua.runtime.version"] = "LuaJIT",
16+
["Lua.diagnostics.globals"] = {
17+
"ngx",
2418
},
2519
}

meta/3rd/busted/config.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
configs = {
2-
{
3-
key = "Lua.workspace.library",
4-
action = "add",
5-
value = "${3rd}/luassert/library",
6-
},
1+
config = {
2+
["Lua.workspace.library"] = {
3+
"${3rd}/luassert/library"
4+
}
75
}

meta/3rd/example/config.lua

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,16 @@ words = {'thisIsAnExampleWord%.ifItExistsInFile%.thenTryLoadThisLibrary'}
55
-- list or matched file names. `.lua`, `.dll` and `.so` only
66
files = {'thisIsAnExampleFile%.ifItExistsInWorkSpace%.thenTryLoadThisLibrary%.lua'}
77
-- lsit of settings to be changed
8-
configs = {
9-
{
10-
key = 'Lua.runtime.version',
11-
action = 'set',
12-
value = 'LuaJIT',
8+
config = {
9+
["Lua.runtime.version"] = "LuaJIT",
10+
["Lua.diagnostics.globals"] = {
11+
"global1",
12+
"global2",
1313
},
14-
{
15-
key = 'Lua.diagnostics.globals',
16-
action = 'add',
17-
value = 'global1',
14+
["Lua.runtime.special"] = {
15+
["include"] = "require",
1816
},
19-
{
20-
key = 'Lua.runtime.special',
21-
action = 'prop',
22-
prop = 'include',
23-
value = 'require',
24-
},
25-
{
26-
key = 'Lua.runtime.builtin',
27-
action = 'prop',
28-
prop = 'io',
29-
value = 'disable',
17+
["Lua.runtime.builtin"] = {
18+
["io"] = "disable",
3019
},
3120
}
32-
for _, name in ipairs {'global2', 'global3', 'global4'} do
33-
configs[#configs+1] = {
34-
key = 'Lua.diagnostics.globals',
35-
action = 'add',
36-
value = name,
37-
}
38-
end

meta/3rd/lfs/config.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name = 'luafilesystem'
22
words = { 'require[%s%(\"\']+lfs[%)\"\']' }
3-
configs = {
4-
{
5-
key = 'Lua.diagnostics.globals',
6-
action = 'add',
7-
value = 'lfs',
3+
config = {
4+
["Lua.diagnostics.globals"] = {
5+
"lfs",
86
},
97
}

meta/3rd/love2d/config.lua

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name = 'LÖVE'
22
words = {'love%.%w+'}
3-
configs = {
4-
{
5-
key = 'Lua.runtime.version',
6-
action = 'set',
7-
value = 'LuaJIT',
8-
},
9-
}
3+
config = {
4+
["Lua.runtime.version"] = "LuaJIT",
5+
}

meta/3rd/lovr/config.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name = 'LÖVR'
22
words = {'lovr%.%w+'}
3-
configs = {
4-
{
5-
key = 'Lua.runtime.version',
6-
action = 'set',
7-
value = 'LuaJIT',
8-
},
3+
config = {
4+
["Lua.runtime.version"] = "LuaJIT",
95
}

script/library.lua

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,37 @@ end
352352

353353
local function apply3rd(uri, cfg, onlyMemory)
354354
local changes = {}
355-
if cfg.configs then
356-
for _, change in ipairs(cfg.configs) do
357-
changes[#changes+1] = {
358-
key = change.key,
359-
action = change.action,
360-
prop = change.prop,
361-
value = change.value,
362-
uri = uri,
363-
}
355+
if cfg.config then
356+
for key, value in pairs(cfg.config) do
357+
if type(value) == 'table' then
358+
if #value == 0 then
359+
for k, v in pairs(value) do
360+
changes[#changes+1] = {
361+
key = key,
362+
action = 'prop',
363+
prop = k,
364+
value = v,
365+
uri = uri,
366+
}
367+
end
368+
else
369+
for _, v in ipairs(value) do
370+
changes[#changes+1] = {
371+
key = key,
372+
action = 'add',
373+
value = v,
374+
uri = uri,
375+
}
376+
end
377+
end
378+
else
379+
changes[#changes+1] = {
380+
key = key,
381+
action = 'set',
382+
value = value,
383+
uri = uri,
384+
}
385+
end
364386
end
365387
end
366388

0 commit comments

Comments
 (0)