summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/meta/Lua 5.4/basic.lua30
-rw-r--r--server/src/method/textDocument/hover.lua2
-rw-r--r--server/test/hover/init.lua4
3 files changed, 24 insertions, 12 deletions
diff --git a/server/meta/Lua 5.4/basic.lua b/server/meta/Lua 5.4/basic.lua
index 637d9aec..25e4a43a 100644
--- a/server/meta/Lua 5.4/basic.lua
+++ b/server/meta/Lua 5.4/basic.lua
@@ -6,8 +6,7 @@ arg = {}
---@param v any
---@param message any {optional = 'self'}
---@return any
-function assert(v, message)
-end
+function assert(v, message) end
---@alias GCOption string
---| > '"collect"' # 做一次完整的垃圾收集循环。
@@ -25,21 +24,22 @@ end
---@param opt GCOption {optional = 'after'}
---@param arg integer {optional = 'self'}
---@return any
-function collectgarbage(opt, arg)
-end
+function collectgarbage(opt, arg) end
---- 当前解释器版本号。
-_VERSION = 'Lua 5.4'
+--- 打开该名字的文件,并执行文件中的 Lua 代码块。
+---@param filename string {optional = 'self'}
+---@return any
+function dofile(filename) end
+
+--- 内部储存有全局环境。
+_G = {}
--- 返回该键的下一个键及其关联的值。
---@param t table
---@param index any {optional = 'self'}
---@return any {name = 'key'}
---@return any {name = 'value'}
-local function next(t, index)
-end
-
-_G['next'] = next
+function next(t, index) end
--- 能迭代表 `t` 中的所有键值对。
---|```lua
@@ -52,5 +52,15 @@ _G['next'] = next
---@return table {name = 't'}
---@return any {name = 'key'}
function pairs(t)
+ --- 返回该键的下一个键及其关联的值。
+ ---@param t table
+ ---@param index any {optional = 'self'}
+ ---@return any {name = 'key'}
+ ---@return any {name = 'value'}
+ local function next(t, index) end
+
return next, t, nil
end
+
+--- 当前解释器版本号。
+_VERSION = 'Lua 5.4'
diff --git a/server/src/method/textDocument/hover.lua b/server/src/method/textDocument/hover.lua
index c8645d2b..f127c8a8 100644
--- a/server/src/method/textDocument/hover.lua
+++ b/server/src/method/textDocument/hover.lua
@@ -22,6 +22,8 @@ return function (lsp, params)
local text = ([[
```lua
%s
+```
+```lua
%s
```
%s
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index 67188d75..e77d4ea3 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -824,8 +824,8 @@ function f([x: number [, y: boolean], z: string])
]=]
TEST [[
----@return any {name = 'key'}
----@return any {name = 'value'}
+---@return string {name = 'key'}
+---@return string {name = 'value'}
function <?f?>() end
]]
[=[