diff options
42 files changed, 199 insertions, 199 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index 2feb9868..542bdcf2 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -221,14 +221,14 @@ local rawConfig = {} local m = {} m.watchList = {} -local function update(key, value, raw) +local function update(uri, key, value, raw) local oldValue = config[key] config[key] = value rawConfig[key] = raw m.event(key, value, oldValue) end -function m.set(key, value) +function m.set(uri, key, value) local unit = Template[key] if not unit then return false @@ -237,14 +237,14 @@ function m.set(key, value) return false end if unit:checker(value) then - update(key, unit:loader(value), value) + update(uri, key, unit:loader(value), value) else - update(key, unit.default, unit.default) + update(uri, key, unit.default, unit.default) end return true end -function m.add(key, value) +function m.add(uri, key, value) local unit = Template[key] if not unit then return false @@ -262,12 +262,12 @@ function m.add(key, value) end copyed[#copyed+1] = value if unit:checker(copyed) then - update(key, unit:loader(copyed), copyed) + update(uri, key, unit:loader(copyed), copyed) end return true end -function m.prop(key, prop, value) +function m.prop(uri, key, prop, value) local unit = Template[key] if not unit then return false @@ -285,12 +285,12 @@ function m.prop(key, prop, value) end copyed[prop] = value if unit:checker(copyed) then - update(key, unit:loader(copyed), copyed) + update(uri, key, unit:loader(copyed), copyed) end return true end -function m.get(key) +function m.get(uri, key) return config[key] end @@ -320,7 +320,7 @@ function m.dump() return dump end -function m.update(new) +function m.update(uri, new) local function expand(t, left) for key, value in pairs(t) do local fullKey = key @@ -328,9 +328,9 @@ function m.update(new) fullKey = left .. '.' .. key end if Template[fullKey] then - m.set(fullKey, value) + m.set(uri, fullKey, value) elseif Template['Lua.' .. fullKey] then - m.set('Lua.' .. fullKey, value) + m.set(uri, 'Lua.' .. fullKey, value) elseif type(value) == 'table' then expand(value, fullKey) end @@ -371,7 +371,7 @@ function m.init() end m.inited = true for key, unit in pairs(Template) do - m.set(key, unit.default) + m.set(nil, key, unit.default) end end 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) diff --git a/script/files.lua b/script/files.lua index d5344847..00e76623 100644 --- a/script/files.lua +++ b/script/files.lua @@ -174,7 +174,7 @@ function m.setText(uri, text, isTrust, version) return end if not isTrust then - local encoding = config.get 'Lua.runtime.fileEncoding' + local encoding = config.get(nil, 'Lua.runtime.fileEncoding') text = encoder.decode(encoding, text) end if file.originText == text then @@ -452,7 +452,7 @@ function m.compileState(uri, text) local client = require 'client' if not m.isOpen(uri) and not m.isLibrary(uri) - and #text >= config.get 'Lua.workspace.preloadFileSize' * 1000 then + and #text >= config.get(nil, 'Lua.workspace.preloadFileSize') * 1000 then if not m.notifyCache['preloadFileSize'] then m.notifyCache['preloadFileSize'] = {} m.notifyCache['skipLargeFileCount'] = 0 @@ -462,7 +462,7 @@ function m.compileState(uri, text) m.notifyCache['skipLargeFileCount'] = m.notifyCache['skipLargeFileCount'] + 1 local message = lang.script('WORKSPACE_SKIP_LARGE_FILE' , ws.getRelativePath(uri) - , config.get 'Lua.workspace.preloadFileSize' + , config.get(nil, 'Lua.workspace.preloadFileSize') , #text / 1000 ) if m.notifyCache['skipLargeFileCount'] <= 1 then @@ -478,11 +478,11 @@ function m.compileState(uri, text) local clock = os.clock() local state, err = parser.compile(text , 'Lua' - , config.get 'Lua.runtime.version' + , config.get(nil, 'Lua.runtime.version') , { - special = config.get 'Lua.runtime.special', - unicodeName = config.get 'Lua.runtime.unicodeName', - nonstandardSymbol = config.get 'Lua.runtime.nonstandardSymbol', + special = config.get(nil, 'Lua.runtime.special'), + unicodeName = config.get(nil, 'Lua.runtime.unicodeName'), + nonstandardSymbol = config.get(nil, 'Lua.runtime.nonstandardSymbol'), } ) local passed = os.clock() - clock @@ -634,12 +634,12 @@ end --- 获取文件关联 function m.getAssoc() - if m.assocVersion == config.get 'version' then + if m.assocVersion == config.get(nil, 'version') then return m.assocMatcher end - m.assocVersion = config.get 'version' + m.assocVersion = config.get(nil, 'version') local patt = {} - for k, v in pairs(config.get 'files.associations') do + for k, v in pairs(config.get(nil, 'files.associations')) do if v == 'lua' then patt[#patt+1] = k end diff --git a/script/library.lua b/script/library.lua index 81242a91..ef62ceab 100644 --- a/script/library.lua +++ b/script/library.lua @@ -15,7 +15,7 @@ local encoder = require 'encoder' local m = {} local function getDocFormater() - local version = config.get 'Lua.runtime.version' + local version = config.get(nil, 'Lua.runtime.version') if client.isVSCode() then if version == 'Lua 5.1' then return 'HOVER_NATIVE_DOCUMENT_LUA51' @@ -99,11 +99,11 @@ local function compileSingleMetaDoc(script, metaLang, status) middleBuf[#middleBuf+1] = ('PUSH [===[%s]===]'):format(script:sub(last)) local middleScript = table.concat(middleBuf, '\n') local version, jit - if config.get 'Lua.runtime.version' == 'LuaJIT' then + if config.get(nil, 'Lua.runtime.version') == 'LuaJIT' then version = 5.1 jit = true else - version = tonumber(config.get 'Lua.runtime.version':sub(-3)) + version = tonumber(config.get(nil, 'Lua.runtime.version'):sub(-3)) jit = false end @@ -202,9 +202,9 @@ local function initBuiltIn() return end local langID = lang.id - local version = config.get 'Lua.runtime.version' - local encoding = config.get 'Lua.runtime.fileEncoding' - local metaPath = fs.path(METAPATH) / config.get 'Lua.runtime.meta':gsub('%$%{(.-)%}', { + local version = config.get(nil, 'Lua.runtime.version') + local encoding = config.get(nil, 'Lua.runtime.fileEncoding') + local metaPath = fs.path(METAPATH) / config.get(nil, 'Lua.runtime.meta'):gsub('%$%{(.-)%}', { version = version, language = langID, encoding = encoding, @@ -227,7 +227,7 @@ local function initBuiltIn() local out = fsu.dummyFS() local templateDir = ROOT / 'meta' / 'template' for libName, status in pairs(define.BuiltIn) do - status = config.get 'Lua.runtime.builtin'[libName] or status + status = config.get(nil, 'Lua.runtime.builtin')[libName] or status if status == 'disable' then goto CONTINUE end @@ -308,7 +308,7 @@ end local function load3rdConfig() local configs = {} load3rdConfigInDir(innerThirdDir, configs, true) - local thirdDirs = config.get 'Lua.workspace.userThirdParty' + local thirdDirs = config.get(nil, 'Lua.workspace.userThirdParty') for _, thirdDir in ipairs(thirdDirs) do load3rdConfigInDir(fs.path(thirdDir), configs) end @@ -450,7 +450,7 @@ local function check3rd(uri) if hasAsked then return end - if not config.get 'Lua.workspace.checkThirdParty' then + if not config.get(nil, 'Lua.workspace.checkThirdParty') then return end if thirdConfigs == nil then diff --git a/script/plugin.lua b/script/plugin.lua index f56dc9f9..88c4578f 100644 --- a/script/plugin.lua +++ b/script/plugin.lua @@ -84,7 +84,7 @@ function m.init() local ws = require 'workspace' m.interface = {} - local pluginPath = ws.getAbsolutePath(config.get 'Lua.runtime.plugin') + local pluginPath = ws.getAbsolutePath(config.get(nil, 'Lua.runtime.plugin')) log.info('plugin path:', pluginPath) if not pluginPath then return diff --git a/script/progress.lua b/script/progress.lua index 8ae5e9e0..d1595cf8 100644 --- a/script/progress.lua +++ b/script/progress.lua @@ -83,7 +83,7 @@ function mt:_update() and self._clock + self._delay <= os.clock() then self._updated = os.clock() self._dirty = false - if not config.get 'Lua.window.progressBar' then + if not config.get(nil, 'Lua.window.progressBar') then return end proto.request('window/workDoneProgress/create', { @@ -106,7 +106,7 @@ function mt:_update() if not self._showed then return end - if not config.get 'Lua.window.progressBar' then + if not config.get(nil, 'Lua.window.progressBar') then self:remove() return end diff --git a/script/provider/completion.lua b/script/provider/completion.lua index ec31858a..8e529e95 100644 --- a/script/provider/completion.lua +++ b/script/provider/completion.lua @@ -13,7 +13,7 @@ local function allWords() list[#list+1] = c mark[c] = true end - local postfix = config.get 'Lua.completion.postfix' + local postfix = config.get(nil, 'Lua.completion.postfix') if postfix ~= '' and not mark[postfix] then list[#list+1] = postfix mark[postfix] = true @@ -76,7 +76,7 @@ config.watch(function (key, value) end end if key == 'Lua.completion.postfix' then - if config.get 'Lua.completion.enable' then + if config.get(nil, 'Lua.completion.enable') then disable() enable() end diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index ca4bcdb8..5630d44f 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -29,7 +29,7 @@ local function buildSyntaxError(uri, err) local message = lang.script('PARSER_'..err.type, err.info) if err.version then - local version = err.info and err.info.version or config.get 'Lua.runtime.version' + local version = err.info and err.info.version or config.get(nil, 'Lua.runtime.version') message = message .. ('(%s)'):format(lang.script('DIAG_NEED_VERSION' , concat(err.version, '/') , version @@ -159,7 +159,7 @@ function m.syntaxErrors(uri, ast) pcall(function () for _, err in ipairs(ast.errs) do - if not config.get 'Lua.diagnostics.disable'[err.type:lower():gsub('_', '-')] then + if not config.get(nil, 'Lua.diagnostics.disable')[err.type:lower():gsub('_', '-')] then results[#results+1] = buildSyntaxError(uri, err) end end @@ -189,11 +189,11 @@ end ---@async function m.doDiagnostic(uri) - if not config.get 'Lua.diagnostics.enable' then + if not config.get(nil, 'Lua.diagnostics.enable') then return end if files.isLibrary(uri) then - local status = config.get 'Lua.diagnostics.libraryFiles' + local status = config.get(nil, 'Lua.diagnostics.libraryFiles') if status == 'Disable' then return elseif status == 'Opened' then @@ -203,7 +203,7 @@ function m.doDiagnostic(uri) end end if ws.isIgnored(uri) then - local status = config.get 'Lua.diagnostics.ignoredFiles' + local status = config.get(nil, 'Lua.diagnostics.ignoredFiles') if status == 'Disable' then return elseif status == 'Opened' then @@ -333,14 +333,14 @@ local function askForDisable() end function m.diagnosticsAll(force) - if not force and not config.get 'Lua.diagnostics.enable' then + if not force and not config.get(nil, 'Lua.diagnostics.enable') then m.clearAll() return end if not m._start then return end - local delay = config.get 'Lua.diagnostics.workspaceDelay' / 1000 + local delay = config.get(nil, 'Lua.diagnostics.workspaceDelay') / 1000 if not force and delay < 0 then return end @@ -393,7 +393,7 @@ function m.checkWorkspaceDiag() if not await.hasID 'diagnosticsAll' then return end - local speedRate = config.get 'Lua.diagnostics.workspaceRate' + local speedRate = config.get(nil, 'Lua.diagnostics.workspaceRate') if speedRate <= 0 or speedRate >= 100 then return end diff --git a/script/provider/provider.lua b/script/provider/provider.lua index c0cee9c7..0991b690 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -27,36 +27,37 @@ end ---@async local function updateConfig() - local merged = {} + local baseConfig = {} local cfg = cfgLoader.loadLocalConfig(CONFIGPATH) if cfg then log.debug('load config from local', CONFIGPATH) -- watch directory filewatch.watch(workspace.getAbsolutePath(CONFIGPATH):gsub('[^/\\]+$', '')) - mergeConfig(merged, cfg) + mergeConfig(baseConfig, cfg) + end local rc = cfgLoader.loadRCConfig('.luarc.json') if rc then log.debug('load config from luarc') - mergeConfig(merged, rc) + mergeConfig(baseConfig, rc) end local clientConfig = cfgLoader.loadClientConfig() if clientConfig then log.debug('load config from client') - mergeConfig(merged, clientConfig) + mergeConfig(baseConfig, clientConfig) end - for k, v in pairs(merged) do + for k, v in pairs(baseConfig) do if v == json.null then - merged[k] = nil + baseConfig[k] = nil end end - config.update(merged) - log.debug('loaded config dump:', util.dump(merged)) + config.update(workspace.rootUri,baseConfig) + log.debug('loaded config dump:', util.dump(baseConfig)) end ---@class provider @@ -498,7 +499,7 @@ m.register 'textDocument/completion' { return nil end local triggerCharacter = params.context and params.context.triggerCharacter - if config.get 'editor.acceptSuggestionOnEnter' ~= 'off' then + if config.get(nil, 'editor.acceptSuggestionOnEnter') ~= 'off' then if triggerCharacter == '\n' or triggerCharacter == '{' or triggerCharacter == ',' then @@ -627,7 +628,7 @@ m.register 'textDocument/signatureHelp' { abortByFileUpdate = true, ---@async function (params) - if not config.get 'Lua.signatureHelp.enable' then + if not config.get(nil, 'Lua.signatureHelp.enable') then return nil end workspace.awaitReady() @@ -956,7 +957,7 @@ m.register '$/requestHint' { ---@async function (params) local core = require 'core.hint' - if not config.get 'Lua.hint.enable' then + if not config.get(nil, 'Lua.hint.enable') then return end workspace.awaitReady() @@ -979,7 +980,7 @@ m.register '$/requestHint' { do ---@async local function updateHint(uri) - if not config.get 'Lua.hint.enable' then + if not config.get(nil, 'Lua.hint.enable') then return end local id = 'updateHint' .. uri @@ -1026,7 +1027,7 @@ do end local function refreshStatusBar() - local value = config.get 'Lua.window.statusBar' + local value = config.get(nil, 'Lua.window.statusBar') if value then proto.notify('$/status/show') else diff --git a/script/provider/semantic-tokens.lua b/script/provider/semantic-tokens.lua index 68db9b7f..759a9885 100644 --- a/script/provider/semantic-tokens.lua +++ b/script/provider/semantic-tokens.lua @@ -47,7 +47,7 @@ local function enable() }, } }) - if config.get 'editor.semanticHighlighting.enabled' == 'configuredByTheme' and not dontShowAgain then + if config.get(nil, 'editor.semanticHighlighting.enabled') == 'configuredByTheme' and not dontShowAgain then proto.request('window/showMessageRequest', { type = define.MessageType.Info, message = lang.script.WINDOW_CHECK_SEMANTIC, diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua index dac72f3f..8f24b7d1 100644 --- a/script/service/telemetry.lua +++ b/script/service/telemetry.lua @@ -74,7 +74,7 @@ end timer.wait(5, function () timer.loop(300, function () - if not config.get 'Lua.telemetry.enable' then + if not config.get(nil, 'Lua.telemetry.enable') then return end local suc, link = pcall(net.connect, 'tcp', 'moe-moe.love', 11577) @@ -93,7 +93,7 @@ timer.wait(5, function () end end)() timer.loop(1, function () - if not config.get 'Lua.telemetry.enable' then + if not config.get(nil, 'Lua.telemetry.enable') then return end net.update() @@ -103,7 +103,7 @@ end) local m = {} function m.updateConfig() - if config.get 'Lua.telemetry.enable' ~= nil then + if config.get(nil, 'Lua.telemetry.enable') ~= nil then return end if m.hasShowedMessage then diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua index 3a0765bf..544c1f60 100644 --- a/script/vm/getDocs.lua +++ b/script/vm/getDocs.lua @@ -153,7 +153,7 @@ local function isDeprecated(value) return true elseif doc.type == 'doc.version' then local valids = vm.getValidVersions(doc) - if not valids[config.get 'Lua.runtime.version'] then + if not valids[config.get(nil, 'Lua.runtime.version')] then value._deprecated = true return true end diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua index e2149bac..e6bb6c78 100644 --- a/script/workspace/require-path.lua +++ b/script/workspace/require-path.lua @@ -9,7 +9,7 @@ m.cache = {} --- `aaa/bbb/ccc.lua` 与 `?.lua` 将返回 `aaa.bbb.cccc` local function getOnePath(path, searcher) - local separator = config.get 'Lua.completion.requireSeparator' + local separator = config.get(nil, 'Lua.completion.requireSeparator') local stemPath = path : gsub('%.[^%.]+$', '') : gsub('[/\\%.]+', separator) @@ -28,8 +28,8 @@ local function getOnePath(path, searcher) end function m.getVisiblePath(path) - local searchers = config.get 'Lua.runtime.path' - local strict = config.get 'Lua.runtime.pathStrict' + local searchers = config.get(nil, 'Lua.runtime.path') + local strict = config.get(nil, 'Lua.runtime.pathStrict') path = path:gsub('^[/\\]+', '') local uri = furi.encode(path) local libraryPath = files.getLibraryPath(uri) diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 8b682fde..65b3b1ac 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -30,7 +30,7 @@ m.cache = {} m.watchers = {} m.matchOption = {} ---@type {uri: uri, path: string}[] -m.workSpaces = {} +m.folders = {} function m.initRoot(uri) m.rootUri = uri @@ -47,7 +47,7 @@ end function m.create(uri) log.info('Workspace create: ', uri) local path = m.normalize(furi.decode(uri)) - m.workSpaces[#m.workSpaces+1] = { + m.folders[#m.folders+1] = { uri = uri, path = path, } @@ -92,15 +92,15 @@ function m.getNativeMatcher() end local pattern = {} - -- config.get 'files.exclude' - for path, ignore in pairs(config.get 'files.exclude') do + -- config.get(nil, 'files.exclude' + for path, ignore in pairs(config.get(nil, 'files.exclude')) do if ignore then log.info('Ignore by exclude:', path) pattern[#pattern+1] = path end end - -- config.get 'workspace.useGitIgnore' - if config.get 'Lua.workspace.useGitIgnore' then + -- config.get(nil, 'workspace.useGitIgnore' + if config.get(nil, 'Lua.workspace.useGitIgnore') then local buf = pub.awaitTask('loadFile', furi.encode(m.rootPath .. '/.gitignore')) if buf then for line in buf:gmatch '[^\r\n]+' do @@ -120,8 +120,8 @@ function m.getNativeMatcher() end end end - -- config.get 'workspace.ignoreSubmodules' - if config.get 'Lua.workspace.ignoreSubmodules' then + -- config.get(nil, 'workspace.ignoreSubmodules' + if config.get(nil, 'Lua.workspace.ignoreSubmodules') then local buf = pub.awaitTask('loadFile', furi.encode(m.rootPath .. '/.gitmodules')) if buf then for path in buf:gmatch('path = ([^\r\n]+)') do @@ -130,16 +130,16 @@ function m.getNativeMatcher() end end end - -- config.get 'workspace.library' - for path in pairs(config.get 'Lua.workspace.library') do + -- config.get(nil, 'workspace.library' + for path in pairs(config.get(nil, 'Lua.workspace.library')) do path = m.getAbsolutePath(path) if path then log.info('Ignore by library:', path) pattern[#pattern+1] = path end end - -- config.get 'workspace.ignoreDir' - for _, path in ipairs(config.get 'Lua.workspace.ignoreDir') do + -- config.get(nil, 'workspace.ignoreDir' + for _, path in ipairs(config.get(nil, 'Lua.workspace.ignoreDir')) do log.info('Ignore directory:', path) pattern[#pattern+1] = path end @@ -147,7 +147,7 @@ function m.getNativeMatcher() m.nativeMatcher = glob.gitignore(pattern, m.matchOption, globInteferFace) m.nativeMatcher:setOption('root', m.rootPath) - m.nativeVersion = config.get 'version' + m.nativeVersion = config.get(nil, 'version') return m.nativeMatcher end @@ -158,7 +158,7 @@ function m.getLibraryMatchers() end local librarys = {} - for path in pairs(config.get 'Lua.workspace.library') do + for path in pairs(config.get(nil, 'Lua.workspace.library')) do path = m.getAbsolutePath(path) if path then librarys[m.normalize(path)] = true @@ -181,7 +181,7 @@ function m.getLibraryMatchers() end end - m.libraryVersion = config.get 'version' + m.libraryVersion = config.get(nil, 'version') return m.libraryMatchers end @@ -212,12 +212,12 @@ local function loadFileFactory(root, progressData, isLibrary) return function (path) ---@async local uri = furi.encode(path) if files.isLua(uri) then - if not isLibrary and progressData.preload >= config.get 'Lua.workspace.maxPreload' then + if not isLibrary and progressData.preload >= config.get(nil, 'Lua.workspace.maxPreload') then if not m.hasHitMaxPreload then m.hasHitMaxPreload = true proto.request('window/showMessageRequest', { type = define.MessageType.Info, - message = lang.script('MWS_MAX_PRELOAD', config.get 'Lua.workspace.maxPreload'), + message = lang.script('MWS_MAX_PRELOAD', config.get(nil, 'Lua.workspace.maxPreload')), actions = { { title = lang.script.WINDOW_INCREASE_UPPER_LIMIT, @@ -235,8 +235,8 @@ local function loadFileFactory(root, progressData, isLibrary) { key = 'Lua.workspace.maxPreload', action = 'set', - value = config.get 'Lua.workspace.maxPreload' - + math.max(1000, config.get 'Lua.workspace.maxPreload'), + value = config.get(nil, 'Lua.workspace.maxPreload') + + math.max(1000, config.get(nil, 'Lua.workspace.maxPreload')), } } end @@ -404,7 +404,7 @@ function m.findUrisByFilePath(path) return resultCache[path].results, resultCache[path].posts end tracy.ZoneBeginN('findUrisByFilePath #1') - local strict = config.get 'Lua.runtime.pathStrict' + local strict = config.get(nil, 'Lua.runtime.pathStrict') local results = {} local posts = {} for uri in files.eachFile() do @@ -463,7 +463,7 @@ function m.findUrisByRequirePath(path) local input = path:gsub('%.', '/') :gsub('%%', '%%%%') - for _, luapath in ipairs(config.get 'Lua.runtime.path') do + for _, luapath in ipairs(config.get(nil, 'Lua.runtime.path')) do local part = m.normalize(luapath:gsub('%?', input)) local uris, posts = m.findUrisByFilePath(part) for _, uri in ipairs(uris) do diff --git a/test/completion/common.lua b/test/completion/common.lua index 60a5f2ac..fad0df8e 100644 --- a/test/completion/common.lua +++ b/test/completion/common.lua @@ -1,10 +1,10 @@ local define = require 'proto.define' local config = require 'config' -config.set('Lua.completion.callSnippet', 'Both') -config.set('Lua.completion.keywordSnippet', 'Both') -config.set('Lua.completion.workspaceWord', false) -config.set('Lua.completion.showWord', 'Enable') +config.set(nil, 'Lua.completion.callSnippet', 'Both') +config.set(nil, 'Lua.completion.keywordSnippet', 'Both') +config.set(nil, 'Lua.completion.workspaceWord', false) +config.set(nil, 'Lua.completion.showWord', 'Enable') TEST [[ local zabcde @@ -805,7 +805,7 @@ print(io.<??>) ]] (EXISTS) -require 'config'.set('Lua.runtime.version', 'Lua 5.4') +require 'config'.set(nil, 'Lua.runtime.version', 'Lua 5.4') --TEST [[ --local <??> --]] @@ -2402,7 +2402,7 @@ end ]] (EXISTS) -config.set('Lua.completion.callSnippet', 'Disable') +config.set(nil, 'Lua.completion.callSnippet', 'Disable') TEST [[ GGG = 1 diff --git a/test/completion/continue.lua b/test/completion/continue.lua index 63f970e9..83eaf270 100644 --- a/test/completion/continue.lua +++ b/test/completion/continue.lua @@ -1,9 +1,9 @@ local define = require 'proto.define' local config = require 'config' -config.set('Lua.completion.callSnippet', 'Disable') -config.set('Lua.completion.keywordSnippet', 'Disable') -config.set('Lua.completion.workspaceWord', false) +config.set(nil, 'Lua.completion.callSnippet', 'Disable') +config.set(nil, 'Lua.completion.keywordSnippet', 'Disable') +config.set(nil, 'Lua.completion.workspaceWord', false) ContinueTyping = true diff --git a/test/crossfile/allreferences.lua b/test/crossfile/allreferences.lua index 6c7febeb..2753d785 100644 --- a/test/crossfile/allreferences.lua +++ b/test/crossfile/allreferences.lua @@ -68,7 +68,7 @@ TEST { }, } -config.set('Lua.IntelliSense.traceBeSetted', true) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) TEST { { path = 'a.lua', @@ -215,5 +215,4 @@ TEST { ]] }, } -config.set('Lua.IntelliSense.traceBeSetted', false) - +config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 50ebad45..c608ccab 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -307,8 +307,8 @@ TEST { } } -local originSeparator = config.get 'Lua.completion.requireSeparator' -config.set('Lua.completion.requireSeparator', '/') +local originSeparator = config.get(nil, 'Lua.completion.requireSeparator') +config.set(nil, 'Lua.completion.requireSeparator', '/') TEST { { path = 'abc.lua', @@ -331,7 +331,7 @@ TEST { }, } } -config.set('Lua.completion.requireSeparator', originSeparator) +config.set(nil, 'Lua.completion.requireSeparator', originSeparator) TEST { { @@ -390,8 +390,8 @@ TEST { } -local originRuntimePath = config.get 'Lua.runtime.path' -config.set('Lua.runtime.path', { +local originRuntimePath = config.get(nil, 'Lua.runtime.path') +config.set(nil, 'Lua.runtime.path', { '?/1.lua', }) @@ -419,10 +419,10 @@ TEST { } } -config.set('Lua.runtime.path', originRuntimePath) +config.set(nil, 'Lua.runtime.path', originRuntimePath) -local originRuntimePath = config.get 'Lua.runtime.path' -config.set('Lua.runtime.path', { +local originRuntimePath = config.get(nil, 'Lua.runtime.path') +config.set(nil, 'Lua.runtime.path', { 'D:/?/1.lua', }) @@ -445,7 +445,7 @@ TEST { } } -config.set('Lua.runtime.path', originRuntimePath) +config.set(nil, 'Lua.runtime.path', originRuntimePath) TEST { { @@ -627,7 +627,7 @@ TEST { } } -config.set('Lua.runtime.pathStrict', true) +config.set(nil, 'Lua.runtime.pathStrict', true) TEST { { path = 'f/a.lua' }, @@ -672,7 +672,7 @@ TEST { } } -config.set('Lua.runtime.pathStrict', false) +config.set(nil, 'Lua.runtime.pathStrict', false) TEST { { @@ -960,7 +960,7 @@ TEST { completion = EXISTS } -config.prop('Lua.runtime.special', 'import', 'require') +config.prop(nil, 'Lua.runtime.special', 'import', 'require') TEST { { path = 'abcde.lua', content = '' }, { diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index 058f5d18..8f4dd7e8 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -117,7 +117,7 @@ TEST { }, } -config.set('Lua.runtime.pathStrict', true) +config.set(nil, 'Lua.runtime.pathStrict', true) TEST { { path = 'aaa/bbb.lua', @@ -140,7 +140,7 @@ TEST { }, } -config.set('Lua.runtime.pathStrict', false) +config.set(nil, 'Lua.runtime.pathStrict', false) TEST { { @@ -740,8 +740,8 @@ TEST { } platform.OS = originOS -local originRuntimePath = config.get 'Lua.runtime.path' -config.set('Lua.runtime.path', { +local originRuntimePath = config.get(nil, 'Lua.runtime.path') +config.set(nil, 'Lua.runtime.path', { '?/1.lua', }) TEST { @@ -760,7 +760,7 @@ TEST { }, } -config.set('Lua.runtime.path', { +config.set(nil, 'Lua.runtime.path', { 'D:/?/1.lua', }) TEST { @@ -778,7 +778,7 @@ TEST { ]], }, } -config.set('Lua.runtime.path', originRuntimePath) +config.set(nil, 'Lua.runtime.path', originRuntimePath) TEST { { @@ -795,7 +795,7 @@ TEST { }, } -config.set('Lua.IntelliSense.traceFieldInject', true) +config.set(nil, 'Lua.IntelliSense.traceFieldInject', true) TEST { { path = 'a.lua', @@ -816,7 +816,7 @@ print(b.<?test?>) ]] } } -config.set('Lua.IntelliSense.traceFieldInject', false) +config.set(nil, 'Lua.IntelliSense.traceFieldInject', false) TEST { { diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua index c2d043f4..9bdce197 100644 --- a/test/crossfile/diagnostic.lua +++ b/test/crossfile/diagnostic.lua @@ -5,8 +5,8 @@ local config = require 'config' local platform = require 'bee.platform' local catch = require 'catch' -config.get 'Lua.diagnostics.neededFileStatus'['deprecated'] = 'Any' -config.get 'Lua.diagnostics.neededFileStatus'['type-check'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['deprecated'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['type-check'] = 'Any' rawset(_G, 'TEST', true) diff --git a/test/definition/bug.lua b/test/definition/bug.lua index 7a2cc789..e8733636 100644 --- a/test/definition/bug.lua +++ b/test/definition/bug.lua @@ -172,7 +172,7 @@ string.xx:<?format?>() --v.<?bar1?> --]] -config.set('Lua.IntelliSense.traceLocalSet', true) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST [[ local A, B @@ -232,7 +232,7 @@ end local <!b!> = B:get() print(<?b?>) ]] -config.set('Lua.IntelliSense.traceLocalSet', false) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST [[ g[a.b.c] = 1 diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 558ffc26..3dfd6518 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -4,9 +4,9 @@ local config = require 'config' local util = require 'utility' local catch = require 'catch' -config.get 'Lua.diagnostics.neededFileStatus'['deprecated'] = 'Any' -config.get 'Lua.diagnostics.neededFileStatus'['type-check'] = 'Any' -config.get 'Lua.diagnostics.neededFileStatus'['await-in-sync'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['deprecated'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['type-check'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['await-in-sync'] = 'Any' rawset(_G, 'TEST', true) @@ -177,7 +177,7 @@ local _ENV = { print = print } print(1) ]] -config.get 'Lua.diagnostics.disable'['undefined-env-child'] = true +config.get(nil, 'Lua.diagnostics.disable')['undefined-env-child'] = true TEST [[ _ENV = nil <!GLOBAL!> = 1 --> _ENV.GLOBAL = 1 @@ -203,7 +203,7 @@ GLOBAL = 1 _ENV = nil ]] -config.get 'Lua.diagnostics.disable'['undefined-env-child'] = nil +config.get(nil, 'Lua.diagnostics.disable')['undefined-env-child'] = nil TEST [[ <!print() ('string')!>:sub(1, 1) @@ -315,17 +315,17 @@ return [[ ]] ]=] -config.get 'Lua.diagnostics.disable'['close-non-object'] = true +config.get(nil, 'Lua.diagnostics.disable')['close-non-object'] = true TEST [[ local _ <close> = function () end ]] -config.get 'Lua.diagnostics.disable'['close-non-object'] = nil +config.get(nil, 'Lua.diagnostics.disable')['close-non-object'] = nil TEST [[ local _ <close> = <!1!> ]] -config.get 'Lua.diagnostics.disable'['unused-local'] = true +config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = true TEST [[ local f = <!function () end!> ]] @@ -338,7 +338,7 @@ TEST [[ local <!function f() end!> ]] -config.get 'Lua.diagnostics.disable'['unused-local'] = nil +config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = nil TEST [[ local mt, x function mt:m() @@ -1427,7 +1427,7 @@ end X = f() ]] -config.get 'Lua.diagnostics.neededFileStatus'['not-yieldable'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['not-yieldable'] = 'Any' TEST [[ local function f(cb) return cb diff --git a/test/full/example.lua b/test/full/example.lua index 0505f1a5..c0ce23ee 100644 --- a/test/full/example.lua +++ b/test/full/example.lua @@ -10,7 +10,7 @@ local noder = require 'core.noder' -- 临时 ---@diagnostic disable: await-in-sync local function testIfExit(path) - config.set('Lua.workspace.preloadFileSize', 1000000000) + config.set(nil, 'Lua.workspace.preloadFileSize', 1000000000) local buf = util.loadFile(path:string()) if buf then local state diff --git a/test/full/init.lua b/test/full/init.lua index 9584db6f..e83a7d6d 100644 --- a/test/full/init.lua +++ b/test/full/init.lua @@ -12,9 +12,9 @@ function TEST(script) end local function startCollectDiagTimes() - for name in pairs(config.get 'Lua.diagnostics.neededFileStatus') do + for name in pairs(config.get(nil, 'Lua.diagnostics.neededFileStatus')) do if name ~= 'no-implicit-any' then - --config.get 'Lua.diagnostics.neededFileStatus'[name] = 'Any' + --config.get(nil, 'Lua.diagnostics.neededFileStatus')[name] = 'Any' end end DIAGTIMES = {} diff --git a/test/full/projects.lua b/test/full/projects.lua index a095f316..7beaa026 100644 --- a/test/full/projects.lua +++ b/test/full/projects.lua @@ -6,8 +6,8 @@ local config = require 'config' local ws = require 'workspace' local fs = require 'bee.filesystem' -config.set('Lua.workspace.preloadFileSize', 1000000) -config.set('Lua.diagnostics.neededFileStatus', { +config.set(nil, 'Lua.workspace.preloadFileSize', 1000000) +config.set(nil, 'Lua.diagnostics.neededFileStatus', { ['await-in-sync'] = 'Any', ['not-yieldable'] = 'Any', }) diff --git a/test/hover/init.lua b/test/hover/init.lua index 15bf60d4..35274384 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -838,7 +838,7 @@ local t: { } ]] -config.set('Lua.IntelliSense.traceLocalSet', true) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST [[ local x x = 1 @@ -849,7 +849,7 @@ print(<?x?>) [[ local x: number = 1 ]] -config.set('Lua.IntelliSense.traceLocalSet', false) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST [[ local <?x?> <close> = 1 @@ -1730,7 +1730,7 @@ t.<?x?>() field t.x: any ]] -config.set('Lua.IntelliSense.traceLocalSet', true) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST [[ ---@class A local a @@ -1743,7 +1743,7 @@ print(b.<?x?>) [[ field A.x: any ]] -config.set('Lua.IntelliSense.traceLocalSet', false) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST [[ ---@class A @@ -1793,11 +1793,11 @@ local <?f?> local f: async fun() ]] -config.set('Lua.runtime.nonstandardSymbol', { '//' }) +config.set(nil, 'Lua.runtime.nonstandardSymbol', { '//' }) TEST [[ local <?x?> = 1 // 2 ]] [[ local x: integer = 1 ]] -config.set('runtime.nonstandardSymbol', {}) +config.set(nil, 'runtime.nonstandardSymbol', {}) diff --git a/test/references/all.lua b/test/references/all.lua index cbe8ebb5..4ba63579 100644 --- a/test/references/all.lua +++ b/test/references/all.lua @@ -78,7 +78,7 @@ end local _, <!f2!> = f() ]] -config.set('Lua.IntelliSense.traceReturn', true) +config.set(nil, 'Lua.IntelliSense.traceReturn', true) TEST [[ local <?x?> local function f() @@ -96,7 +96,7 @@ local function f() end local <!y!> = f()() ]] -config.set('Lua.IntelliSense.traceReturn', false) +config.set(nil, 'Lua.IntelliSense.traceReturn', false) TEST [[ ---@class A diff --git a/test/references/common.lua b/test/references/common.lua index 20ddd353..b46aa81f 100644 --- a/test/references/common.lua +++ b/test/references/common.lua @@ -96,7 +96,7 @@ t.x = 1 t[a.b.<?x?>] = 1 ]] -config.set('Lua.IntelliSense.traceBeSetted', true) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) TEST [[ local t local <!f!> = t.<?f?> @@ -107,7 +107,7 @@ return { <!f!> = <!f!>, } ]] -config.set('Lua.IntelliSense.traceBeSetted', false) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) TEST [[ self = { @@ -142,7 +142,7 @@ a.<!b!>.c = 1 print(a.<?b?>.c) ]] -config.set('Lua.IntelliSense.traceBeSetted', true) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) TEST [[ local <?f?> local t = { @@ -150,14 +150,14 @@ local t = { } print(t.<!a!>) ]] -config.set('Lua.IntelliSense.traceBeSetted', false) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) TEST [[ local <!f!> local <!t!> = <?f?> ]] -config.set('Lua.IntelliSense.traceBeSetted', true) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) TEST [[ local <!f!> a.<!t!> = <?f?> @@ -166,19 +166,19 @@ a.<!t!> = <?f?> TEST [[ <!t!>.<!f!> = <?t?> ]] -config.set('Lua.IntelliSense.traceBeSetted', false) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) TEST [[ local <!f!> local <?t?> = <!f!> ]] -config.set('Lua.IntelliSense.traceBeSetted', true) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) TEST [[ local <!t!> <!t!>.<!f!> = <?t?> ]] -config.set('Lua.IntelliSense.traceBeSetted', false) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) TEST [[ _G.<?xxx?> = 1 diff --git a/test/rename/init.lua b/test/rename/init.lua index 774c86d2..29e6f1a6 100644 --- a/test/rename/init.lua +++ b/test/rename/init.lua @@ -90,7 +90,7 @@ local function f(b) end ]] -config.set('Lua.IntelliSense.traceBeSetted', true) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) TEST ('a', '!!!') [[ t = { a = 0 @@ -118,7 +118,7 @@ t = { t["!!!"] = 1 a = t["!!!"] ]] -config.set('Lua.IntelliSense.traceBeSetted', false) +config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) TEST ('a', '"') [[ print(t[ "a" ]) diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 36357771..284ca023 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -57,7 +57,7 @@ local var = '111' t.<?x?> = var ]] -config.set('Lua.IntelliSense.traceLocalSet', true) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST 'string' [[ local <?var?> var = '111' @@ -68,7 +68,7 @@ local var var = '111' print(<?var?>) ]] -config.set('Lua.IntelliSense.traceLocalSet', false) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST 'function' [[ function <?xx?>() @@ -80,13 +80,13 @@ local function <?xx?>() end ]] -config.set('Lua.IntelliSense.traceLocalSet', true) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST 'function' [[ local xx <?xx?> = function () end ]] -config.set('Lua.IntelliSense.traceLocalSet', false) +config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST 'table' [[ local <?t?> = {} @@ -748,25 +748,25 @@ TEST 'function' [[ string.gsub():gsub():<?gsub?>() ]] -config.set('Lua.hover.enumsLimit', 5) +config.set(nil, 'Lua.hover.enumsLimit', 5) TEST 'a|b|c|d|e...(+5)' [[ ---@type 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j' local <?t?> ]] -config.set('Lua.hover.enumsLimit', 1) +config.set(nil, 'Lua.hover.enumsLimit', 1) TEST 'a...(+9)' [[ ---@type 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j' local <?t?> ]] -config.set('Lua.hover.enumsLimit', 0) +config.set(nil, 'Lua.hover.enumsLimit', 0) TEST '...(+10)' [[ ---@type 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j' local <?t?> ]] -config.set('Lua.hover.enumsLimit', 5) +config.set(nil, 'Lua.hover.enumsLimit', 5) TEST 'string|fun():string' [[ ---@type string | fun(): string |