Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Lorenzo Testa
    @kklorenzotesta
    Hi, I can't find anything in the doc about metacp, I understood that generate semanticdb files from libraries, is it correct?
    Ilya Kachalsky
    @IlyaHalsky
    Hi, I'm just starting with scalameta and I'm trying to build code analyzer, is there a way to get current line number from original file while traversing structure?
    Dmytro Mitin
    @DmytroMitin
    @kklorenzotesta now we have compiler plugin https://scalameta.org/docs/semanticdb/guide.html#sbt
    Dmytro Mitin
    @DmytroMitin
    @IlyaHalsky SymbolOccurrence includes range (start_line, start_character, end_line, end_character) https://scalameta.org/docs/semanticdb/specification.html#symboloccurrence
    Lorenzo Testa
    @kklorenzotesta
    @DmytroMitin with the compiler plugin if I want to generate the semanticdb files from a jar I should use InteractiveSemanticdb to get a compiler and then use the compiler api, right? And this is preferred over using metacp?
    Dmytro Mitin
    @DmytroMitin
    Lorenzo Testa
    @kklorenzotesta
    thank you very much, this is perfect
    Ilya Kachalsky
    @IlyaHalsky
    @DmytroMitin thank you very much!
    Siddhant Sanyam
    @siddhant3s
    Can IntelliJ expand macro-paradise macros (annotation macros) without me having to write a plugin?
    Actually, I should probably ask this in scala
    P. Oscar Boykin
    @johnynek
    hi all, does anyone know if the scaladocs are published anywhere? I can't seem to find them.
    there is a trick to get sonatype to serve it.
    P. Oscar Boykin
    @johnynek
    although, it doesn't seem to have types like Source, Defn, etc...
    okay... jackpot. those are in trees....
    Ólafur Páll Geirsson
    @olafurpg
    @johnynek cool, I didn't know oss.sonatype.org served javadocs, I normally use static.javadoc.io https://static.javadoc.io/org.scalameta/trees_2.12/4.2.3/scala/meta/index.html
    it would be nice to unidoc all the modules, but it's quite a hassle to setup

    Along with a REPL

    @ import $ivy.`org.scalameta::scalameta:4.2.3`, scala.meta._
    import $ivy.$                               , scala.meta._
    
    @ q"val x = 2"
    res1: Defn.Val = Defn.Val(List(), List(Pat.Var(Term.Name("x"))), None, Lit.Int(2))

    There's also ast explorer https://astexplorer.net/#/gist/1eef12317a449c79a21ce65c68d65d99/9ddae259a2cab4badae68010ccaf2d0b6910cc51

    Zoë Frances Weil
    @wanderlustzoe
    hello everyone! quick question:
    I’m porting over my project (which heavily relies on scalameta) to dotty. Does scalameta support being a dependency in a dotty project? I.e is it being built for dotty?
    Guillaume Martres
    @smarter
    It's not, but you can use Scala 2.13 dependencies from a Dotty project as long as you don't call any Scala 2 macro
    Zoë Frances Weil
    @wanderlustzoe
    @smarter <3
    Guillaume Martres
    @smarter
    this might not be ideal for scalameta since I think you need macros for the quasiquotes ?
    Zoë Frances Weil
    @wanderlustzoe
    also, does this mean that i shouldn’t build a project that relies heavily on scalameta in dotty, because there will be no longterm support?
    Guillaume Martres
    @smarter
    so the plan is for Scala 3.0 to be able to use libraries from 2.14 (or 2.13, TBD) in this way
    and longterm one would hope that scalameta would be made to compile with dotty
    Zoë Frances Weil
    @wanderlustzoe
    Ok perfect. thank you @smarter that’s exactly what i wanted to know!
    Ólafur Páll Geirsson
    @olafurpg
    @wanderlustzoe you should be able to use scalameta from dotty for most features excluding quasiquotes (q"val x = 42").
    Roman Janusz
    @ghik
    Hello, I just realized that these two expressions: (_: Int, 42).toString and ((_: Int, 42)).toString have exactly the same representation in Scalameta AST. However, these two are completely different things for the scala compiler! The first one is (x: Int) => (x, 42).toString and the second one is ((x: Int) => (x, 42)).toString. How do I tell that difference using scalameta?
    Ólafur Páll Geirsson
    @olafurpg
    @ghik good catch! This looks somewhat related to scalameta/scalameta#1843 I would be interested to hear you thoughts on what would be the expected scala.meta.Tree structure for those two different programs
    Roman Janusz
    @ghik
    @olafurpg I added my thoughts to the issue you linked.
    Ólafur Páll Geirsson
    @olafurpg
    @ghik thanks!
    Your proposal sounds reasonable, I agree it's tricky with the current AST to figure our when Term.Placeholder is an anonymous function
    Is this something you might be interested in working on? I don't expect I'll look into this anytime soon
    It would be essential to fix this before we introduce tree printer in scalafmt
    but it's not clear when that will happen yet
    Roman Janusz
    @ghik
    I'll look into it. Whether I'll get around to actually do it depends on how complex that turns out.
    Ólafur Páll Geirsson
    @olafurpg
    Roman Janusz
    @ghik
    is there any sensible reason why scalameta is still on sbt 0.13? :(
    Ólafur Páll Geirsson
    @olafurpg
    @ghik no, i'd love to upgrade to sbt 1
    Roman Janusz
    @ghik
    Basic question, but the guide is silent about it: how do I set the position of a tree when creating it?
    Ólafur Páll Geirsson
    @olafurpg
    @ghik there's no public API to do that, you can look at ScalametaParser.scala for how to use internal APIs
    in what situation would you like to add positions?
    Roman Janusz
    @ghik
    @olafurpg ugh, that's bad. I thought it would be a pretty essential thing. In my case I need to do some cosmetic transformation on parsed tree but I don't want to lose position information.
    Roman Janusz
    @ghik
    Actually, this particular case is probably a bug: a +: (1,2,3) - this is parsed by scalameta as ApplyInfix with three parameters but scalac parses (1,2,3) in this context as a tuple. So I wanted to workaround this by creating a Tuple tree out of these arguments but apparently I can't do this without losing positions.
    I mean, I won't lose positions on arguments themselves but I would like the tuple to have a position, too.
    Aliaksei Chapyzhenka
    @drom
    Hello, I am using sclameta-parsers from NPM. Any chance to get AST serialization portion as NPM package?
    here is my ticket scalameta/scalameta#1867