summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-29 10:59:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-29 10:59:45 +0800
commit27b27cc0e6ac2193c927c20928089d8f8ebf02f9 (patch)
tree2d58e5cc7f317ee1de584676780a2e45c257fe61 /server/src
parent55f143578193ac434b18d77bbbdacc468ff340c7 (diff)
downloadlua-language-server-27b27cc0e6ac2193c927c20928089d8f8ebf02f9.zip
过滤掉隐藏变量吧
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/document_symbol.lua3
-rw-r--r--server/src/core/rename.lua2
-rw-r--r--server/src/core/vm.lua3
3 files changed, 6 insertions, 2 deletions
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua
index 61d58772..5b69de2e 100644
--- a/server/src/core/document_symbol.lua
+++ b/server/src/core/document_symbol.lua
@@ -83,6 +83,9 @@ local function buildLocal(vm, loc)
if loc.value and loc.value.type == 'function' then
return nil
end
+ if loc.hide then
+ return nil
+ end
local range = { loc.source.start, loc.source.finish }
local hvr = hover(loc, loc.source)
return {
diff --git a/server/src/core/rename.lua b/server/src/core/rename.lua
index 459aabcc..f42da08b 100644
--- a/server/src/core/rename.lua
+++ b/server/src/core/rename.lua
@@ -6,7 +6,7 @@ local function parseResult(result, source, newName)
local tp = result.type
if tp == 'local' or tp == 'field' then
local key = source[1]
- if result.disableRename then
+ if result.hide then
return positions
end
if source.index then
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua
index 5ccada8e..755b2e7c 100644
--- a/server/src/core/vm.lua
+++ b/server/src/core/vm.lua
@@ -403,7 +403,7 @@ function mt:buildFunction(exp, object)
if object then
local var = self:createArg('self', object.source, self:getValue(object))
- var.disableRename = true
+ var.hide = true
func.args[1] = var
end
@@ -1437,6 +1437,7 @@ function mt:createEnvironment()
self.results.main = self.chunk.func
-- 隐藏的上值`_ENV`
local parent = self:createLocal('_ENV')
+ parent.hide = true
local envValue = self:setValue(parent, self:buildTable())
-- _ENV 有个特殊标记
envValue.ENV = true