Scala Macro "context.internal.enclosingOwner" - Getting File And Line #
John Michael Lafayette <[email protected]> Sun, 10 Apr 2016 20:05:13 -0700 (PDT)
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <[email protected]> |
I was recently playing around with this library - https://github.com/lihaoyi/sourcecode It lets me output the file location and line number like this: *sourcecode.DebugFull.main Foo [arg]: 123* It seems to use this feature, c.emclosingPosition.source . scala.reflect.macros.Enclosures I want to use it to improve my library, https://github.com/JohnReedLOL/scala-trace-debug Instead of using Thread.currentThread.getStackTrace() to get the current position in the source code, I want to use "context.internal.enclosingOwner". The problem with this is that for "context.internal.emclosingPosition.source" to work with stack trace highlighting in the IDE, the formatting must match the formatting produced by a real stack trace. lihaoyi's library does not do this, but if it did, the performance would be better than a regular stack trace and it could be used in place of a one line stack trace. Is there any way to make macro source code position look like a real stack trace line so that stack trace highlighting would work? Example: bootstrap.liftweb.Boot.<init>(Boot.scala:25) -- You received this message because you are subscribed to the Google Groups "scala-language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.