summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-10 18:12:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-10 18:12:16 +0800
commitc226b214cbbf23a39ec3a065c9cadc5e17acd883 (patch)
tree61928d7d14eb8cb50cf04498df5865a023052357
parentb1f2b789ac1271f2a270253a086bae377bbb14cb (diff)
downloadlua-language-server-c226b214cbbf23a39ec3a065c9cadc5e17acd883.zip
暂存
-rw-r--r--script-beta/parser/luadoc.lua13
-rw-r--r--test-beta/crossfile/hover.lua6
2 files changed, 13 insertions, 6 deletions
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua
index 05dfcbe6..6cdd7491 100644
--- a/script-beta/parser/luadoc.lua
+++ b/script-beta/parser/luadoc.lua
@@ -4,7 +4,7 @@ local lines = require 'parser.lines'
local guide = require 'parser.guide'
local TokenTypes, TokenStarts, TokenFinishs, TokenContents
-local Ci, Offset, pushError
+local Ci, Offset, pushError, Ct
local parseType
local Parser = re.compile([[
Main <- (Token / Sp)*
@@ -111,7 +111,12 @@ Symbol <- ({} {
end,
})
+local function trim(str)
+ return str:match '^%s*(%S+)%s*$'
+end
+
local function parseTokens(text, offset)
+ Ct = offset
Ci = 0
Offset = offset
TokenTypes = {}
@@ -629,6 +634,12 @@ local function parseResume()
local result = {
type = 'doc.resume'
}
+
+ if checkToken('symbol', '>', 1) then
+ nextToken()
+ result.default = true
+ end
+
local tp = peekToken()
if tp ~= 'string' then
pushError {
diff --git a/test-beta/crossfile/hover.lua b/test-beta/crossfile/hover.lua
index a049a66a..c743f7a5 100644
--- a/test-beta/crossfile/hover.lua
+++ b/test-beta/crossfile/hover.lua
@@ -294,7 +294,6 @@ TEST {
}
}
-do return end
TEST {
{
path = 'a.lua',
@@ -312,10 +311,7 @@ TEST {
hover = {
label = 'function f(x: string)',
name = 'f',
- args = EXISTS,
- rawEnum = EXISTS,
- enum = [[
-
+ description = [[
x: string
| '选项1' -- 注释1
|>'选项2' -- 注释2]]