summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/config.lua5
-rw-r--r--script-beta/core/completion.lua7
-rw-r--r--script-beta/core/hover/table.lua2
-rw-r--r--script-beta/parser/guide.lua3
-rw-r--r--script-beta/provider/provider.lua5
-rw-r--r--script-beta/vm/guideInterface.lua4
-rw-r--r--script/config.lua10
-rw-r--r--test-beta/type_inference/init.lua1
8 files changed, 33 insertions, 4 deletions
diff --git a/script-beta/config.lua b/script-beta/config.lua
index 02f4cf25..8927f9b1 100644
--- a/script-beta/config.lua
+++ b/script-beta/config.lua
@@ -140,6 +140,7 @@ local ConfigTemplate = {
viewString = {true, Boolean},
viewStringMax = {1000, Integer},
viewNumber = {true, Boolean},
+ fieldInfer = {3000, Integer},
},
color = {
mode = {'Semantic', String},
@@ -151,6 +152,10 @@ local ConfigTemplate = {
enable = {false, Boolean},
path = {'.vscode/lua-plugin/*.lua', String},
},
+ intelliSense = {
+ searchDepth = {0, Integer},
+ fastGlobal = {true, Boolean},
+ },
}
local OtherTemplate = {
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index 4f4f99c7..5dc8d80c 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -451,7 +451,12 @@ local function checkField(ast, word, start, offset, parent, oop, results)
end
local function checkGlobal(ast, word, start, offset, parent, oop, results)
- local refs = vm.getGlobals('*', 'fast')
+ local refs
+ if config.config.intelliSense.fastGlobal then
+ refs = vm.getGlobals('*', 'fast')
+ else
+ refs = vm.getGlobals('*')
+ end
checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, results)
end
diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua
index 35a5f337..75342925 100644
--- a/script-beta/core/hover/table.lua
+++ b/script-beta/core/hover/table.lua
@@ -240,7 +240,7 @@ return function (source)
if not literals[key] then
literals[key] = {}
end
- if not TEST and os.clock() - clock > 3 then
+ if not TEST and os.clock() - clock > config.config.hover.fieldInfer / 1000.0 then
timeUp = true
end
local class, literal = getField(src, timeUp, mark, key)
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index f52e9545..9e9b085c 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1194,7 +1194,8 @@ function m.status(parentStatus, interface)
deep = parentStatus and parentStatus.deep,
results = {},
}
- if status.depth >= 5 then
+ local searchDepth = interface and interface.searchDepth or 0
+ if status.depth >= searchDepth then
status.deep = false
end
status.lock = status.locks[status.depth] or {}
diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua
index c892bfee..46136f54 100644
--- a/script-beta/provider/provider.lua
+++ b/script-beta/provider/provider.lua
@@ -18,6 +18,7 @@ local lang = require 'language'
local function updateConfig()
local diagnostics = require 'provider.diagnostic'
+ local vm = require 'vm'
local configs = proto.awaitRequest('workspace/configuration', {
items = {
{
@@ -65,6 +66,10 @@ local function updateConfig()
if not util.equal(oldConfig.luadoc, newConfig.luadoc) then
files.flushCache()
end
+ if not util.equal(oldConfig.intelliSense, newConfig.intelliSense) then
+ files.flushCache()
+ vm.setSearchDepth(newConfig.intelliSense.searchDepth)
+ end
if newConfig.completion.enable then
completion.enable()
diff --git a/script-beta/vm/guideInterface.lua b/script-beta/vm/guideInterface.lua
index 4d651882..ddacf091 100644
--- a/script-beta/vm/guideInterface.lua
+++ b/script-beta/vm/guideInterface.lua
@@ -128,3 +128,7 @@ function vm.setSearchLevel(n)
end
vm.interface.searchLevel = n
end
+
+function vm.setSearchDepth(n)
+ vm.interface.setSearchDepth = n
+end
diff --git a/script/config.lua b/script/config.lua
index f54bc5bc..8ad53b41 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -105,7 +105,7 @@ local ConfigTemplate = {
globals = {{}, Str2Hash ';'},
disable = {{}, Str2Hash ';'},
severity = {
- table.deepCopy(DiagnosticDefaultSeverity),
+ util.deepCopy(define.DiagnosticDefaultSeverity),
Hash(String, String),
},
workspaceDelay = {0, Integer},
@@ -127,6 +127,7 @@ local ConfigTemplate = {
callSnippet = {'Disable', String},
keywordSnippet = {'Replace', String},
displayContext = {6, Integer},
+ fastGlobal = {true, Boolean},
},
signatureHelp = {
enable = {true, Boolean},
@@ -136,14 +137,21 @@ local ConfigTemplate = {
viewString = {true, Boolean},
viewStringMax = {1000, Integer},
viewNumber = {true, Boolean},
+ fieldInfer = {3000, Integer},
},
color = {
mode = {'Semantic', String},
},
+ luadoc = {
+ enable = {true, Boolean},
+ },
plugin = {
enable = {false, Boolean},
path = {'.vscode/lua-plugin/*.lua', String},
},
+ intelliSense = {
+ searchDepth = {0, Integer},
+ },
}
local OtherTemplate = {
diff --git a/test-beta/type_inference/init.lua b/test-beta/type_inference/init.lua
index 25f4a773..09d641b0 100644
--- a/test-beta/type_inference/init.lua
+++ b/test-beta/type_inference/init.lua
@@ -36,6 +36,7 @@ function TEST(wanted)
end
config.config.runtime.version = 'Lua 5.4'
+config.config.intelliSense.searchDepth = 5
TEST 'string' [[
local <?var?> = '111'