-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: run DAP for test suites in Metals
- Loading branch information
1 parent
f116e13
commit aefe215
Showing
25 changed files
with
1,353 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
metals/src/main/scala/scala/meta/internal/metals/debug/server/Logger.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package scala.meta.internal.metals.debug.server | ||
|
||
import java.net.InetSocketAddress | ||
import java.util.concurrent.atomic.AtomicBoolean | ||
|
||
import ch.epfl.scala.debugadapter.DebuggeeListener | ||
|
||
class Logger(listener: DebuggeeListener) { | ||
private val initialized = new AtomicBoolean(false) | ||
private final val JDINotificationPrefix = | ||
"Listening for transport dt_socket at address: " | ||
|
||
def logError(errorMessage: String): Unit = { | ||
listener.err(errorMessage) | ||
scribe.error(errorMessage) | ||
} | ||
|
||
def logOutput(msg: String): Unit = { | ||
if (msg.startsWith(JDINotificationPrefix)) { | ||
if (initialized.compareAndSet(false, true)) { | ||
val port = Integer.parseInt(msg.drop(JDINotificationPrefix.length)) | ||
val address = new InetSocketAddress("127.0.0.1", port) | ||
listener.onListening(address) | ||
} | ||
} else listener.out(msg) | ||
} | ||
} |
Oops, something went wrong.