diff options
-rw-r--r-- | script/config/config.lua | 1 | ||||
-rw-r--r-- | script/core/noder.lua | 4 | ||||
-rw-r--r-- | test/definition/bug.lua | 4 | ||||
-rw-r--r-- | test/hover/init.lua | 4 | ||||
-rw-r--r-- | test/type_inference/init.lua | 4 |
5 files changed, 17 insertions, 0 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index 461ec260..42a9587d 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -200,6 +200,7 @@ local Template = { ['Lua.hint.paramName'] = Type.String >> 'All', ['Lua.window.statusBar'] = Type.Boolean >> true, ['Lua.window.progressBar'] = Type.Boolean >> true, + ['Lua.IntelliSense.localSet'] = 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 b744b361..1aeb2f61 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -2,6 +2,7 @@ local util = require 'utility' local guide = require 'parser.guide' local collector = require 'core.collector' local files = require 'files' +local config = require 'config' local tostring = tostring local error = error @@ -747,6 +748,9 @@ local function bindValue(noders, source, id) end if source.type == 'getlocal' or source.type == 'setlocal' then + if not config.get 'Lua.IntelliSense.localSet' then + return + end source = source.node end if source.bindDocs and value.type ~= 'table' then diff --git a/test/definition/bug.lua b/test/definition/bug.lua index aace2aee..d9f85899 100644 --- a/test/definition/bug.lua +++ b/test/definition/bug.lua @@ -1,3 +1,5 @@ +local config = require "config" + TEST [[ local <!x!> function _(x) @@ -170,6 +172,7 @@ string.xx:<?format?>() --v.<?bar1?> --]] +config.set('Lua.IntelliSense.localSet', true) TEST [[ local A, B @@ -229,6 +232,7 @@ end local <!b!> = B:get() print(<?b?>) ]] +config.set('Lua.IntelliSense.localSet', false) TEST [[ g[a.b.c] = 1 diff --git a/test/hover/init.lua b/test/hover/init.lua index 36fbd6d2..128d1b8f 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -836,6 +836,7 @@ local t: { } ]] +config.set('Lua.IntelliSense.localSet', true) TEST [[ local x x = 1 @@ -846,6 +847,7 @@ print(<?x?>) [[ local x: number = 1 ]] +config.set('Lua.IntelliSense.localSet', false) TEST [[ local <?x?> <close> = 1 @@ -1687,6 +1689,7 @@ t.<?x?>() field t.x: any ]] +config.set('Lua.IntelliSense.localSet', true) TEST [[ ---@class A local a @@ -1699,6 +1702,7 @@ print(b.<?x?>) [[ field A.x: any ]] +config.set('Lua.IntelliSense.localSet', false) TEST [[ ---@class A diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index a3764328..96da94aa 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -57,6 +57,7 @@ local var = '111' t.<?x?> = var ]] +config.set('Lua.IntelliSense.localSet', true) TEST 'string' [[ local <?var?> var = '111' @@ -67,6 +68,7 @@ local var var = '111' print(<?var?>) ]] +config.set('Lua.IntelliSense.localSet', false) TEST 'function' [[ function <?xx?>() @@ -78,11 +80,13 @@ local function <?xx?>() end ]] +config.set('Lua.IntelliSense.localSet', true) TEST 'function' [[ local xx <?xx?> = function () end ]] +config.set('Lua.IntelliSense.localSet', false) TEST 'table' [[ local <?t?> = {} |