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.
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...
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)
sbt:OrderService> scalafix RemoveUnused
[info] Running scalafix on 10 Scala sources
[info] Running scalafix on 6 Scala sources
[info] Running scalafix on 3 Scala sources
[info] Running scalafix on 50 Scala sources
[success] Total time: 1 s, completed Dec 17, 2019 12:35:41 PM
@BBartosz you can generate programs by constructing trees and printing them with Scalameta. Macros allow you to do roughly the same thing, except you do it during the compilation of your program
How exactly you generate them? I understand that you use quasiquotes to build your tree and then you save it to file, kinda like string?