Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    P. Oscar Boykin
    @johnynek
    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
    Pedro Rodriguez Tavarez
    @pjrt
    Hey, what ever happened to scalameta macros?
    Is that still a thing?
    Roman Janusz
    @ghik
    @pjrt no, scalameta is now only about tooling
    Roman Janusz
    @ghik
    Am I correct that when I call .tokens on a tree, it tokenizes the input from scratch every single time?
    Ólafur Páll Geirsson
    @olafurpg
    @ghik the tokens are cached
    this cache has historically been global and caused a lot of headache, but I made this cache local in scalameta/scalameta#1914
    Roman Janusz
    @ghik
    ok great, thanks
    Roman Janusz
    @ghik
    I'm trying to open the scalameta project in VS Code with metals and I'm consistently getting error from sbt: Not a valid command: metalsEnable. I tried various workarounds found in already reported issues (e.g. scalameta/metals#685) but nothing works...
    Ólafur Páll Geirsson
    @olafurpg
    @ghik you might want to try using the latest SNAPSHOT
    otherwise, I don't import the scalameta build into metals since it conflicts with the SemanticDB plugin (which is developed in the scalameta build and Metals uses it)
    we do funky stuff like customize the sourceroot setting to be a subdirectory, which doesn't play nicely with Metals
    Sequencer
    @sequencer
    Hello, I wonder how to implement a "find usage" Scala? since after AST generation, there won't be any packages information for codes. Is there any compiler plugin to help me with this?
    Ólafur Páll Geirsson
    @olafurpg
    @ghik I was able to get Metals working in the Scalameta build using the latest Metals SNAPSHOT
    Ólafur Páll Geirsson
    @olafurpg
    @sequencer you can use the SemanticDB compiler plugin to emit protobuf data with symbol references
    you'll need a bit more work to handle references to overridden methods