diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-13 18:33:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-13 18:39:45 +0800 |
commit | 401845e565a36aeb5b4725722da105687fda6e48 (patch) | |
tree | 4333a8483398bdbec0b4d2b9dfa7ef41253ff49d | |
parent | cac6e46759aa7f179391ad7331070ac8f10162ab (diff) | |
download | lua-language-server-401845e565a36aeb5b4725722da105687fda6e48.zip |
modify library
-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 } |