summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/provider/provider.lua8
-rw-r--r--script/vm/memoryAPI.lua34
2 files changed, 42 insertions, 0 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index dbeb9804..57346dcc 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -21,6 +21,7 @@ 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)
@@ -1338,6 +1339,13 @@ m.register 'workspace/diagnostic' {
end
}
+m.register '$/api/report' {
+ ---@async
+ function (params)
+ vm.saveMemoryAPI(params)
+ end
+}
+
local function refreshStatusBar()
local valid = config.get(nil, 'Lua.window.statusBar')
for _, scp in ipairs(workspace.folders) do
diff --git a/script/vm/memoryAPI.lua b/script/vm/memoryAPI.lua
new file mode 100644
index 00000000..079687d7
--- /dev/null
+++ b/script/vm/memoryAPI.lua
@@ -0,0 +1,34 @@
+---@class vm
+---@field memoryAPI? table
+local vm = require 'vm.vm'
+
+---@class vm.memoryAPI
+---@field root string
+---@field classes vm.memoryAPI.class[]
+
+---@class vm.memoryAPI.class
+---@field namespace string
+---@field baseClass string
+---@field attribute string
+---@field integerface string[]
+---@field fields vm.memoryAPI.field[]
+---@field methods vm.memoryAPI.method[]
+
+---@class vm.memoryAPI.field
+---@field name string
+---@field typeName string
+---@field comment string
+---@field location string
+
+---@class vm.memoryAPI.method
+---@field name string
+---@field comment string
+---@field location string
+---@field isStatic boolean
+---@field returnTypeName string
+---@field params {name: string, typeName: string}[]
+
+---@param api vm.memoryAPI
+function vm.saveMemoryAPI(api)
+ vm.memoryAPI = api
+end