summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-31 19:38:31 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-31 19:38:31 +0800
commitc7362d4d82f42e29749ac89ae90ed6395e2d501b (patch)
tree9d7e873b45eaef144152f6b0a807ee699597d28d /script-beta
parent02307701cf666dd884b497654b94b0f71f1f812e (diff)
downloadlua-language-server-c7362d4d82f42e29749ac89ae90ed6395e2d501b.zip
暂存
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/completion.lua31
1 files changed, 26 insertions, 5 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index c7350b8f..6b3d5bfe 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -927,6 +927,23 @@ local function tryCallArg(ast, text, offset, results)
end
end
+local function isInComment(ast, offset)
+ for _, comm in ipairs(ast.comms) do
+ if offset >= comm.start and offset <= comm.finish then
+ return true
+ end
+ end
+ return false
+end
+
+local function tryLuaDoc(ast, text, offset, results)
+ if text:sub(offset - 3, offset) == '---@' then
+ for _, docType in ipairs {'class', 'type', 'alias', 'param', 'return', 'field', 'generic', 'vararg', 'overload'} do
+
+ end
+ end
+end
+
local function completion(uri, offset)
local ast = files.getAst(uri)
local text = files.getText(uri)
@@ -934,11 +951,15 @@ local function completion(uri, offset)
clearStack()
vm.setSearchLevel(3)
if ast then
- trySpecial(ast, text, offset, results)
- tryWord(ast, text, offset, results)
- tryIndex(ast, text, offset, results)
- trySymbol(ast, text, offset, results)
- tryCallArg(ast, text, offset, results)
+ if isInComment(ast, offset) then
+ tryLuaDoc(ast, text, offset, results)
+ else
+ trySpecial(ast, text, offset, results)
+ tryWord(ast, text, offset, results)
+ tryIndex(ast, text, offset, results)
+ trySymbol(ast, text, offset, results)
+ tryCallArg(ast, text, offset, results)
+ end
else
local word = findWord(text, offset)
if word then