summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
Diffstat (limited to 'script/core')
-rw-r--r--script/core/completion/completion.lua20
-rw-r--r--script/core/completion/postfix.lua2
-rw-r--r--script/core/diagnostics/deprecated.lua6
-rw-r--r--script/core/diagnostics/init.lua6
-rw-r--r--script/core/diagnostics/lowercase-global.lua2
-rw-r--r--script/core/diagnostics/undefined-global.lua4
-rw-r--r--script/core/hint.lua8
-rw-r--r--script/core/hover/description.lua4
-rw-r--r--script/core/hover/label.lua2
-rw-r--r--script/core/hover/table.lua2
-rw-r--r--script/core/infer.lua4
-rw-r--r--script/core/noder.lua8
-rw-r--r--script/core/semantic-tokens.lua2
13 files changed, 35 insertions, 35 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index ba2b0efc..ee3bbf0c 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -180,7 +180,7 @@ local function buildDetail(source)
end
local function getSnip(source)
- local context = config.get 'Lua.completion.displayContext'
+ local context = config.get(nil, 'Lua.completion.displayContext')
if context <= 0 then
return nil
end
@@ -222,7 +222,7 @@ local function buildDesc(source)
end
local function buildFunction(results, source, value, oop, data)
- local snipType = config.get 'Lua.completion.callSnippet'
+ local snipType = config.get(nil, 'Lua.completion.callSnippet')
if snipType == 'Disable' or snipType == 'Both' then
results[#results+1] = data
end
@@ -324,7 +324,7 @@ local function checkLocal(state, word, position, results)
end
local function checkModule(state, word, position, results)
- if not config.get 'Lua.completion.autoRequire' then
+ if not config.get(nil, 'Lua.completion.autoRequire') then
return
end
local locals = guide.getVisibleLocals(state.ast, position)
@@ -337,7 +337,7 @@ local function checkModule(state, word, position, results)
local stemName = fileName:gsub('%..+', '')
if not locals[stemName]
and not vm.hasGlobalSets(stemName)
- and not config.get 'Lua.diagnostics.globals'[stemName]
+ and not config.get(nil, 'Lua.diagnostics.globals')[stemName]
and stemName:match '^[%a_][%w_]*$'
and matchKey(word, stemName) then
local targetState = files.getState(uri)
@@ -448,8 +448,8 @@ local function checkFieldFromFieldToIndex(state, name, src, parent, word, startP
}
end
else
- if config.get 'Lua.runtime.version' == 'lua 5.1'
- or config.get 'Lua.runtime.version' == 'luaJIT' then
+ if config.get(nil, 'Lua.runtime.version') == 'lua 5.1'
+ or config.get(nil, 'Lua.runtime.version') == 'luaJIT' then
textEdit.newText = '_G' .. textEdit.newText
else
textEdit.newText = '_ENV' .. textEdit.newText
@@ -536,7 +536,7 @@ local function checkFieldOfRefs(refs, state, word, startPos, position, parent, o
goto CONTINUE
end
local funcLabel
- if config.get 'Lua.completion.showParams' then
+ if config.get(nil, 'Lua.completion.showParams') then
local value = searcher.getObjectValue(src) or src
if value.type == 'function'
or value.type == 'doc.type.function' then
@@ -630,7 +630,7 @@ end
local function checkCommon(state, word, position, results)
local myUri = state.uri
- local showWord = config.get 'Lua.completion.showWord'
+ local showWord = config.get(nil, 'Lua.completion.showWord')
if showWord == 'Disable' then
return
end
@@ -645,7 +645,7 @@ local function checkCommon(state, word, position, results)
for _, data in ipairs(keyWordMap) do
used[data[1]] = true
end
- if config.get 'Lua.completion.workspaceWord' and #word >= 2 then
+ if config.get(nil, 'Lua.completion.workspaceWord') and #word >= 2 then
results.complete = true
local myHead = word:sub(1, 2)
for uri in files.eachFile() do
@@ -720,7 +720,7 @@ end
local function checkKeyWord(state, start, position, word, hasSpace, afterLocal, results)
local text = state.lua
- local snipType = config.get 'Lua.completion.keywordSnippet'
+ local snipType = config.get(nil, 'Lua.completion.keywordSnippet')
local symbol = lookBackward.findSymbol(text, guide.positionToOffset(state, start))
local isExp = symbol == '(' or symbol == ',' or symbol == '='
local info = {
diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua
index 9ad20965..08b3feac 100644
--- a/script/core/completion/postfix.lua
+++ b/script/core/completion/postfix.lua
@@ -277,7 +277,7 @@ return function (state, position, results)
offset = newOffset - 1
end
local symbol = text:sub(offset, offset)
- if symbol == config.get 'Lua.completion.postfix' then
+ if symbol == config.get(nil, 'Lua.completion.postfix') then
local wordPosition = guide.offsetToPosition(state, offset - 1)
checkPostFix(state, word or '', wordPosition, position, results)
return symbol ~= '.' and symbol ~= ':'
diff --git a/script/core/diagnostics/deprecated.lua b/script/core/diagnostics/deprecated.lua
index e9a1fef7..5fe36c42 100644
--- a/script/core/diagnostics/deprecated.lua
+++ b/script/core/diagnostics/deprecated.lua
@@ -23,10 +23,10 @@ return function (uri, callback)
if not key then
return
end
- if config.get 'Lua.diagnostics.globals'[key] then
+ if config.get(nil, 'Lua.diagnostics.globals')[key] then
return
end
- if config.get 'Lua.runtime.special'[key] then
+ if config.get(nil, 'Lua.runtime.special')[key] then
return
end
end
@@ -83,7 +83,7 @@ return function (uri, callback)
end
table.sort(versions)
if #versions > 0 then
- message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(versions, '/'), config.get 'Lua.runtime.version'))
+ message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(versions, '/'), config.get(nil, 'Lua.runtime.version')))
end
end
cache[id] = {
diff --git a/script/core/diagnostics/init.lua b/script/core/diagnostics/init.lua
index 4950900b..2a21302b 100644
--- a/script/core/diagnostics/init.lua
+++ b/script/core/diagnostics/init.lua
@@ -20,13 +20,13 @@ table.sort(diagList, function (a, b)
end)
local function check(uri, name, results)
- if config.get 'Lua.diagnostics.disable'[name] then
+ if config.get(nil, 'Lua.diagnostics.disable')[name] then
return
end
- local level = config.get 'Lua.diagnostics.severity'[name]
+ local level = config.get(nil, 'Lua.diagnostics.severity')[name]
or define.DiagnosticDefaultSeverity[name]
- local neededFileStatus = config.get 'Lua.diagnostics.neededFileStatus'[name]
+ local neededFileStatus = config.get(nil, 'Lua.diagnostics.neededFileStatus')[name]
or define.DiagnosticDefaultNeededFileStatus[name]
if neededFileStatus == 'None' then
diff --git a/script/core/diagnostics/lowercase-global.lua b/script/core/diagnostics/lowercase-global.lua
index 299ac110..bd301c7f 100644
--- a/script/core/diagnostics/lowercase-global.lua
+++ b/script/core/diagnostics/lowercase-global.lua
@@ -24,7 +24,7 @@ return function (uri, callback)
end
local definedGlobal = {}
- for name in pairs(config.get 'Lua.diagnostics.globals') do
+ for name in pairs(config.get(nil, 'Lua.diagnostics.globals')) do
definedGlobal[name] = true
end
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua
index 48c8a226..41a50d99 100644
--- a/script/core/diagnostics/undefined-global.lua
+++ b/script/core/diagnostics/undefined-global.lua
@@ -27,10 +27,10 @@ return function (uri, callback)
if not key then
return
end
- if config.get 'Lua.diagnostics.globals'[key] then
+ if config.get(nil, 'Lua.diagnostics.globals')[key] then
return
end
- if config.get 'Lua.runtime.special'[key] then
+ if config.get(nil, 'Lua.runtime.special')[key] then
return
end
local node = src.node
diff --git a/script/core/hint.lua b/script/core/hint.lua
index 42390443..b3aec88e 100644
--- a/script/core/hint.lua
+++ b/script/core/hint.lua
@@ -32,11 +32,11 @@ local function typeHint(uri, results, start, finish)
return
end
if source.parent.type == 'funcargs' then
- if not config.get 'Lua.hint.paramType' then
+ if not config.get(nil, 'Lua.hint.paramType') then
return
end
else
- if not config.get 'Lua.hint.setType' then
+ if not config.get(nil, 'Lua.hint.setType') then
return
end
end
@@ -99,7 +99,7 @@ end
---@async
local function paramName(uri, results, start, finish)
- local paramConfig = config.get 'Lua.hint.paramName'
+ local paramConfig = config.get(nil, 'Lua.hint.paramName')
if not paramConfig or paramConfig == 'None' then
return
end
@@ -162,7 +162,7 @@ end
---@async
local function awaitHint(uri, results, start, finish)
- local awaitConfig = config.get 'Lua.hint.await'
+ local awaitConfig = config.get(nil, 'Lua.hint.await')
if not awaitConfig then
return
end
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 2945d47f..51027aed 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -64,11 +64,11 @@ end
local function asStringView(source, literal)
-- 内部包含转义符?
local rawLen = source.finish - source.start - 2 * #source[2] + 1
- if config.get 'Lua.hover.viewString'
+ if config.get(nil, 'Lua.hover.viewString')
and (source[2] == '"' or source[2] == "'")
and rawLen > #literal then
local view = literal
- local max = config.get 'Lua.hover.viewStringMax'
+ local max = config.get(nil, 'Lua.hover.viewStringMax')
if #view > max then
view = view:sub(1, max) .. '...'
end
diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua
index 0bb4fe89..f797d520 100644
--- a/script/core/hover/label.lua
+++ b/script/core/hover/label.lua
@@ -167,7 +167,7 @@ local function formatNumber(n)
end
local function asNumber(source)
- if not config.get 'Lua.hover.viewNumber' then
+ if not config.get(nil, 'Lua.hover.viewNumber') then
return nil
end
local num = source[1]
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index 285d5c02..3785d479 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -136,7 +136,7 @@ end
---@async
return function (source)
- local maxFields = config.get 'Lua.hover.previewFields'
+ local maxFields = config.get(nil, 'Lua.hover.previewFields')
if maxFields <= 0 then
return 'table'
end
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 8da35289..a17d4faa 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -232,7 +232,7 @@ local function bindClassOrType(source)
end
local function cleanInfers(infers)
- local version = config.get 'Lua.runtime.version'
+ local version = config.get(nil, 'Lua.runtime.version')
local enableInteger = version == 'Lua 5.3' or version == 'Lua 5.4'
infers['unknown'] = nil
if infers['number'] then
@@ -297,7 +297,7 @@ function m.viewInfers(infers)
return sa < sb
end
end)
- local limit = config.get 'Lua.hover.enumsLimit'
+ local limit = config.get(nil, 'Lua.hover.enumsLimit')
if limit < 0 then
limit = 0
end
diff --git a/script/core/noder.lua b/script/core/noder.lua
index bc2efa70..60dc15e6 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -494,7 +494,7 @@ local function getNodeKey(source)
if methodNode then
return getNodeKey(methodNode)
end
- if config.get 'Lua.IntelliSense.traceFieldInject' then
+ if config.get(nil, 'Lua.IntelliSense.traceFieldInject') then
local localValueID = getLocalValueID(source)
if localValueID then
return localValueID
@@ -764,7 +764,7 @@ local function bindValue(noders, source, id)
local bindDocs = source.bindDocs
if source.type == 'getlocal'
or source.type == 'setlocal' then
- if not config.get 'Lua.IntelliSense.traceLocalSet' then
+ if not config.get(nil, 'Lua.IntelliSense.traceLocalSet') then
return
end
bindDocs = source.node.bindDocs
@@ -779,7 +779,7 @@ local function bindValue(noders, source, id)
end
-- x = y : x -> y
pushForward(noders, id, valueID, INFO_REJECT_SET)
- if not config.get 'Lua.IntelliSense.traceBeSetted'
+ if not config.get(nil, 'Lua.IntelliSense.traceBeSetted')
and source.type ~= 'local' then
return
end
@@ -1304,7 +1304,7 @@ compileNodeMap = util.switch()
, index
)
pushForward(noders, returnID, getID(rtnObj))
- if config.get 'Lua.IntelliSense.traceReturn' then
+ if config.get(nil, 'Lua.IntelliSense.traceReturn') then
pushBackward(noders, getID(rtnObj), returnID, INFO_DEEP_AND_DONT_CROSS)
end
end
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 8389cbb4..291819f2 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -9,7 +9,7 @@ local converter = require 'proto.converter'
local infer = require 'core.infer'
local config = require 'config'
-local isEnhanced = config.get 'Lua.color.mode' == 'SemanticEnhanced'
+local isEnhanced = config.get(nil, 'Lua.color.mode') == 'SemanticEnhanced'
local Care = {}
Care['getglobal'] = function (source, results)