summaryrefslogtreecommitdiff
path: root/script/vm/doc.lua
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2024-01-10 11:03:21 +0800
committerGitHub <noreply@github.com>2024-01-10 11:03:21 +0800
commit1e7bb72ad3ff2b75a1c55ee4bc53004cb7fe30f7 (patch)
treedd94cf09b9e3a675a73a9f1d41248d1538165997 /script/vm/doc.lua
parentbb6e172d6166190bd4edd3bb56230a7d60ebcb93 (diff)
parent37779f9b2493e51e59e1e4366bf7dcb8350e69bd (diff)
downloadlua-language-server-1e7bb72ad3ff2b75a1c55ee4bc53004cb7fe30f7.zip
Merge branch 'LuaLS:master' into plugin-add-OnTransformAst
Diffstat (limited to 'script/vm/doc.lua')
-rw-r--r--script/vm/doc.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/script/vm/doc.lua b/script/vm/doc.lua
index a6ea248f..6ac39910 100644
--- a/script/vm/doc.lua
+++ b/script/vm/doc.lua
@@ -5,7 +5,11 @@ local vm = require 'vm.vm'
local config = require 'config'
---@class parser.object
----@field package _castTargetHead parser.object | vm.global | false
+---@field package _castTargetHead? parser.object | vm.global | false
+---@field package _validVersions? table<string, boolean>
+---@field package _deprecated? parser.object | false
+---@field package _async? boolean
+---@field package _nodiscard? boolean
---获取class与alias
---@param suri uri
@@ -467,3 +471,18 @@ function vm.getCastTargetHead(doc)
end
return nil
end
+
+---@param doc parser.object
+---@param key string
+---@return boolean
+function vm.docHasAttr(doc, key)
+ if not doc.docAttr then
+ return false
+ end
+ for _, name in ipairs(doc.docAttr.names) do
+ if name[1] == key then
+ return true
+ end
+ end
+ return false
+end