summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-06 17:12:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-06 17:12:47 +0800
commitd119c1cefff8a6a2812ac10375297f033a8cf5f0 (patch)
tree273cfcb6f8bc656bed3390ec34c0b3a25c37dca1 /server/src
parent607d9f9aa196cf75a68084c4d505602d2e491c57 (diff)
downloadlua-language-server-d119c1cefff8a6a2812ac10375297f033a8cf5f0.zip
调整一下样式
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/hover.lua22
1 files changed, 12 insertions, 10 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua
index 09d2f168..2b78216a 100644
--- a/server/src/matcher/hover.lua
+++ b/server/src/matcher/hover.lua
@@ -13,11 +13,12 @@ local function buildArgs(lib)
if i > 1 then
strs[#strs+1] = ', '
end
- strs[#strs+1] = rtn.name or ('arg' .. tostring(i))
- strs[#strs+1] = ':'
- strs[#strs+1] = rtn.type or 'any'
+ strs[#strs+1] = ('%s:%s'):format(
+ rtn.name or ('arg' .. tostring(i)),
+ (rtn.type or 'any')
+ )
if rtn.default then
- strs[#strs+1] = (':%q'):format(rtn.default)
+ strs[#strs+1] = ('(%q)'):format(rtn.default)
end
if rtn.optional then
strs[#strs+1] = ']'
@@ -38,11 +39,12 @@ local function buildReturns(lib)
if i > 1 then
strs[#strs+1] = ', '
end
- strs[#strs+1] = rtn.name or ('res' .. tostring(i))
- strs[#strs+1] = ':'
- strs[#strs+1] = rtn.type or 'any'
+ strs[#strs+1] = ('%s:%s'):format(
+ rtn.name or ('res' .. tostring(i)),
+ (rtn.type or 'any')
+ )
if rtn.default then
- strs[#strs+1] = (':%q'):format(rtn.default)
+ strs[#strs+1] = ('(%q)'):format(rtn.default)
end
if rtn.optional then
strs[#strs+1] = ']'
@@ -52,9 +54,9 @@ local function buildReturns(lib)
end
local function buildFunctionHover(lib, name)
- local title = ('```lua\n%s(%s)%s\n```'):format(name, buildArgs(lib), buildReturns(lib))
+ local title = ('function %s(%s)%s'):format(name, buildArgs(lib), buildReturns(lib))
local tip = lib.description or ''
- return ('%s\n\n%s'):format(title, tip)
+ return ('```lua\n%s\n```\n%s'):format(title, tip)
end
return function (results, pos)