diff options
-rw-r--r-- | script/provider/build-meta.lua | 5 | ||||
-rw-r--r-- | script/provider/provider.lua | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/script/provider/build-meta.lua b/script/provider/build-meta.lua index 9466301a..a1900e5e 100644 --- a/script/provider/build-meta.lua +++ b/script/provider/build-meta.lua @@ -1,6 +1,7 @@ local fs = require 'bee.filesystem' local config = require 'config' local util = require 'utility' +local await = require 'await' local m = {} @@ -120,8 +121,10 @@ local function buildRootText(api) return table.concat(lines, '\n') end +---@async ---@param name string ---@param api meta +---@return string function m.build(name, api) local encoding = config.get(nil, 'Lua.runtime.fileEncoding') local fileDir = fs.path(METAPATH) / (name .. ' ' .. encoding) @@ -137,12 +140,14 @@ function m.build(name, api) local space = class.namespace ~= '' and class.namespace or api.root local text = buildText(api.root, class) files[space][#files[space]+1] = text + await.delay() end for space, texts in pairs(files) do util.saveFile((fileDir / (space .. '.lua')):string(), table.concat(texts, '\n\n')) end + return fileDir:string() end return m diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 451a3fc4..26c0a777 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -1341,7 +1341,15 @@ m.register 'workspace/diagnostic' { m.register '$/api/report' { ---@async function (params) - require 'provider.build-meta'.build('default', params) + local buildMeta = require 'provider.build-meta' + local dir = buildMeta.build('default', params) + client.setConfig { + { + key = 'Lua.runtime.library', + action = 'add', + value = dir, + } + } end } |