summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/hover/description.lua32
-rw-r--r--script/provider/markdown.lua4
-rw-r--r--script/vm/def.lua10
3 files changed, 34 insertions, 12 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 5f5c50f6..32a0a798 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -125,7 +125,11 @@ local function getBindComment(source)
return table.concat(lines, '\n')
end
-local function lookUpDocComments(source, docGroup)
+local function lookUpDocComments(source)
+ local docGroup = source.bindDocs
+ if not docGroup then
+ return
+ end
if source.type == 'setlocal'
or source.type == 'getlocal' then
source = source.node
@@ -282,6 +286,9 @@ end
local function getFunctionComment(source)
local docGroup = source.bindDocs
+ if not docGroup then
+ return
+ end
local hasReturnComment = false
for _, doc in ipairs(source.bindDocs) do
@@ -329,23 +336,28 @@ local function getFunctionComment(source)
elseif doc.type == 'doc.overload' then
md:splitLine()
end
- ::CONTINUE::
end
local enums = getBindEnums(source, docGroup)
md:add('lua', enums)
- return md
+
+ local comment = md:string()
+ if comment == '' then
+ return nil
+ end
+ return comment
end
local function tryDocComment(source)
- if not source.bindDocs then
- return
- end
- if source.type ~= 'function' then
- local comment = lookUpDocComments(source, source.bindDocs)
- return comment
+ if source.type == 'function' then
+ local comment = getFunctionComment(source)
+ if comment then
+ return comment
+ end
+ source = source.parent
end
- return getFunctionComment(source)
+ local comment = lookUpDocComments(source)
+ return comment
end
local function tryDocOverloadToComment(source)
diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua
index f2f7f777..50716073 100644
--- a/script/provider/markdown.lua
+++ b/script/provider/markdown.lua
@@ -94,6 +94,10 @@ function mt:string(nl)
if lines[#lines] ~= '' then
lines[#lines+1] = ''
end
+ elseif last == '---' then
+ if lines[#lines] ~= '' then
+ lines[#lines+1] = ''
+ end
end
end
lines[#lines+1] = obj.text
diff --git a/script/vm/def.lua b/script/vm/def.lua
index a7af29b2..f557f221 100644
--- a/script/vm/def.lua
+++ b/script/vm/def.lua
@@ -102,9 +102,15 @@ local nodeSwitch;nodeSwitch = util.switch()
if lastKey then
return
end
- local tbl = source.parent
+ local key = guide.getKeyName(source)
+ if type(key) ~= 'string' then
+ return
+ end
local uri = guide.getUri(source)
- searchFieldSwitch(tbl.type, uri, tbl, guide.getKeyName(source), pushResult)
+ local parentNode = vm.compileNode(source.node)
+ for pn in parentNode:eachObject() do
+ searchFieldSwitch(pn.type, uri, pn, key, pushResult)
+ end
end)
: case 'doc.see.field'
: call(function (source, lastKey, pushResult)