Skip to content

Instantly share code, notes, and snippets.

Ólafur Páll Geirsson olafurpg

Block or report user

Report or block olafurpg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sc.diff
commit d1c32af12806e4874a0403183bb27457f365ea1f
Author: Olafur Pall Geirsson <lgeirsson@twitter.com>
Date: Sun Nov 3 10:56:02 2019 +0000
Add support for `*.sc` files
diff --git a/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala b/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala
index 3b1caa3..1063986 100644
--- a/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala
+++ b/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala
View gist:a5680c662fb68d5d925bc79df5c8f670
commit 3f09ac8e6c921586b4dc8949b25ce4759f064776
Author: Olafur Pall Geirsson <lgeirsson@twitter.com>
Date: Thu Oct 10 12:44:44 2019 +0200
Experiment with debugging breakpoints
diff --git a/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala b/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala
index 4736d6e..04f9e28 100644
--- a/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala
+++ b/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala
View readme.md

Hello!

This is a tutorial

println("## This is header 2")
1.to(10).foreach(i => println(s"* $i"))
@olafurpg
olafurpg / summary.scala
Created Oct 8, 2019
Example how to print summary of test failures with utest
View summary.scala
override def utestFormatter: Formatter = new Formatter {
import utest.framework._
import utest.ufansi
override def formatSummary(
topLevelName: String,
results: HTree[String, Result]
): Option[ufansi.Str] = Some {
val summary = results match {
case HTree.Node(_, c @ _*) =>
c.collect {
View scala-7.5.json
{
"name": "Scala",
"scopeName": "source.scala",
"patterns": [
{
"include": "#code"
}
],
"repository": {
"block-comments": {
View scala-7.4.json
{
"name": "Scala",
"scopeName": "source.scala",
"patterns": [
{
"include": "#code"
}
],
"repository": {
"block-comments": {
View scala.diff
diff --git a/source.scala.json b/source.scala.json
index 1491594..9586413 100644
--- a/source.scala.json
+++ b/source.scala.json
@@ -16,7 +16,7 @@
"include": "#block-comments"
},
{
- "match": "(?x)\n\t\t\t(?! /\\*)\n\t\t\t(?! \\*/)\n\t\t "
+ "match": "(?x)(?! /\\*)(?! \\*/)"
View duplicate.txt
$ du -d 1 -h .bloop/metals/scala-2.12/
5.6M .bloop/metals/scala-2.12//classes-Metals-M5iIL4DpRmONiQGSyN7cBg==
6.2M .bloop/metals/scala-2.12//classes-Metals-mj-QLxr7SC-x5ibDTngLtA==
0B .bloop/metals/scala-2.12//classes-Metals-c7ff878c-cc1b-4163-a0bd-fec34668fcdc
5.7M .bloop/metals/scala-2.12//classes-Metals-A1BGn-d7Rj-L-PJUuDNJFw==
0B .bloop/metals/scala-2.12//test-classes
0B .bloop/metals/scala-2.12//classes-Metals-LYknN5FDSv-TS45oA-pgtw==
0B .bloop/metals/scala-2.12//classes-Metals-9681da1e-0cb0-4e50-88a0-d7d69cb4d7c3
6.2M .bloop/metals/scala-2.12//classes-Metals-FRG2WLmNRqSy5Rzb9yN-rg==
5.6M .bloop/metals/scala-2.12//classes-Metals-gw5fG5cfRcO_QdPlslko4Q==
@olafurpg
olafurpg / debug.sc
Last active May 31, 2019
Example using sourcecode and pprint to implement a `debug` function
View debug.sc
def debug[T](d: sourcecode.Text[T])(implicit tpe: pprint.TPrint[T], line: sourcecode.Line, file: sourcecode.File): Unit = {
println(s"${file.value}:${line.value} - ${d.source} ${tpe.render}: ${pprint.apply(d.value)}")
}
@main
def main(): Unit = {
val fooMatrix = List.fill(10)("foo").map(List.fill(10)(_))
debug(fooMatrix)
}
// debug.sc:8 - fooMatrix List[List[String]]: List(
@olafurpg
olafurpg / DownloadSources.scala
Last active May 24, 2019
Script to download all library sources into a target directory
View DownloadSources.scala
import sbt._, Keys._
object DownloadSources extends AutoPlugin {
override def trigger = allRequirements
override def requires = sbt.plugins.JvmPlugin
override def projectSettings =
List(Compile, Test).flatMap { config =>
inConfig(config)(
TaskKey[Seq[File]]("downloadSources") := Def.task[Seq[File]] {
val out = baseDirectory.in(ThisBuild).value / "target" / "sources"
You can’t perform that action at this time.