summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-09 20:00:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-09 20:00:38 +0800
commit19e05519b9bd0ec913e4b19913fb5f8288102021 (patch)
tree94ef24a56612e6939b1514ddc4719c2103478cee /script-beta
parentfc0a565b7bbc6b428d559e2981ae2719717ffb30 (diff)
downloadlua-language-server-19e05519b9bd0ec913e4b19913fb5f8288102021.zip
doc.return.name 用语义着色实现
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/semantic-tokens.lua7
-rw-r--r--script-beta/parser/guide.lua2
-rw-r--r--script-beta/parser/luadoc.lua1
3 files changed, 9 insertions, 1 deletions
diff --git a/script-beta/core/semantic-tokens.lua b/script-beta/core/semantic-tokens.lua
index 7ebe5de2..0aceca92 100644
--- a/script-beta/core/semantic-tokens.lua
+++ b/script-beta/core/semantic-tokens.lua
@@ -100,6 +100,13 @@ Care['getlocal'] = function (source, results)
}
end
Care['setlocal'] = Care['getlocal']
+Care['doc.return.name'] = function (source, results)
+ results[#results+1] = {
+ start = source.start,
+ finish = source.finish,
+ type = define.TokenTypes.parameter,
+ }
+end
local function buildTokens(results, text, lines)
local tokens = {}
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 43db26fe..c9f4eb48 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -85,7 +85,7 @@ m.childMap = {
['doc'] = {'#'},
['doc.class'] = {'class', 'extends'},
- ['doc.type'] = {'#types', '#enums'},
+ ['doc.type'] = {'#types', '#enums', 'name'},
['doc.alias'] = {'alias', 'extends'},
['doc.param'] = {'param', 'extends'},
['doc.return'] = {'#returns'},
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua
index 13d80874..59d2e9b9 100644
--- a/script-beta/parser/luadoc.lua
+++ b/script-beta/parser/luadoc.lua
@@ -483,6 +483,7 @@ local function parseReturn()
if not result.start then
result.start = docType.start
end
+ docType.name = parseName('doc.return.name', docType)
if checkToken('symbol', '?', 1) then
nextToken()
docType.optional = true