diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-28 17:44:46 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-28 17:44:46 +0800 |
commit | c45a21271556b6c689ee61fd5353846f469e4622 (patch) | |
tree | df0ce3ef26ba916b230ffc27e25168e3947f2273 /script | |
parent | f1a974b7ea759adcd4af571bc7752d5b4761927b (diff) | |
download | lua-language-server-c45a21271556b6c689ee61fd5353846f469e4622.zip |
#477 supports hover
Diffstat (limited to 'script')
-rw-r--r-- | script/core/definition.lua | 3 | ||||
-rw-r--r-- | script/core/hover/description.lua | 14 | ||||
-rw-r--r-- | script/core/searcher.lua | 1 | ||||
-rw-r--r-- | script/parser/guide.lua | 1 |
4 files changed, 9 insertions, 10 deletions
diff --git a/script/core/definition.lua b/script/core/definition.lua index 335e178e..d77ddac1 100644 --- a/script/core/definition.lua +++ b/script/core/definition.lua @@ -172,6 +172,9 @@ return function (uri, offset) goto CONTINUE end end + if src.type == 'doc.param' then + goto CONTINUE + end results[#results+1] = { target = src, diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index fc220c74..f0534373 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -344,16 +344,10 @@ local function tyrDocParamComment(source) if source.parent.type ~= 'funcargs' then return end - if not source.bindDocs then - return - end - for _, doc in ipairs(source.bindDocs) do - if doc.type == 'doc.param' then - if doc.param[1] == source[1] then - if doc.comment then - return doc.comment.text - end - break + for _, def in ipairs(vm.getDefs(source)) do + if def.type == 'doc.param' then + if def.comment then + return def.comment.text end end end diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 487de982..4d72b038 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -115,6 +115,7 @@ local pushDefResultsMap = util.switch() : case 'doc.field.name' : case 'doc.type.enum' : case 'doc.resume' + : case 'doc.param' : case 'doc.type.array' : case 'doc.type.table' : case 'doc.type.ltable' diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 58981763..07bbc0cd 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -55,6 +55,7 @@ local type = type ---@field returnIndex integer ---@field docs parser.guide.object[] ---@field state table +---@field comment table ---@field _root parser.guide.object ---@field _noders noders ---@field _mnode parser.guide.object |