summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-12 21:07:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-12 21:07:13 +0800
commit4c64ad0cbfc659766ed6f296219a30faf55202d8 (patch)
treeaed66e68ff4c6fff3501a7938ab200166f809b79 /script/provider
parentd9d65f5720ec8f9052e84f839161a781613592d3 (diff)
downloadlua-language-server-4c64ad0cbfc659766ed6f296219a30faf55202d8.zip
update
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/build-meta.lua56
-rw-r--r--script/provider/provider.lua3
2 files changed, 57 insertions, 2 deletions
diff --git a/script/provider/build-meta.lua b/script/provider/build-meta.lua
new file mode 100644
index 00000000..0da5d05c
--- /dev/null
+++ b/script/provider/build-meta.lua
@@ -0,0 +1,56 @@
+local fs = require 'bee.filesystem'
+local config = require 'config'
+local util = require 'utility'
+
+local m = {}
+
+---@class meta
+---@field root string
+---@field classes meta.class[]
+
+---@class meta.class
+---@field namespace string
+---@field baseClass string
+---@field attribute string
+---@field integerface string[]
+---@field fields meta.field[]
+---@field methods meta.method[]
+
+---@class meta.field
+---@field name string
+---@field typeName string
+---@field comment string
+---@field location string
+
+---@class meta.method
+---@field name string
+---@field comment string
+---@field location string
+---@field isStatic boolean
+---@field returnTypeName string
+---@field params {name: string, typeName: string}[]
+
+---@param api meta
+---@return string
+local function buildText(api)
+ local lines = {}
+ for _, class in ipairs(api.classes) do
+
+ end
+
+ lines[#lines+1] = ''
+ return table.concat(lines, '\n')
+end
+
+---@param name string
+---@param api meta
+function m.build(name, api)
+ local encoding = config.get(nil, 'Lua.runtime.fileEncoding')
+ local filePath = fs.path(METAPATH) / (name .. ' ' .. encoding .. '.lua')
+
+ local text = buildText(api)
+
+ util.saveFile(filePath:string(), text)
+end
+
+return m
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 57346dcc..11b713bc 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -21,7 +21,6 @@ local furi = require 'file-uri'
local inspect = require 'inspect'
local markdown = require 'provider.markdown'
local guide = require 'parser.guide'
-local vm = require 'vm.vm'
---@async
local function updateConfig(uri)
@@ -1342,7 +1341,7 @@ m.register 'workspace/diagnostic' {
m.register '$/api/report' {
---@async
function (params)
- vm.saveMemoryAPI(params)
+ require 'provider.build-meta'.build('reported', params)
end
}