How to use askDocComment defined in scala.tools.nsc.interactive ?

31 views
Skip to first unread message

Abhishek Kumar

unread,
Jul 29, 2016, 9:39:27 AM7/29/16
to scala-internals
Hello everyone
I am trying to programmatically extract documentation from scala source code. I am not sure what to pass as "site" argument in askDocComment function defined here https://github.com/scala/scala/blob/33e32179fd6dcf06554b817f54b97ac5a6e052ab/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala#L176. The documentation says "The place where sym is observed", but I am unable to understand what should go there. Can someone please tell me what "site" argument should be? I did few random guess based tries but all of them gave no documentation.

Thanks
Abhishek Kumar

Simon Schäfer

unread,
Jul 29, 2016, 12:12:01 PM7/29/16
to scala-internals
The description is indeed not possible to understand, at least not for me. `site` is the class where the symbol belongs to. You can get it with `symbol.enclClass`.


---- On Fri, 29 Jul 2016 15:39:27 +0200 Abhishek Kumar <abhish...@gmail.com>wrote ----

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhishek Kumar

unread,
Jul 30, 2016, 3:49:00 PM7/30/16
to scala-internals
Thanks Simon for your help
When I try to extract documentation with
pressy.askDocComment(symbol, symbol.enclClass, currentFile, res)
res
.get gives Either[(String, String, Position), Throwable] = Left(("", "", NoPosition))

Though on calling pressy.askLinkPos(sybol, r)
r
.get gives the correct location of symbol in the currentFile.
In above code currentFile is the batchSourceFile to which symbol belongs. AFAIT file is loaded and compiled properly cause all other functions regarding position of symbol in file are working fine. I am unable to figure out why askDocComment gives blank doc.

I will be highly grateful for any pointers or possible causes of this error.

Regards
Abhishek Kumar
Reply all
Reply to author
Forward
0 new messages