-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App E2E tests, build restructure, fix LangoustineApp on Native (#65)
- Loading branch information
Showing
29 changed files
with
581 additions
and
200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package langoustine.lsp.app | ||
|
||
import _root_.fs2 as FS2 | ||
import cats.effect.IO | ||
|
||
private[app] trait LangoustineAppPlatform: | ||
self: LangoustineApp.Config => | ||
|
||
def in: FS2.Stream[cats.effect.IO, Byte] = | ||
FS2.io.stdin[cats.effect.IO] | ||
def in: fs2.Stream[IO, Byte] = | ||
FS2.io.stdin[IO] | ||
end LangoustineAppPlatform |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import langoustine.lsp.* | ||
import langoustine.lsp.all.* | ||
import langoustine.lsp.app.* | ||
import jsonrpclib.fs2.* | ||
|
||
import cats.effect.* | ||
|
||
object MyServer extends LangoustineApp.Simple: | ||
override def server = | ||
IO.ref(Set.empty[String]).map(myLSP) | ||
|
||
def myLSP(files: Ref[IO, Set[String]]) = | ||
LSPBuilder | ||
.create[IO] | ||
.handleRequest(initialize) { in => | ||
sendMessage(in.toClient, "ready to initialise!") *> | ||
IO { | ||
InitializeResult( | ||
capabilities = ServerCapabilities(textDocumentSync = | ||
Opt(TextDocumentSyncKind.Full) | ||
), | ||
serverInfo = Opt(InitializeResult.ServerInfo("My first LSP!")) | ||
) | ||
} | ||
} | ||
.handleNotification(textDocument.didOpen) { in => | ||
val documentUri = in.params.textDocument.uri.value | ||
files.updateAndGet(_ + documentUri).map(_.size).flatMap { count => | ||
sendMessage(in.toClient, s"In total, $count files registered!") | ||
} | ||
} | ||
|
||
def sendMessage(back: Communicate[IO], msg: String) = | ||
back.notification( | ||
window.showMessage, | ||
ShowMessageParams(MessageType.Info, msg) | ||
) |
Oops, something went wrong.