Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ólafur Páll Geirsson
    @olafurpg
    the thing is that you wouldn't be able to implement completions anyways with the impartial scalameta tree
    for completions you need a typechecker
    Roman Janusz
    @ghik
    scala presentation compiler has no problem with that
    it can typecheck on best-effort manner
    Ólafur Páll Geirsson
    @olafurpg
    yeah, we use the presentation compiler with completions and it's working pretty great in my experience
    Roman Janusz
    @ghik
    yes I'm also using it in my "current version" of this "programming language"
    but lossy parsing is really biting me
    Ólafur Páll Geirsson
    @olafurpg
    the desugared scalac trees simplify a lot of semantic analysis
    Roman Janusz
    @ghik
    the thing that i hoped for is scalameta for syntactic analysis and presentation compiler for potential typechecking and completion
    presentation compiler unfortunately has a lot of limitations
    for example: it doesn't handle scala.Dynamic well
    Ólafur Páll Geirsson
    @olafurpg
    we have an mtags module in metals that adds several feature improvements to the scala presentation compiler APIs, including support for Dynamic
    the dynamic fixes could be upstreamed into the compiler, but other improvements include for example auto-importing symbols that are in the workspace but not in scope
    we do several syntactic analyses using the scalameta parser such as code folding and document outlines
    but they only run on valid source code, in between that we adjust positions based on token edit distance between the last successful parse and the current dirty buffer
    Kiko
    @kikofernandez
    Hi there. I was wondering if there is any way to get transform a semanticdb class into its pretty printed form, so that I can get interesting information from semantic db and use the AST facilities of scalameta
    Ólafur Páll Geirsson
    @olafurpg
    @kikofernandez the scalafix apis combine the Scalameta ast and SemanticDB
    Kiko
    @kikofernandez
    right, so I have to go for scalafix them. Thanks
    I am really new into Scala and Scalameta et al. Is there any way I can use Scalafix to generate code (not visible to the developer) that gets compiled?
    Anthony Garo
    @agaro1121
    Hi everyone, I want to match on imports that start with a specific string.
    What’s the best way to do that?
    something like:
    case importer"scala.$eref.{..$importeesnel}" =>
          println(eref)
          println(importeesnel)
          println()
    mohnishkodnani
    @mohnishkodnani
    Hi,
    I am trying to create a service , where given certain parameters, you create code for a new usecase. I have a scala.meta.Type from parsing the case class() extends ... with ... > i want to use that scala.meta.Type with reflection to find all the methods I have to override and generate them ? Is there a way to do this ?
    Ólafur Páll Geirsson
    @olafurpg
    @mohnishkodnani a scala.meta.Type represents only the syntax tree of that source code, it has no knowledge about the type or the supermethods to implement so this is not possible I'm afraid.
    Gabriele Petronella
    @gabro

    is anyone experiencing this issue with spurious unused warnings when using quasiquotes as a pattern?

    def f(m: Decl.Def): List[scala.meta.Type] =
        m.decltpe.collect {
          case t"$_[$tpe]" => tpe
        }

    This yields two unused warnings, one for each $

    Anthony Cerruti
    @srnb_gitlab
    What's the status on Scala Meta for Native 0.3.9/2.11 and JS 1.0.0-M8/2.12-2.13?
    Brent Gracey
    @myFree

    Hi all;

    Is there a plugin which can generate SemanticDb files for a Java project?

    From https://scalameta.org/docs/semanticdb/guide.html#example
    SemanticDB producers provide full Scala support and partial Java support

    Is this support only for when a Scala project calls to Java files?

    Thanks

    mtes3
    @mtes3
    Hello.
    I tried to move from scala-macros to meta.
    But I still do not understand the next things:
    meta v4.2.0 is library for analyze scala code (read file -> transform to tokens, ans so on)
    but meta contain inline definition for make macros, is it right? and for macro purposes I should use 1.8.0 + meta/paradise compiler plugin, is it correct?
    thanks in advance
    Gabriele Petronella
    @gabro
    @mtes3 scalameta macros is a dead unmaintained project, that won’t be published for Scala 2.13. You should stick with macro paradise, which has been moved into the compiler under a flag
    mtes3
    @mtes3
    @gabro thanks for explanation. under macro paradise did you mean base macros (white/black context)?
    Gabriele Petronella
    @gabro
    I also mean macro annotations
    mtes3
    @mtes3
    I understood, thanks
    Dariusz Marynowski
    @driuzz

    Hi all,
    I'm trying to use scalameta to get type information for very simple piece of code, like this:

    object X {
      val a = List(1,2,3).head
    }

    the problem is with head method and its type, which is always A, but should be Int in this case. Also synthetic information is not generated for this method, so there is no way to retrieve real type.
    I checked scalameta code and it looks like toTextDocument method in implicit class XtensionCompilationUnitDocument doesn't support such situation at all. Synthetic data are generated for only small amount of hardcoded methods, like apply, map etc.
    Also type (tpe field) from Trees#Selectis not read at all what causes that there is no way to retrieve return type for head method from SemanticDocument.
    Can someone advice how to handle this problem?

    Ólafur Páll Geirsson
    @olafurpg
    @driuzz getting the type of a term is not supported with SemanticDB
    Dariusz Marynowski
    @driuzz
    @olafurpg thanks for info, and that's what I thought. However it is a little unfortunate for us, especially that original tree has these types. Do you plan to support this in future? Or do you see any way to hack this around?
    Ólafur Páll Geirsson
    @olafurpg
    @driuzz we have an idea how to reasonably implement it but it’s not on the near roadmap.
    A workaround is to write a custom compiler plugin.
    Loïc Girault
    @lgirault
    Hi. Is it possible, using scalameta only, to generate code with comments ? I understand it's not possible using quasiquotes ( https://scalameta.org/docs/trees/guide.html#with-quasiquotes ), but maybe by instanciating directly the AST ?
    how does scalafmt does ? it does not use the scalameta AST ?
    Siddhant Sanyam
    @siddhant3s
    I have a runtime.universe.Symbol for object Foo which is a companion object of a case class. Is it possible to get the object Foo so that I can call a field from it ?
    Dmytro Mitin
    @DmytroMitin
    @lgirault You can use tokens.
    @siddhant3s I guess it's not about Scalameta. https://gitter.im/scala/scala
    Loïc Girault
    @lgirault
    thanks @DmytroMitin
    Luciano
    @lJoublanc
    Hey @lgirault how did you manage this? Which term did you use?
    Loïc Girault
    @lgirault
    haha It was something nice to have but not required so I have not taken the time to try it yet
    James Koch
    @jameskoch
    First-time contributor looking for some feedback - scalameta/scalameta#1886
    vito-c
    @vito-c
    I'm writing some macros for an annotation. Is there an example project somewhere I can take a look at that uses scalameta?
    Gabriele Petronella
    @gabro
    @vito-c scalameta macros are an abandoned project. You should use regular macro annotations instead
    vito-c
    @vito-c
    @gabro ah thank you for letting me know so quasiquotes?
    finding examples of macros at all has been tough :(
    Gabriele Petronella
    @gabro
    you can use quasiquotes in Scala macros
    as per examples, yeah, I know. There's a project that uses macro annotations that I maintain called enumero