diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-09 20:00:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-09 20:00:05 +0800 |
commit | d99c23af4bf8be944f58b374141dbfb81d48b5f5 (patch) | |
tree | 185e92fac5c0e28a80e772a9fdad5b0a6a4bbfd8 /script | |
parent | bc92c4dcefc0c87420c7d4b239c1eb4b9d14588c (diff) | |
download | lua-language-server-d99c23af4bf8be944f58b374141dbfb81d48b5f5.zip |
#1061 completion for `doc.type.code`
Diffstat (limited to 'script')
-rw-r--r-- | script/core/completion/completion.lua | 12 | ||||
-rw-r--r-- | script/core/hover/description.lua | 3 | ||||
-rw-r--r-- | script/parser/guide.lua | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index 009b4297..d7c210c6 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -1136,6 +1136,12 @@ local function checkTypingEnum(state, position, defs, str, results) description = def.comment and def.comment.text, kind = define.CompletionItemKind.EnumMember, } + elseif def.type == 'doc.type.code' then + enums[#enums+1] = { + label = def[1], + description = def.comment and def.comment.text, + kind = define.CompletionItemKind.EnumMember, + } end end cleanEnums(enums, str) @@ -1425,6 +1431,12 @@ local function tryCallArg(state, position, results) description = src.comment, kind = define.CompletionItemKind.EnumMember, } + elseif src.type == 'doc.type.code' then + enums[#enums+1] = { + label = src[1], + description = src.comment, + kind = define.CompletionItemKind.EnumMember, + } end if src.type == 'doc.type.function' then local insertText = buildInsertDocFunction(src) diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index e3c3f412..3fef1a21 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -155,7 +155,8 @@ local function buildEnumChunk(docType, name) types[#types+1] = vm.getInfer(tp):view(guide.getUri(docType)) if tp.type == 'doc.type.string' or tp.type == 'doc.type.integer' - or tp.type == 'doc.type.boolean' then + or tp.type == 'doc.type.boolean' + or tp.type == 'doc.type.code' then enums[#enums+1] = tp end local comment = tryDocClassComment(tp) diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 2bd9066b..83321bac 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -252,6 +252,7 @@ function m.isLiteral(obj) or tp == 'doc.type.string' or tp == 'doc.type.integer' or tp == 'doc.type.boolean' + or tp == 'doc.type.code' end --- 获取字面量 |