Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Guillaume Martres
    @smarter
    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
    You can poke into the Metals codebase to see how "textDocument/references" is implemented
    Sequencer
    @sequencer
    OK! Thank you! I'll try.
    Roman Janusz
    @ghik
    @olafurpg thanks, will try it out
    Ólafur Páll Geirsson
    @olafurpg
    We’re hopefully doing a stable release in a couple days if you can hold out the wait
    Roman Janusz
    @ghik
    @olafurpg I still can't make it work with current snapshot. I built 0.7.7-SNAPSHOT from today's master and I'm getting this:
    java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: DecodingFailure(Attempt to decode value on failed cursor, List(DownField(providesFileWatching), DownField(capabilities)))
        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
        at scala.meta.internal.metals.BuildServerConnection$.initialize(BuildServerConnection.scala:176)
        at scala.meta.internal.metals.BuildServerConnection$.fromStreams(BuildServerConnection.scala:129)
        at scala.meta.internal.metals.BloopServers.$anonfun$newServer$1(BloopServers.scala:71)
        at scala.util.Success.$anonfun$map$1(Try.scala:255)
        at scala.util.Success.map(Try.scala:213)
        at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
        at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
        at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: DecodingFailure(Attempt to decode value on failed cursor, List(DownField(providesFileWatching), DownField(capabilities)))
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
        at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Ólafur Páll Geirsson
    @olafurpg
    @ghik you may have an old version of bloop running
    we're waiting for a stable release of bloop to come out before releasing metals v0.8
    maybe best to wait until then
    Roman Janusz
    @ghik
    ok, thanks, that's probably what I will do
    but I don't understand why I'm running wrong version of bloop - isn't it set up automatically by metals?
    Tomasz Godzik
    @tgodzik
    @ghik might also be needed to reimport the build - that message usually means that some json has an unexpected structure