-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make ResetWorkspace more stable
Now user is asked for confirmation before clearing .bloop directory. Adds additional checks for non-existing files, since it used to fail both on `.toList` and `delete`. Also, the ResetWorkspaceLspSuite was flaky before.
- Loading branch information
Showing
7 changed files
with
116 additions
and
25 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
metals/src/main/scala/scala/meta/internal/metals/BloopDir.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,26 @@ | ||
package scala.meta.internal.metals | ||
|
||
import scala.meta.internal.metals.MetalsEnrichments._ | ||
import scala.meta.io.AbsolutePath | ||
|
||
object BloopDir { | ||
def clear(workspace: AbsolutePath): Unit = { | ||
val bloopDir = workspace.resolve(".bloop") | ||
bloopDir.list.foreach { f => | ||
if (f.exists && f.isDirectory) f.deleteRecursively() | ||
} | ||
val remainingDirs = | ||
bloopDir.list.filter(f => f.exists && f.isDirectory).toList | ||
if (remainingDirs.isEmpty) { | ||
scribe.info( | ||
"Deleted directories inside .bloop" | ||
) | ||
} else { | ||
val str = remainingDirs.mkString(", ") | ||
scribe.error( | ||
s"Couldn't delete directories inside .bloop, remaining: $str" | ||
) | ||
} | ||
|
||
} | ||
} |
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