Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.4.3 #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.4.3
b32d5416ec27715dd73ff4506c29a17008ace749
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.4.0"
version = "3.4.3"
runner.dialect = scala3
rewrite.scala3.insertEndMarkerMinLines = 10
rewrite.scala3.removeOptionalBraces = true
Expand Down
3 changes: 1 addition & 2 deletions example-backend/src/main/scala/app.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import neutrino.*
.getLines()
.mkString("\n")

WebviewApp.builder
.withDebugOn
WebviewApp.builder.withDebugOn
.withHtml(
Html(
"""
Expand Down
1 change: 0 additions & 1 deletion neutrino/src/main/scalanative/IPC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ import scala.util.*

case class Context[T](cmd: T, view: RunningWebview, promise: CString => Unit)
type stored[T] = Tuple2[RunningWebview, Context[T] => Unit]

9 changes: 7 additions & 2 deletions neutrino/src/main/scalanative/RunningWebview.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import scala.io.Source
import scala.scalanative.unsafe.Zone
import neutrino.ipc.Context

class RunningWebview(val w: webview_t, var width: Int, var height: Int, val z: Zone):
class RunningWebview(
val w: webview_t,
var width: Int,
var height: Int,
val z: Zone
):
import scalanative.unsafe.*
import ipc.*
import scala.util.*
Expand All @@ -20,7 +25,7 @@ class RunningWebview(val w: webview_t, var width: Int, var height: Int, val z: Z
!ptr = (this, handler)
val func =
funcName match
case s: String => toCString(s)(using z)
case s: String => toCString(s)(using z)

webview_bind(
w,
Expand Down
52 changes: 36 additions & 16 deletions neutrino/src/main/scalanative/Webview.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,61 @@ import scalanative.libc.*
object types:
opaque type webview_t = Ptr[Byte]
object webview_t:
given _tag: Tag[webview_t] = Tag.Ptr(Tag.Byte)
given _tag: Tag[webview_t] = Tag.Ptr(Tag.Byte)
inline def apply(inline o: Ptr[Byte]): webview_t = o

@extern
private[webview] object extern_functions:
import types.*
def webview_bind(w : webview_t, name : CString, fn : CFuncPtr3[CString, CString, Ptr[Byte], Unit], arg : Ptr[Byte]): Unit = extern
def webview_bind(
w: webview_t,
name: CString,
fn: CFuncPtr3[CString, CString, Ptr[Byte], Unit],
arg: Ptr[Byte]
): Unit = extern

def webview_create(debug : CInt, window : Ptr[Byte]): webview_t = extern
def webview_create(debug: CInt, window: Ptr[Byte]): webview_t = extern

def webview_destroy(w : webview_t): Unit = extern
def webview_destroy(w: webview_t): Unit = extern

def webview_dispatch(w : webview_t, fn : CFuncPtr2[webview_t, Ptr[Byte], Unit], arg : Ptr[Byte]): Unit = extern
def webview_dispatch(
w: webview_t,
fn: CFuncPtr2[webview_t, Ptr[Byte], Unit],
arg: Ptr[Byte]
): Unit = extern

def webview_eval(w : webview_t, js : CString): Unit = extern
def webview_eval(w: webview_t, js: CString): Unit = extern

def webview_get_window(w : webview_t): Ptr[Byte] = extern
def webview_get_window(w: webview_t): Ptr[Byte] = extern

def webview_init(w : webview_t, js : CString): Unit = extern
def webview_init(w: webview_t, js: CString): Unit = extern

def webview_navigate(w : webview_t, url : CString): Unit = extern
def webview_navigate(w: webview_t, url: CString): Unit = extern

def webview_return(w : webview_t, seq : CString, status : CInt, result : CString): Unit = extern
def webview_return(
w: webview_t,
seq: CString,
status: CInt,
result: CString
): Unit = extern

def webview_run(w : webview_t): Unit = extern
def webview_run(w: webview_t): Unit = extern

def webview_set_html(w : webview_t, html : CString): Unit = extern
def webview_set_html(w: webview_t, html: CString): Unit = extern

def webview_set_size(w : webview_t, width : CInt, height : CInt, hints : CInt): Unit = extern
def webview_set_size(
w: webview_t,
width: CInt,
height: CInt,
hints: CInt
): Unit = extern

def webview_set_title(w : webview_t, title : CString): Unit = extern
def webview_set_title(w: webview_t, title: CString): Unit = extern

def webview_terminate(w : webview_t): Unit = extern
def webview_terminate(w: webview_t): Unit = extern

def webview_unbind(w : webview_t, name : CString): Unit = extern
def webview_unbind(w: webview_t, name: CString): Unit = extern
end extern_functions

object functions:
import types.*
Expand Down
1 change: 0 additions & 1 deletion neutrino/src/main/scalanative/WindowSize.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package neutrino

case class WindowSize(width: Int, height: Int)

4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("com.indoorvivants" % "sbt-commandmatrix" % "0.0.5")