sourcecode icon indicating copy to clipboard operation
sourcecode copied to clipboard

Scala library providing "source" metadata to your program, similar to Python's __name__, C++'s __LINE__ or Ruby's __FILE__.

Results 43 sourcecode issues
Sort by recently updated
recently updated
newest added

Scastie: https://scastie.scala-lang.org/carueda/NIAVkP82Rd2RVusUXRZMGQ/13 In short, applying: ```scala def keyword(implicit name: sourcecode.Name): String = name.value ``` to back ticked `macro`: ```scala val `macro` = keyword ``` results in capturing something else, apparently...

``` scala Welcome to the Ammonite Repl 1.0.1 (Scala 2.12.3 Java 1.8.0_131) If you like Ammonite, please support our development at www.patreon.com/lihaoyi @ import $ivy.`com.lihaoyi::sourcecode:0.1.4` import $ivy.$ @ def loop...

Hi, when trying to use `sourcecode` in an [mdoc](https://scalameta.org/mdoc/) snippet, `NullPointerException` is thrown. Mdoc input: ```scala mdoc implicitly[sourcecode.File] ``` Error: ``` java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.toAbsolutePath()" because the return value of...

Given this method: ``` def printArgs(a: Int, b: Long, c: String): Unit = { val args = implicitly[sourcecode.Args] println(args) } ``` When I call `printArgs(1, 2, "3")`, the following lines...

Is there any way to capture the name of argument currently being assigned? I tried this but it was not. ```scala case class Foo(bar: String) def provider(implicit name: sourcecode.Name): String...

I get a bunch of evicted warnings when using source code in my sbt projects. What is the versioning scheme? Is it possible to get it added to the pom...

Currently, we're able to get enclosing method args with `sourcecode.Args`. Also, in some cases we can get enclosing method name: ```scala def printMethodName()(implicit name: Name) = println(name.value) def myMethod() =...

Apparently, on Windows, the `FileName.value` gets the full path like: `C:\....\MyClass.scala` instead of just the file name.

Is there a way to get the source code of the lambda function passed to another function? I get the expected result with basic types ```scala def myBasicFunc(param: Int): String...