|
1 | 1 | #= |
2 | | -@TODO: |
3 | | -Use our own UI components for this: atom-ide-ui is already deprecated, ugly, not fully functional, and and... |
4 | | -Once we can come to handle links within datatips, we may want to append method tables as well |
| 2 | +@TODO use our own UI components for this: |
| 3 | +atom-ide-ui is already deprecated, ugly, not fully functional, and and... |
5 | 4 | =# |
6 | 5 |
|
7 | 6 | handle("datatip") do data |
@@ -74,6 +73,9 @@ function globaldatatip(mod, word, fullword) |
74 | 73 |
|
75 | 74 | processdoc!(docs, docstr, datatip) |
76 | 75 |
|
| 76 | + ml = methods(val) |
| 77 | + processmethods!(ml, datatip) |
| 78 | + |
77 | 79 | return datatip |
78 | 80 | end |
79 | 81 |
|
@@ -125,6 +127,23 @@ processval!(val::Function, docstr, datatip) = begin |
125 | 127 | end |
126 | 128 | processval!(::Undefined, docstr, datatip) = nothing |
127 | 129 |
|
| 130 | +function processmethods!(ml, datatip) |
| 131 | + ms = collect(ml) |
| 132 | + isempty(ms) && return |
| 133 | + |
| 134 | + replace(str, mregex => s"\g<sig> aviin \g<mod> aviat \g<loc>") |
| 135 | + |
| 136 | + substr = s"<code>\g<sig></code> in <code>\g<mod></code> at \g<loc>" |
| 137 | + msstr = map(ms) do m |
| 138 | + s = replace(string(m), methodloc_regex => substr) |
| 139 | + match(methodloc_regex, string(m)) |
| 140 | + "<li>$s</li>" |
| 141 | + end |> join |
| 142 | + |
| 143 | + name = ms[1].name |
| 144 | + pushmarkdown!(datatip, "<details><summary><code>$name</code> has **$(length(ms))** methods:</summary><ul>$(msstr)</ul></details>") |
| 145 | +end |
| 146 | + |
128 | 147 | function pushmarkdown!(datatip, markdown) |
129 | 148 | (markdown == "" || markdown == "\n") && return |
130 | 149 | push!(datatip, Dict(:type => :markdown, :value => markdown)) |
|
0 commit comments