summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-23 17:24:51 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-23 17:24:51 +0800
commitb18329cea47f2de9c50abefecaccf248c16aa398 (patch)
treeea5db094a4c1671b6df6bf0691c976880ba0c505
parent2790486d9176170f879f83e363341cc33cfc41c5 (diff)
downloadlua-language-server-b18329cea47f2de9c50abefecaccf248c16aa398.zip
change format of `config` in `meta/3rd`
#1607
-rw-r--r--meta/3rd/Cocos4.0/config.lua8
-rw-r--r--meta/3rd/Defold/config.lua52
-rw-r--r--meta/3rd/Jass/config.lua8
-rw-r--r--meta/3rd/OpenResty/config.lua14
-rw-r--r--meta/3rd/busted/config.lua10
-rw-r--r--meta/3rd/example/config.lua36
-rw-r--r--meta/3rd/lfs/config.lua8
-rw-r--r--meta/3rd/love2d/config.lua10
-rw-r--r--meta/3rd/lovr/config.lua8
-rw-r--r--script/library.lua40
10 files changed, 76 insertions, 118 deletions
diff --git a/meta/3rd/Cocos4.0/config.lua b/meta/3rd/Cocos4.0/config.lua
index 6615a773..85c24a08 100644
--- a/meta/3rd/Cocos4.0/config.lua
+++ b/meta/3rd/Cocos4.0/config.lua
@@ -1,9 +1,5 @@
name = 'Cocos'
files = {'cocos'}
-configs = {
- {
- key = 'Lua.runtime.version',
- action = 'set',
- value = 'LuaJIT',
- },
+config = {
+ ["Lua.runtime.version"] = "LuaJIT",
}
diff --git a/meta/3rd/Defold/config.lua b/meta/3rd/Defold/config.lua
index f4dad34e..9c457938 100644
--- a/meta/3rd/Defold/config.lua
+++ b/meta/3rd/Defold/config.lua
@@ -1,40 +1,20 @@
name = 'Defold'
files = {'game.project', '*%.script', '*%.gui_script'}
-configs = {
- {
- key = 'Lua.runtime.version',
- action = 'set',
- value = 'Lua 5.1',
- },
- {
- key = 'Lua.workspace.library',
- action = 'set',
- value = {".internal"},
- },
- {
- key = 'Lua.workspace.ignoreDir',
- action = 'set',
- value = {".internal"},
- },
- {
- key = 'Lua.diagnostics.globals',
- action = 'set',
- value = {
- "on_input",
- "on_message",
- "init",
- "update",
- "final"
- },
- },
- {
- key = 'files.associations',
- action = 'set',
- value = {
- ["*.script"] = "lua",
- ["*.gui_script"] = "lua",
- ["*.render_script"] = "lua",
- ["*.editor_script"] = "lua"
- }
+config = {
+ ["Lua.runtime.version"] = "Lua 5.1",
+ ["Lua.workspace.library"] = {".internal"},
+ ["Lua.workspace.ignoreDir"] = {".internal"},
+ ["Lua.diagnostics.globals"] = {
+ "on_input",
+ "on_message",
+ "init",
+ "update",
+ "final",
},
+ ["files.associations"] = {
+ ["*.script"] = "lua",
+ ["*.gui_script"] = "lua",
+ ["*.render_script"] = "lua",
+ ["*.editor_script"] = "lua",
+ }
}
diff --git a/meta/3rd/Jass/config.lua b/meta/3rd/Jass/config.lua
index 5752d8b1..0ae56f49 100644
--- a/meta/3rd/Jass/config.lua
+++ b/meta/3rd/Jass/config.lua
@@ -1,8 +1,4 @@
words = {'jass%.common'}
-configs = {
- {
- name = 'Lua.runtime.version',
- type = 'set',
- value = 'Lua 5.3',
- },
+config = {
+ ["Lua.runtime.version"] = "Lua 5.3",
}
diff --git a/meta/3rd/OpenResty/config.lua b/meta/3rd/OpenResty/config.lua
index 979dd660..8ca0382f 100644
--- a/meta/3rd/OpenResty/config.lua
+++ b/meta/3rd/OpenResty/config.lua
@@ -11,15 +11,9 @@ words = {
'ngx%.%w+',
}
-configs = {
- {
- key = 'Lua.runtime.version',
- action = 'set',
- value = 'LuaJIT',
- },
- {
- key = 'Lua.diagnostics.globals',
- action = 'add',
- value = 'ngx',
+config = {
+ ["Lua.runtime.version"] = "LuaJIT",
+ ["Lua.diagnostics.globals"] = {
+ "ngx",
},
}
diff --git a/meta/3rd/busted/config.lua b/meta/3rd/busted/config.lua
index b8254783..a525a626 100644
--- a/meta/3rd/busted/config.lua
+++ b/meta/3rd/busted/config.lua
@@ -1,7 +1,5 @@
-configs = {
- {
- key = "Lua.workspace.library",
- action = "add",
- value = "${3rd}/luassert/library",
- },
+config = {
+ ["Lua.workspace.library"] = {
+ "${3rd}/luassert/library"
+ }
}
diff --git a/meta/3rd/example/config.lua b/meta/3rd/example/config.lua
index e3d13e41..20bae0f3 100644
--- a/meta/3rd/example/config.lua
+++ b/meta/3rd/example/config.lua
@@ -5,34 +5,16 @@ words = {'thisIsAnExampleWord%.ifItExistsInFile%.thenTryLoadThisLibrary'}
-- list or matched file names. `.lua`, `.dll` and `.so` only
files = {'thisIsAnExampleFile%.ifItExistsInWorkSpace%.thenTryLoadThisLibrary%.lua'}
-- lsit of settings to be changed
-configs = {
- {
- key = 'Lua.runtime.version',
- action = 'set',
- value = 'LuaJIT',
+config = {
+ ["Lua.runtime.version"] = "LuaJIT",
+ ["Lua.diagnostics.globals"] = {
+ "global1",
+ "global2",
},
- {
- key = 'Lua.diagnostics.globals',
- action = 'add',
- value = 'global1',
+ ["Lua.runtime.special"] = {
+ ["include"] = "require",
},
- {
- key = 'Lua.runtime.special',
- action = 'prop',
- prop = 'include',
- value = 'require',
- },
- {
- key = 'Lua.runtime.builtin',
- action = 'prop',
- prop = 'io',
- value = 'disable',
+ ["Lua.runtime.builtin"] = {
+ ["io"] = "disable",
},
}
-for _, name in ipairs {'global2', 'global3', 'global4'} do
- configs[#configs+1] = {
- key = 'Lua.diagnostics.globals',
- action = 'add',
- value = name,
- }
-end
diff --git a/meta/3rd/lfs/config.lua b/meta/3rd/lfs/config.lua
index 3e46c587..b9e32610 100644
--- a/meta/3rd/lfs/config.lua
+++ b/meta/3rd/lfs/config.lua
@@ -1,9 +1,7 @@
name = 'luafilesystem'
words = { 'require[%s%(\"\']+lfs[%)\"\']' }
-configs = {
- {
- key = 'Lua.diagnostics.globals',
- action = 'add',
- value = 'lfs',
+config = {
+ ["Lua.diagnostics.globals"] = {
+ "lfs",
},
}
diff --git a/meta/3rd/love2d/config.lua b/meta/3rd/love2d/config.lua
index fa142b49..3ece274e 100644
--- a/meta/3rd/love2d/config.lua
+++ b/meta/3rd/love2d/config.lua
@@ -1,9 +1,5 @@
name = 'LÖVE'
words = {'love%.%w+'}
-configs = {
- {
- key = 'Lua.runtime.version',
- action = 'set',
- value = 'LuaJIT',
- },
-} \ No newline at end of file
+config = {
+ ["Lua.runtime.version"] = "LuaJIT",
+}
diff --git a/meta/3rd/lovr/config.lua b/meta/3rd/lovr/config.lua
index c0bf32e6..039bd0a0 100644
--- a/meta/3rd/lovr/config.lua
+++ b/meta/3rd/lovr/config.lua
@@ -1,9 +1,5 @@
name = 'LÖVR'
words = {'lovr%.%w+'}
-configs = {
- {
- key = 'Lua.runtime.version',
- action = 'set',
- value = 'LuaJIT',
- },
+config = {
+ ["Lua.runtime.version"] = "LuaJIT",
}
diff --git a/script/library.lua b/script/library.lua
index b460daf7..aa686887 100644
--- a/script/library.lua
+++ b/script/library.lua
@@ -352,15 +352,37 @@ end
local function apply3rd(uri, cfg, onlyMemory)
local changes = {}
- if cfg.configs then
- for _, change in ipairs(cfg.configs) do
- changes[#changes+1] = {
- key = change.key,
- action = change.action,
- prop = change.prop,
- value = change.value,
- uri = uri,
- }
+ if cfg.config then
+ for key, value in pairs(cfg.config) do
+ if type(value) == 'table' then
+ if #value == 0 then
+ for k, v in pairs(value) do
+ changes[#changes+1] = {
+ key = key,
+ action = 'prop',
+ prop = k,
+ value = v,
+ uri = uri,
+ }
+ end
+ else
+ for _, v in ipairs(value) do
+ changes[#changes+1] = {
+ key = key,
+ action = 'add',
+ value = v,
+ uri = uri,
+ }
+ end
+ end
+ else
+ changes[#changes+1] = {
+ key = key,
+ action = 'set',
+ value = value,
+ uri = uri,
+ }
+ end
end
end