diff options
-rw-r--r-- | server/src/method/initialize.lua | 2 | ||||
-rw-r--r-- | server/src/vm/global.lua | 7 | ||||
-rw-r--r-- | server/src/vm/value.lua | 4 | ||||
-rw-r--r-- | server/test/definition/set.lua | 5 | ||||
-rw-r--r-- | server/test/diagnostics/init.lua | 4 |
5 files changed, 18 insertions, 4 deletions
diff --git a/server/src/method/initialize.lua b/server/src/method/initialize.lua index ba183c5e..e236617c 100644 --- a/server/src/method/initialize.lua +++ b/server/src/method/initialize.lua @@ -22,7 +22,7 @@ return function (lsp) -- 支持“重命名” renameProvider = true, -- 支持“大纲” - documentSymbolProvider = true, + --documentSymbolProvider = true, -- 支持“签名帮助” signatureHelpProvider = { triggerCharacters = { '(', ',' }, diff --git a/server/src/vm/global.lua b/server/src/vm/global.lua index bb506ce9..b1b32505 100644 --- a/server/src/vm/global.lua +++ b/server/src/vm/global.lua @@ -13,9 +13,14 @@ return function (lsp) global:rawSet(name, value) end end + + local _G = global:getChild '_G' + global:eachChild(function (k, v) + _G:setChild(k, v) + end) end if lsp then lsp.globalValue = global end - return global + return global:rawGet('_G') end diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 44e9d1e4..60f0c663 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -151,6 +151,10 @@ function mt:getChild(index, source, mark) return method:getChild(index, source, mark) end +function mt:bindChild(other) + self._child = other._child +end + function mt:setMetaTable(metatable) self._meta = metatable end diff --git a/server/test/definition/set.lua b/server/test/definition/set.lua index 82dc4828..eb899fc9 100644 --- a/server/test/definition/set.lua +++ b/server/test/definition/set.lua @@ -38,3 +38,8 @@ else end print(<?x?>) ]] + +TEST [[ +_G.<!x!> = 1 +print(<?x?>) +]] diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua index 8c2f4dba..4af8f975 100644 --- a/server/test/diagnostics/init.lua +++ b/server/test/diagnostics/init.lua @@ -119,12 +119,12 @@ local _ENV ]] TEST [[ -print(_G) +print() <!('string')!>:sub(1, 1) ]] TEST [[ -print(_G) +print() ('string') ]] |