summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-16 21:06:06 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-16 21:06:06 +0800
commit5aaecf51b9fccddf52ed3e4749757a03819fae61 (patch)
tree87ceb62c6eb926cb54d8ba794697f0d3ddd0b1e3 /script/parser
parenta6798e6adb81da6b7f833bc39da0a6368178a090 (diff)
downloadlua-language-server-5aaecf51b9fccddf52ed3e4749757a03819fae61.zip
support `---@meta [name]`
once declared `name`, user can only require this file by declared name meta file can not be required with name `_`
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua1
-rw-r--r--script/parser/luadoc.lua2
2 files changed, 3 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index e3c466c0..7f569d71 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -178,6 +178,7 @@ local childMap = {
['doc.cast'] = {'name', '#casts'},
['doc.cast.block'] = {'extends'},
['doc.operator'] = {'op', 'exp', 'extends'},
+ ['doc.meta'] = {'name'},
}
---@type table<string, fun(obj: parser.object, list: parser.object[])>
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 1a88d385..545f9d95 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -1116,8 +1116,10 @@ local docSwitch = util.switch()
end)
: case 'meta'
: call(function ()
+ local requireName = parseName('doc.meta.name')
return {
type = 'doc.meta',
+ name = requireName,
start = getFinish(),
finish = getFinish(),
}