summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-17 15:28:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-17 15:28:12 +0800
commit4914f316d042aa907900170dc9b2adb0134f93a8 (patch)
tree398a7815590e4f2a0ce03a1382003c305690bf87 /server
parent7ecf149287d967dcaeeed8485b5867fa76653c6c (diff)
downloadlua-language-server-4914f316d042aa907900170dc9b2adb0134f93a8.zip
要复制一份出来
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/library.lua10
-rw-r--r--server/test/hover/init.lua8
2 files changed, 17 insertions, 1 deletions
diff --git a/server/src/matcher/library.lua b/server/src/matcher/library.lua
index 19e3b8e0..f6211431 100644
--- a/server/src/matcher/library.lua
+++ b/server/src/matcher/library.lua
@@ -65,6 +65,14 @@ local function mergeSource(alllibs, name, lib)
end
end
+local function copy(t)
+ local new = {}
+ for k, v in pairs(t) do
+ new[k] = v
+ end
+ return new
+end
+
local function insert(tbl, name, key, value)
if not name or not key then
return
@@ -76,7 +84,7 @@ local function insert(tbl, name, key, value)
child = {},
}
end
- tbl[name].child[key] = value
+ tbl[name].child[key] = copy(value)
end
local function mergeParent(alllibs, name, lib)
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index 31e604f3..a5e11a74 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -172,3 +172,11 @@ mode: string
| "t"
| "bt"
]=]
+
+TEST [[
+string.<?lower?>()
+]]
+[[
+function string.lower(string)
+ -> string
+]]