Skip to content

Commit 4c64ad0

Browse files
committed
update
1 parent d9d65f5 commit 4c64ad0

File tree

6 files changed

+76
-36
lines changed

6 files changed

+76
-36
lines changed

script/provider/build-meta.lua

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
local fs = require 'bee.filesystem'
2+
local config = require 'config'
3+
local util = require 'utility'
4+
5+
local m = {}
6+
7+
---@class meta
8+
---@field root string
9+
---@field classes meta.class[]
10+
11+
---@class meta.class
12+
---@field namespace string
13+
---@field baseClass string
14+
---@field attribute string
15+
---@field integerface string[]
16+
---@field fields meta.field[]
17+
---@field methods meta.method[]
18+
19+
---@class meta.field
20+
---@field name string
21+
---@field typeName string
22+
---@field comment string
23+
---@field location string
24+
25+
---@class meta.method
26+
---@field name string
27+
---@field comment string
28+
---@field location string
29+
---@field isStatic boolean
30+
---@field returnTypeName string
31+
---@field params {name: string, typeName: string}[]
32+
33+
---@param api meta
34+
---@return string
35+
local function buildText(api)
36+
local lines = {}
37+
for _, class in ipairs(api.classes) do
38+
39+
end
40+
41+
lines[#lines+1] = ''
42+
return table.concat(lines, '\n')
43+
end
44+
45+
---@param name string
46+
---@param api meta
47+
function m.build(name, api)
48+
local encoding = config.get(nil, 'Lua.runtime.fileEncoding')
49+
local filePath = fs.path(METAPATH) / (name .. ' ' .. encoding .. '.lua')
50+
51+
local text = buildText(api)
52+
53+
util.saveFile(filePath:string(), text)
54+
end
55+
56+
return m

script/provider/provider.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ local furi = require 'file-uri'
2121
local inspect = require 'inspect'
2222
local markdown = require 'provider.markdown'
2323
local guide = require 'parser.guide'
24-
local vm = require 'vm.vm'
2524

2625
---@async
2726
local function updateConfig(uri)
@@ -1342,7 +1341,7 @@ m.register 'workspace/diagnostic' {
13421341
m.register '$/api/report' {
13431342
---@async
13441343
function (params)
1345-
vm.saveMemoryAPI(params)
1344+
require 'provider.build-meta'.build('reported', params)
13461345
end
13471346
}
13481347

script/vm/memoryAPI.lua

Lines changed: 0 additions & 34 deletions
This file was deleted.
File renamed without changes.

test/tclient/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ require 'tclient.tests.resolve-completion'
88
require 'tclient.tests.performance-jass-common'
99
require 'tclient.tests.hover-pairs'
1010
require 'tclient.tests.change-workspace-folder'
11+
require 'tclient.tests.build-meta'

test/tclient/tests/build-meta.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
local lclient = require 'lclient'
2+
local util = require 'utility'
3+
local ws = require 'workspace'
4+
local json = require 'json'
5+
6+
---@async
7+
lclient():start(function (client)
8+
client:registerFakers()
9+
10+
client:initialize()
11+
12+
local text = util.loadFile((ROOT / 'test' / 'example' / 'meta.json'):string())
13+
local meta = json.decode(text)
14+
15+
client:notify('$/api/report', meta)
16+
17+
ws.awaitReady()
18+
end)

0 commit comments

Comments
 (0)