summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/config/config.lua1
-rw-r--r--script/core/noder.lua8
-rw-r--r--test/crossfile/definition.lua2
-rw-r--r--test/hover/init.lua1
-rw-r--r--test/type_inference/init.lua5
5 files changed, 9 insertions, 8 deletions
diff --git a/script/config/config.lua b/script/config/config.lua
index bd73a77f..0f35ce6c 100644
--- a/script/config/config.lua
+++ b/script/config/config.lua
@@ -203,6 +203,7 @@ local Template = {
['Lua.IntelliSense.traceLocalSet'] = Type.Boolean >> false,
['Lua.IntelliSense.traceReturn'] = Type.Boolean >> false,
['Lua.IntelliSense.traceBeSetted'] = Type.Boolean >> false,
+ ['Lua.IntelliSense.traceGlobalInject'] = Type.Boolean >> false,
['Lua.telemetry.enable'] = Type.Or(Type.Boolean >> false, Type.Nil),
['files.associations'] = Type.Hash(Type.String, Type.String),
['files.exclude'] = Type.Hash(Type.String, Type.Boolean),
diff --git a/script/core/noder.lua b/script/core/noder.lua
index b9d28fca..f6483408 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -482,9 +482,11 @@ local function getNodeKey(source)
if methodNode then
return getNodeKey(methodNode)
end
- local localValueID = getLocalValueID(source)
- if localValueID then
- return localValueID
+ if config.get 'Lua.IntelliSense.traceGlobalInject' then
+ local localValueID = getLocalValueID(source)
+ if localValueID then
+ return localValueID
+ end
end
local key, node = getKey(source)
if key and guide.isGlobal(source) then
diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua
index 37c10db6..1dd14058 100644
--- a/test/crossfile/definition.lua
+++ b/test/crossfile/definition.lua
@@ -770,6 +770,7 @@ TEST {
},
}
+config.set('Lua.IntelliSense.traceGlobalInject', true)
TEST {
{
path = 'a.lua',
@@ -790,6 +791,7 @@ print(b.<?test?>)
]]
}
}
+config.set('Lua.IntelliSense.traceGlobalInject', false)
TEST {
{
diff --git a/test/hover/init.lua b/test/hover/init.lua
index f56840e9..b3d675bb 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1,6 +1,7 @@
local core = require 'core.hover'
local files = require 'files'
local catch = require 'catch'
+local config = require 'config'
rawset(_G, 'TEST', true)
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index e071fdf7..908d613c 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -930,11 +930,6 @@ emit:on("died", function (<?i?>)
end)
]]
-TEST '👍' [[
----@class 👍
-local <?x?>
-]]
-
TEST 'boolean' [[
---@type boolean
local x