nimsuggest: bugfix: also output documentation comments

This commit is contained in:
Andreas Rumpf 2017-02-03 17:36:39 +01:00
commit 76a28d8b83
4 changed files with 37 additions and 23 deletions

View file

@ -41,6 +41,20 @@ var
template origModuleName(m: PSym): string = m.name.s
proc findDocComment(n: PNode): PNode =
if n == nil: return nil
if not isNil(n.comment): return n
for i in countup(0, safeLen(n)-1):
result = findDocComment(n.sons[i])
if result != nil: return
proc extractDocComment(s: PSym): string =
let n = findDocComment(s.ast)
if not n.isNil:
result = n.comment.replace("\n##", "\n").strip
else:
result = ""
proc symToSuggest(s: PSym, isLocal: bool, section: string, li: TLineInfo;
quality: range[0..100]): Suggest =
result.section = parseIdeCmd(section)