-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dcbaeb
commit bca9601
Showing
6 changed files
with
45 additions
and
20 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
metals/src/main/resources/db/migration/V5__Show_bsp_errors.sql
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,4 @@ | ||
-- If should show bsp errors | ||
create table show_bsp_errors( | ||
should_show bit primary key | ||
); |
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
24 changes: 24 additions & 0 deletions
24
metals/src/main/scala/scala/meta/internal/metals/ShowBspErrors.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,24 @@ | ||
package scala.meta.internal.metals | ||
|
||
import java.sql.Connection | ||
|
||
import scala.meta.internal.metals.JdbcEnrichments._ | ||
|
||
class ShowBspErrors(conn: () => Connection) { | ||
final val explicit = "EXPLICIT" | ||
|
||
def shouldShow(): Option[Boolean] = { | ||
conn() | ||
.query( | ||
"select should_show from show_bsp_errors" | ||
)(_ => ()) { rs => rs.getBoolean(1) } | ||
.headOption | ||
} | ||
|
||
def set(shouldShowBspError: Boolean): Int = | ||
conn().update( | ||
s"merge into show_bsp_errors values ?;" | ||
) { _.setBoolean(1, shouldShowBspError) } | ||
|
||
def reset(): Unit = conn().update("delete from show_bsp_errors")(_ => ()) | ||
} |
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