mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 15:52:05 +03:00
Fix Flatbuffers Issues for IDE (#741)
This commit is contained in:
parent
ed7c2361c2
commit
7d82b1abee
@ -73,7 +73,7 @@ services components, as well as any open questions that may remain.
|
|||||||
- [`WorkspaceEdit`](#workspaceedit)
|
- [`WorkspaceEdit`](#workspaceedit)
|
||||||
- [Connection Management](#connection-management)
|
- [Connection Management](#connection-management)
|
||||||
- [`session/initProtocolConnection`](#sessioninitprotocolconnection)
|
- [`session/initProtocolConnection`](#sessioninitprotocolconnection)
|
||||||
- [`session/initDataConnection`](#sessioninitdataconnection)
|
- [`session/initBinaryConnection`](#sessioninitbinaryconnection)
|
||||||
- [Capability Management](#capability-management)
|
- [Capability Management](#capability-management)
|
||||||
- [`capability/acquire`](#capabilityacquire)
|
- [`capability/acquire`](#capabilityacquire)
|
||||||
- [`capability/release`](#capabilityrelease)
|
- [`capability/release`](#capabilityrelease)
|
||||||
@ -87,6 +87,8 @@ services components, as well as any open questions that may remain.
|
|||||||
- [File Management Operations](#file-management-operations)
|
- [File Management Operations](#file-management-operations)
|
||||||
- [`file/write`](#filewrite)
|
- [`file/write`](#filewrite)
|
||||||
- [`file/read`](#fileread)
|
- [`file/read`](#fileread)
|
||||||
|
- [`file/writeBinary`](#filewritebinary)
|
||||||
|
- [`file/readBinary`](#filereadbinary)
|
||||||
- [`file/create`](#filecreate)
|
- [`file/create`](#filecreate)
|
||||||
- [`file/delete`](#filedelete)
|
- [`file/delete`](#filedelete)
|
||||||
- [`file/copy`](#filecopy)
|
- [`file/copy`](#filecopy)
|
||||||
@ -592,21 +594,23 @@ requests, each request/response/notification is wrapped in an envelope
|
|||||||
structure. There is a separate envelope for incoming and outgoing messages:
|
structure. There is a separate envelope for incoming and outgoing messages:
|
||||||
|
|
||||||
```idl
|
```idl
|
||||||
namespace org.enso.languageserver.protocol.data.envelope;
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
//A mapping between payload enum and inbound payload types.
|
//A mapping between payload enum and inbound payload types.
|
||||||
union InboundPayload {
|
union InboundPayload {
|
||||||
SESSION_INIT: org.enso.languageserver.protocol.data.session.SessionInit
|
INIT_SESSION_CMD: InitSessionCommand,
|
||||||
|
WRITE_FILE_CMD: WriteFileCommand,
|
||||||
|
READ_FILE_CMD: ReadFileCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
//An envelope for inbound requests and commands.
|
//An envelope for inbound requests and commands.
|
||||||
table InboundMessage {
|
table InboundMessage {
|
||||||
|
|
||||||
//A unique id of the request sent to the server.
|
//A unique id of the message sent to the server.
|
||||||
requestId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
messageId: EnsoUUID (required);
|
||||||
|
|
||||||
//An optional correlation id used to correlate a response with a request.
|
//An optional correlation id used to correlate a response with a request.
|
||||||
correlationId: org.enso.languageserver.protocol.data.util.EnsoUUID;
|
correlationId: EnsoUUID;
|
||||||
|
|
||||||
//A message payload that carries requests sent by a client.
|
//A message payload that carries requests sent by a client.
|
||||||
payload: InboundPayload (required);
|
payload: InboundPayload (required);
|
||||||
@ -615,21 +619,24 @@ table InboundMessage {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```idl
|
```idl
|
||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
//A mapping between payload enum and outbound payload types.
|
//A mapping between payload enum and outbound payload types.
|
||||||
union OutboundPayload {
|
union OutboundPayload {
|
||||||
ERROR: org.enso.languageserver.protocol.data.util.Error,
|
ERROR: Error,
|
||||||
SESSION_INIT_RESPONSE: org.enso.languageserver.protocol.data.session.SessionInitResponse,
|
SUCCESS: Success,
|
||||||
VISUALISATION_UPDATE: org.enso.languageserver.protocol.data.executioncontext.VisualisationUpdate
|
VISUALISATION_UPDATE: VisualisationUpdate,
|
||||||
|
FILE_CONTENTS_REPLY: FileContentsReply
|
||||||
}
|
}
|
||||||
|
|
||||||
//An envelope for outbound responses.
|
//An envelope for outbound responses.
|
||||||
table OutboundMessage {
|
table OutboundMessage {
|
||||||
|
|
||||||
//A unique id of the request sent to the server.
|
//A unique id of the message sent from the server.
|
||||||
requestId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
messageId: EnsoUUID (required);
|
||||||
|
|
||||||
//An optional correlation id used to correlate a response with a request.
|
//An optional correlation id used to correlate a response with a request.
|
||||||
correlationId: org.enso.languageserver.protocol.data.util.EnsoUUID;
|
correlationId: EnsoUUID;
|
||||||
|
|
||||||
//A message payload that carries responses and notifications sent by a server
|
//A message payload that carries responses and notifications sent by a server
|
||||||
payload: OutboundPayload (required);
|
payload: OutboundPayload (required);
|
||||||
@ -638,9 +645,9 @@ table OutboundMessage {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```idl
|
```idl
|
||||||
namespace org.enso.languageserver.protocol.data.util;
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
//A generic error object.
|
//This message type is used to indicate failure of some operation performed.
|
||||||
table Error {
|
table Error {
|
||||||
|
|
||||||
//A unique error code identifying error type.
|
//A unique error code identifying error type.
|
||||||
@ -650,6 +657,9 @@ table Error {
|
|||||||
message: string;
|
message: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Indicates an operation has succeeded.
|
||||||
|
table Success {}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Binary Protocol Communication Patterns
|
### Binary Protocol Communication Patterns
|
||||||
@ -770,6 +780,21 @@ interface Path {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```idl
|
||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//A representation of a path relative to a specified content root.
|
||||||
|
table Path {
|
||||||
|
|
||||||
|
//a content root id that the path is relative to
|
||||||
|
rootId: EnsoUUID;
|
||||||
|
|
||||||
|
//path segments
|
||||||
|
segments: [string];
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### `IPWithSocket`
|
#### `IPWithSocket`
|
||||||
A IPWithSocket is an endpoint for communication between machines.
|
A IPWithSocket is an endpoint for communication between machines.
|
||||||
|
|
||||||
@ -788,11 +813,17 @@ An EnsoUUID is a value object containing 128-bit universally unique identifier.
|
|||||||
##### Format
|
##### Format
|
||||||
|
|
||||||
```idl
|
```idl
|
||||||
namespace org.enso.languageserver.protocol.data.util;
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//A binary representation of universally unique identifiers.
|
||||||
struct EnsoUUID {
|
struct EnsoUUID {
|
||||||
|
|
||||||
|
//The most significant bits of the UUID.
|
||||||
leastSigBits:uint64;
|
leastSigBits:uint64;
|
||||||
|
|
||||||
|
//The most significant bits of the UUID.
|
||||||
mostSigBits:uint64;
|
mostSigBits:uint64;
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -850,8 +881,8 @@ interface ProjectOpenRequest {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface ProjectOpenResult {
|
interface ProjectOpenResult {
|
||||||
languageServerRpcAddress: IPWithSocket;
|
languageServerJsonAddress: IPWithSocket;
|
||||||
languageServerDataAddress: IPWithSocket;
|
languageServerBinaryAddress: IPWithSocket;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1321,7 +1352,7 @@ be correlated between the textual and data connections.
|
|||||||
- [`SessionAlreadyInitialisedError`](#sessionalreadyinitialisederror) to signal
|
- [`SessionAlreadyInitialisedError`](#sessionalreadyinitialisederror) to signal
|
||||||
that session is already initialised.
|
that session is already initialised.
|
||||||
|
|
||||||
#### `session/initDataConnection`
|
#### `session/initBinaryConnection`
|
||||||
This message initialises the data connection used for transferring binary data
|
This message initialises the data connection used for transferring binary data
|
||||||
between engine and clients. This initialisation is important such that the
|
between engine and clients. This initialisation is important such that the
|
||||||
client identifier can be correlated between the data and textual connections.
|
client identifier can be correlated between the data and textual connections.
|
||||||
@ -1334,29 +1365,26 @@ client identifier can be correlated between the data and textual connections.
|
|||||||
##### Parameters
|
##### Parameters
|
||||||
|
|
||||||
```idl
|
```idl
|
||||||
namespace org.enso.languageserver.protocol.data.session;
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
//A command initializing a data session.
|
//A command initializing a data session.
|
||||||
table SessionInit {
|
table InitSessionCommand {
|
||||||
|
|
||||||
//A unique identifier of a client initializing the session.
|
//A unique identifier of a client initializing the session.
|
||||||
identifier: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
identifier: EnsoUUID (required);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//A void response signaling that the session has been initialized.
|
root_type InitSessionCommand;
|
||||||
table SessionInitResponse {}
|
|
||||||
|
|
||||||
root_type SessionInit;
|
|
||||||
root_type SessionInitResponse;
|
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Result
|
##### Result
|
||||||
|
|
||||||
```
|
```
|
||||||
namespace session;
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
table InitResponse {}
|
//Indicates an operation has succeeded.
|
||||||
|
table Success {}
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Errors
|
##### Errors
|
||||||
@ -1619,6 +1647,106 @@ return the contents from the in-memory buffer rather than the file on disk.
|
|||||||
access to a resource.
|
access to a resource.
|
||||||
- [`FileNotFound`](#filenotfound) informs that file cannot be found.
|
- [`FileNotFound`](#filenotfound) informs that file cannot be found.
|
||||||
|
|
||||||
|
#### `file/writeBinary`
|
||||||
|
This requests that the file manager component write to a specified file with
|
||||||
|
the binary contents.
|
||||||
|
|
||||||
|
- **Type:** Request
|
||||||
|
- **Connection:** Binary
|
||||||
|
- **Direction:** Client -> Server
|
||||||
|
|
||||||
|
This request is _explicitly_ allowed to write to files that do not exist, and
|
||||||
|
will create them under such circumstances. If a file is recorded as 'open' by
|
||||||
|
one of the clients, and another client attempts to write to that file, the
|
||||||
|
write must fail.
|
||||||
|
|
||||||
|
##### Parameters
|
||||||
|
|
||||||
|
```idl
|
||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//A command writing binary contents to a file.
|
||||||
|
table WriteFileCommand {
|
||||||
|
|
||||||
|
//A path to a file.
|
||||||
|
path: Path;
|
||||||
|
|
||||||
|
//Binary contents.
|
||||||
|
contents: [ubyte];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Result
|
||||||
|
|
||||||
|
```idl
|
||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//Indicates an operation has succeeded.
|
||||||
|
table Success {}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Errors
|
||||||
|
|
||||||
|
- [`FileSystemError`](#filesystemerror) to signal a generic, unrecoverable
|
||||||
|
file-system error.
|
||||||
|
- [`ContentRootNotFoundError`](#contentrootnotfounderror) to signal that the
|
||||||
|
requested content root cannot be found.
|
||||||
|
- [`AccessDeniedError`](#accessdeniederror) to signal that a user doesn't have
|
||||||
|
access to a resource.
|
||||||
|
|
||||||
|
#### `file/readBinary`
|
||||||
|
This requests that the file manager component reads the binary contents of a
|
||||||
|
specified file.
|
||||||
|
|
||||||
|
- **Type:** Request
|
||||||
|
- **Direction:** Client -> Server
|
||||||
|
- **Connection:** Binary
|
||||||
|
- **Visibility:** Public
|
||||||
|
|
||||||
|
If the file is recorded as open by the language server, then the result will
|
||||||
|
return the contents from the in-memory buffer rather than the file on disk.
|
||||||
|
|
||||||
|
##### Parameters
|
||||||
|
|
||||||
|
```idl
|
||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//A command reading binary contents from a file.
|
||||||
|
table ReadFileCommand {
|
||||||
|
|
||||||
|
//A path to a file.
|
||||||
|
path: Path;
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Result
|
||||||
|
|
||||||
|
```idl
|
||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//A reply for a ReadFileCommand.
|
||||||
|
table FileContentsReply {
|
||||||
|
|
||||||
|
//Binary contents.
|
||||||
|
contents: [ubyte];
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Errors
|
||||||
|
|
||||||
|
- [`FileSystemError`](#filesystemerror) to signal a generic, unrecoverable
|
||||||
|
file-system error.
|
||||||
|
- [`ContentRootNotFoundError`](#contentrootnotfounderror) to signal that the
|
||||||
|
requested content root cannot be found.
|
||||||
|
- [`AccessDeniedError`](#accessdeniederror) to signal that a user doesn't have
|
||||||
|
access to a resource.
|
||||||
|
- [`FileNotFound`](#filenotfound) informs that file cannot be found.
|
||||||
|
|
||||||
|
|
||||||
#### `file/create`
|
#### `file/create`
|
||||||
This request asks the file manager to create the specified file system object.
|
This request asks the file manager to create the specified file system object.
|
||||||
|
|
||||||
@ -2879,19 +3007,19 @@ transport is concerned, it is just a binary blob.
|
|||||||
##### Parameters
|
##### Parameters
|
||||||
|
|
||||||
```idl
|
```idl
|
||||||
namespace org.enso.languageserver.protocol.data.executioncontext;
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
//A visualisation context identifying a concrete visualisation.
|
//A visualisation context identifying a concrete visualisation.
|
||||||
table VisualisationContext {
|
table VisualisationContext {
|
||||||
|
|
||||||
//A visualisation identifier.
|
//A visualisation identifier.
|
||||||
visualisationId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
visualisationId: EnsoUUID (required);
|
||||||
|
|
||||||
//A context identifier.
|
//A context identifier.
|
||||||
contextId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
contextId: EnsoUUID (required);
|
||||||
|
|
||||||
//An expression identifier.
|
//An expression identifier.
|
||||||
expressionId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
expressionId: EnsoUUID (required);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ class LanguageServerComponent(config: LanguageServerConfig)
|
|||||||
override def start(): Future[ComponentStarted.type] = {
|
override def start(): Future[ComponentStarted.type] = {
|
||||||
logger.info("Starting Language Server...")
|
logger.info("Starting Language Server...")
|
||||||
for {
|
for {
|
||||||
module <- Future { new MainModule(config) }
|
module <- Future { new MainModule(config) }
|
||||||
rpcBinding <- module.jsonRpcServer.bind(config.interface, config.rpcPort)
|
jsonBinding <- module.jsonRpcServer.bind(config.interface, config.rpcPort)
|
||||||
dataBinding <- module.dataServer.bind(config.interface, config.dataPort)
|
binaryBinding <- module.dataServer.bind(config.interface, config.dataPort)
|
||||||
_ <- Future {
|
_ <- Future {
|
||||||
maybeServerCtx = Some(ServerContext(module, rpcBinding, dataBinding))
|
maybeServerCtx = Some(ServerContext(module, jsonBinding, binaryBinding))
|
||||||
}
|
}
|
||||||
_ <- Future {
|
_ <- Future {
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -53,8 +53,8 @@ class LanguageServerComponent(config: LanguageServerConfig)
|
|||||||
|
|
||||||
case Some(serverState) =>
|
case Some(serverState) =>
|
||||||
for {
|
for {
|
||||||
_ <- serverState.rpcBinding.terminate(10.seconds)
|
_ <- serverState.jsonBinding.terminate(10.seconds)
|
||||||
_ <- serverState.dataBinding.terminate(10.seconds)
|
_ <- serverState.binaryBinding.terminate(10.seconds)
|
||||||
_ <- serverState.mainModule.system.terminate()
|
_ <- serverState.mainModule.system.terminate()
|
||||||
_ <- Future { serverState.mainModule.context.close(true) }
|
_ <- Future { serverState.mainModule.context.close(true) }
|
||||||
_ <- Future { maybeServerCtx = None }
|
_ <- Future { maybeServerCtx = None }
|
||||||
@ -75,8 +75,8 @@ class LanguageServerComponent(config: LanguageServerConfig)
|
|||||||
|
|
||||||
case Some(serverState) =>
|
case Some(serverState) =>
|
||||||
for {
|
for {
|
||||||
_ <- serverState.rpcBinding.terminate(10.seconds).recover(logError)
|
_ <- serverState.jsonBinding.terminate(10.seconds).recover(logError)
|
||||||
_ <- serverState.dataBinding.terminate(10.seconds).recover(logError)
|
_ <- serverState.binaryBinding.terminate(10.seconds).recover(logError)
|
||||||
_ <- serverState.mainModule.system.terminate().recover(logError)
|
_ <- serverState.mainModule.system.terminate().recover(logError)
|
||||||
_ <- Future { serverState.mainModule.context.close(true) }
|
_ <- Future { serverState.mainModule.context.close(true) }
|
||||||
.recover(logError)
|
.recover(logError)
|
||||||
@ -97,13 +97,13 @@ object LanguageServerComponent {
|
|||||||
* A running server context.
|
* A running server context.
|
||||||
*
|
*
|
||||||
* @param mainModule a main module containing all components of the server
|
* @param mainModule a main module containing all components of the server
|
||||||
* @param rpcBinding a http binding for rpc protocol
|
* @param jsonBinding a http binding for rpc protocol
|
||||||
* @param dataBinding a http binding for data protocol
|
* @param binaryBinding a http binding for data protocol
|
||||||
*/
|
*/
|
||||||
case class ServerContext(
|
case class ServerContext(
|
||||||
mainModule: MainModule,
|
mainModule: MainModule,
|
||||||
rpcBinding: Http.ServerBinding,
|
jsonBinding: Http.ServerBinding,
|
||||||
dataBinding: Http.ServerBinding
|
binaryBinding: Http.ServerBinding
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ import org.enso.languageserver.filemanager.{
|
|||||||
ReceivesTreeUpdatesHandler
|
ReceivesTreeUpdatesHandler
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.http.server.BinaryWebSocketServer
|
import org.enso.languageserver.http.server.BinaryWebSocketServer
|
||||||
import org.enso.languageserver.protocol.data.{
|
import org.enso.languageserver.protocol.binary.{
|
||||||
BinaryConnectionControllerFactory,
|
BinaryConnectionControllerFactory,
|
||||||
InboundMessageDecoder
|
InboundMessageDecoder
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.rpc.{
|
import org.enso.languageserver.protocol.json.{
|
||||||
JsonRpc,
|
JsonConnectionControllerFactory,
|
||||||
RpcConnectionControllerFactory
|
JsonRpc
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.runtime.{ContextRegistry, RuntimeConnector}
|
import org.enso.languageserver.runtime.{ContextRegistry, RuntimeConnector}
|
||||||
import org.enso.languageserver.session.SessionRouter
|
import org.enso.languageserver.session.SessionRouter
|
||||||
@ -120,7 +120,7 @@ class MainModule(serverConfig: LanguageServerConfig) {
|
|||||||
.build()
|
.build()
|
||||||
context.initialize(LanguageInfo.ID)
|
context.initialize(LanguageInfo.ID)
|
||||||
|
|
||||||
lazy val clientControllerFactory = new RpcConnectionControllerFactory(
|
lazy val clientControllerFactory = new JsonConnectionControllerFactory(
|
||||||
bufferRegistry,
|
bufferRegistry,
|
||||||
capabilityRouter,
|
capabilityRouter,
|
||||||
fileManager,
|
fileManager,
|
||||||
|
@ -2,7 +2,7 @@ package org.enso.languageserver.capability
|
|||||||
|
|
||||||
import org.enso.languageserver.data.CapabilityRegistration
|
import org.enso.languageserver.data.CapabilityRegistration
|
||||||
import org.enso.languageserver.filemanager.FileSystemFailure
|
import org.enso.languageserver.filemanager.FileSystemFailure
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
|
|
||||||
object CapabilityProtocol {
|
object CapabilityProtocol {
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ object CapabilityProtocol {
|
|||||||
* @param registration the capability to grant.
|
* @param registration the capability to grant.
|
||||||
*/
|
*/
|
||||||
case class AcquireCapability(
|
case class AcquireCapability(
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
registration: CapabilityRegistration
|
registration: CapabilityRegistration
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ object CapabilityProtocol {
|
|||||||
* @param capability the capability being released.
|
* @param capability the capability being released.
|
||||||
*/
|
*/
|
||||||
case class ReleaseCapability(
|
case class ReleaseCapability(
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
capability: CapabilityRegistration
|
capability: CapabilityRegistration
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.enso.languageserver.event
|
package org.enso.languageserver.event
|
||||||
|
|
||||||
import org.enso.languageserver.session.{DataSession, RpcSession}
|
import org.enso.languageserver.session.{BinarySession, JsonSession}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base trait for all session events.
|
* Base trait for all session events.
|
||||||
@ -12,7 +12,7 @@ sealed trait SessionEvent extends Event
|
|||||||
*
|
*
|
||||||
* @param session an object representing a client session
|
* @param session an object representing a client session
|
||||||
*/
|
*/
|
||||||
case class RpcSessionInitialized(session: RpcSession) extends SessionEvent
|
case class RpcSessionInitialized(session: JsonSession) extends SessionEvent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the Language Server about a client disconnecting rpc session.
|
* Notifies the Language Server about a client disconnecting rpc session.
|
||||||
@ -20,14 +20,14 @@ case class RpcSessionInitialized(session: RpcSession) extends SessionEvent
|
|||||||
*
|
*
|
||||||
* @param session an object representing a client session
|
* @param session an object representing a client session
|
||||||
*/
|
*/
|
||||||
case class RpcSessionTerminated(session: RpcSession) extends SessionEvent
|
case class RpcSessionTerminated(session: JsonSession) extends SessionEvent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the Language Server about a new data session.
|
* Notifies the Language Server about a new data session.
|
||||||
*
|
*
|
||||||
* @param session an object representing a client session
|
* @param session an object representing a client session
|
||||||
*/
|
*/
|
||||||
case class DataSessionInitialized(session: DataSession) extends SessionEvent
|
case class DataSessionInitialized(session: BinarySession) extends SessionEvent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the Language Server about a client disconnecting data session.
|
* Notifies the Language Server about a client disconnecting data session.
|
||||||
@ -35,4 +35,4 @@ case class DataSessionInitialized(session: DataSession) extends SessionEvent
|
|||||||
*
|
*
|
||||||
* @param session an object representing a client session
|
* @param session an object representing a client session
|
||||||
*/
|
*/
|
||||||
case class DataSessionTerminated(session: DataSession) extends SessionEvent
|
case class DataSessionTerminated(session: BinarySession) extends SessionEvent
|
||||||
|
@ -9,7 +9,7 @@ import org.enso.languageserver.filemanager.FileManagerApi.{
|
|||||||
OperationTimeoutError
|
OperationTimeoutError
|
||||||
}
|
}
|
||||||
import org.enso.jsonrpc.Error
|
import org.enso.jsonrpc.Error
|
||||||
import org.enso.languageserver.protocol.rpc.ErrorApi
|
import org.enso.languageserver.protocol.json.ErrorApi
|
||||||
|
|
||||||
object FileSystemFailureMapper {
|
object FileSystemFailureMapper {
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.protocol.data
|
package org.enso.languageserver.protocol.binary
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
@ -15,30 +15,30 @@ import org.enso.languageserver.http.server.BinaryWebSocketControlProtocol.{
|
|||||||
ConnectionFailed,
|
ConnectionFailed,
|
||||||
OutboundStreamEstablished
|
OutboundStreamEstablished
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.BinaryConnectionController.InboundPayloadType
|
import org.enso.languageserver.protocol.binary.InboundPayload.{
|
||||||
import org.enso.languageserver.protocol.data.envelope.InboundPayload.{
|
|
||||||
INIT_SESSION_CMD,
|
INIT_SESSION_CMD,
|
||||||
READ_FILE_CMD,
|
READ_FILE_CMD,
|
||||||
WRITE_FILE_CMD
|
WRITE_FILE_CMD
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.envelope.{
|
import org.enso.languageserver.protocol.binary.{
|
||||||
|
EnsoUUID,
|
||||||
InboundMessage,
|
InboundMessage,
|
||||||
|
InitSessionCommand,
|
||||||
OutboundPayload
|
OutboundPayload
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.factory.{
|
import org.enso.languageserver.protocol.binary.BinaryConnectionController.InboundPayloadType
|
||||||
|
import org.enso.languageserver.protocol.binary.factory.{
|
||||||
ErrorFactory,
|
ErrorFactory,
|
||||||
OutboundMessageFactory,
|
OutboundMessageFactory,
|
||||||
SuccessReplyFactory,
|
SuccessReplyFactory,
|
||||||
VisualisationUpdateFactory
|
VisualisationUpdateFactory
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.session.InitSessionCommand
|
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
|
||||||
import org.enso.languageserver.requesthandler.file.{
|
import org.enso.languageserver.requesthandler.file.{
|
||||||
ReadBinaryFileHandler,
|
ReadBinaryFileHandler,
|
||||||
WriteBinaryFileHandler
|
WriteBinaryFileHandler
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.VisualisationUpdate
|
import org.enso.languageserver.runtime.ContextRegistryProtocol.VisualisationUpdate
|
||||||
import org.enso.languageserver.session.DataSession
|
import org.enso.languageserver.session.BinarySession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
import org.enso.languageserver.util.binary.DecodingFailure
|
import org.enso.languageserver.util.binary.DecodingFailure
|
||||||
import org.enso.languageserver.util.binary.DecodingFailure.{
|
import org.enso.languageserver.util.binary.DecodingFailure.{
|
||||||
@ -90,9 +90,9 @@ class BinaryConnectionController(
|
|||||||
payload.identifier().leastSigBits()
|
payload.identifier().leastSigBits()
|
||||||
)
|
)
|
||||||
|
|
||||||
val responsePacket = createSessionInitResponsePacket(msg.requestId())
|
val responsePacket = createSessionInitResponsePacket(msg.messageId())
|
||||||
outboundChannel ! responsePacket
|
outboundChannel ! responsePacket
|
||||||
val session = DataSession(clientId, self)
|
val session = BinarySession(clientId, self)
|
||||||
context.system.eventStream.publish(DataSessionInitialized(session))
|
context.system.eventStream.publish(DataSessionInitialized(session))
|
||||||
log.info(s"Data session initialized for client: $clientId [$clientIp]")
|
log.info(s"Data session initialized for client: $clientId [$clientIp]")
|
||||||
context.become(
|
context.become(
|
||||||
@ -128,7 +128,7 @@ class BinaryConnectionController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def connectionEndHandler(
|
private def connectionEndHandler(
|
||||||
maybeDataSession: Option[DataSession] = None
|
maybeDataSession: Option[BinarySession] = None
|
||||||
): Receive = {
|
): Receive = {
|
||||||
case ConnectionClosed =>
|
case ConnectionClosed =>
|
||||||
log.info(s"Connection closed [$clientIp]")
|
log.info(s"Connection closed [$clientIp]")
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.protocol.data
|
package org.enso.languageserver.protocol.binary
|
||||||
|
|
||||||
import akka.actor.{ActorRef, ActorSystem, Props}
|
import akka.actor.{ActorRef, ActorSystem, Props}
|
||||||
import akka.http.scaladsl.model.RemoteAddress
|
import akka.http.scaladsl.model.RemoteAddress
|
@ -1,11 +1,8 @@
|
|||||||
package org.enso.languageserver.protocol.data
|
package org.enso.languageserver.protocol.binary
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
import org.enso.languageserver.protocol.data.envelope.{
|
import org.enso.languageserver.protocol.binary.{InboundMessage, InboundPayload}
|
||||||
InboundMessage,
|
|
||||||
InboundPayload
|
|
||||||
}
|
|
||||||
import org.enso.languageserver.util.binary.DecodingFailure.{
|
import org.enso.languageserver.util.binary.DecodingFailure.{
|
||||||
DataCorrupted,
|
DataCorrupted,
|
||||||
EmptyPayload,
|
EmptyPayload,
|
@ -1,9 +1,9 @@
|
|||||||
package org.enso.languageserver.protocol.data.factory
|
package org.enso.languageserver.protocol.binary.factory
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||||
|
|
||||||
object EnsoUuidFactory {
|
object EnsoUuidFactory {
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package org.enso.languageserver.protocol.data.factory
|
package org.enso.languageserver.protocol.binary.factory
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.envelope.OutboundPayload
|
import org.enso.languageserver.protocol.binary.OutboundPayload
|
||||||
import org.enso.languageserver.protocol.data.util.{EnsoUUID, Error}
|
import org.enso.languageserver.protocol.binary.{EnsoUUID, Error}
|
||||||
|
|
||||||
object ErrorFactory {
|
object ErrorFactory {
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
package org.enso.languageserver.protocol.data.factory
|
package org.enso.languageserver.protocol.binary.factory
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.envelope.OutboundPayload
|
import org.enso.languageserver.protocol.binary.OutboundPayload
|
||||||
import org.enso.languageserver.protocol.data.filemanager.FileContentsReply
|
import org.enso.languageserver.protocol.binary.FileContentsReply
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||||
|
|
||||||
object FileContentsReplyFactory {
|
object FileContentsReplyFactory {
|
||||||
|
|
@ -1,17 +1,17 @@
|
|||||||
package org.enso.languageserver.protocol.data.factory
|
package org.enso.languageserver.protocol.binary.factory
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.envelope.OutboundMessage
|
import org.enso.languageserver.protocol.binary.OutboundMessage
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||||
|
|
||||||
object OutboundMessageFactory {
|
object OutboundMessageFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an [[OutboundMessage]] inside a [[FlatBufferBuilder]].
|
* Creates an [[OutboundMessage]] inside a [[FlatBufferBuilder]].
|
||||||
*
|
*
|
||||||
* @param requestId a unique id of the request sent to the server
|
* @param messageId a unique id of the message sent from the server
|
||||||
* @param maybeCorrelationId an optional correlation id used to correlate
|
* @param maybeCorrelationId an optional correlation id used to correlate
|
||||||
* a response with a request
|
* a response with a request
|
||||||
* @param payloadType a payload type indicating the type of the payload
|
* @param payloadType a payload type indicating the type of the payload
|
||||||
@ -23,14 +23,14 @@ object OutboundMessageFactory {
|
|||||||
* created object
|
* created object
|
||||||
*/
|
*/
|
||||||
def create(
|
def create(
|
||||||
requestId: UUID,
|
messageId: UUID,
|
||||||
maybeCorrelationId: Option[EnsoUUID],
|
maybeCorrelationId: Option[EnsoUUID],
|
||||||
payloadType: Byte,
|
payloadType: Byte,
|
||||||
payload: Int
|
payload: Int
|
||||||
)(implicit builder: FlatBufferBuilder): Int = {
|
)(implicit builder: FlatBufferBuilder): Int = {
|
||||||
OutboundMessage.startOutboundMessage(builder)
|
OutboundMessage.startOutboundMessage(builder)
|
||||||
val reqId = EnsoUuidFactory.create(requestId)
|
val reqId = EnsoUuidFactory.create(messageId)
|
||||||
OutboundMessage.addRequestId(builder, reqId)
|
OutboundMessage.addMessageId(builder, reqId)
|
||||||
maybeCorrelationId.foreach { uuid =>
|
maybeCorrelationId.foreach { uuid =>
|
||||||
val corId = EnsoUuidFactory.create(uuid)
|
val corId = EnsoUuidFactory.create(uuid)
|
||||||
OutboundMessage.addCorrelationId(builder, corId)
|
OutboundMessage.addCorrelationId(builder, corId)
|
@ -1,11 +1,11 @@
|
|||||||
package org.enso.languageserver.protocol.data.factory
|
package org.enso.languageserver.protocol.binary.factory
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.envelope.OutboundPayload
|
import org.enso.languageserver.protocol.binary.OutboundPayload
|
||||||
import org.enso.languageserver.protocol.data.util.{EnsoUUID, Success}
|
import org.enso.languageserver.protocol.binary.{EnsoUUID, Success}
|
||||||
|
|
||||||
object SuccessReplyFactory {
|
object SuccessReplyFactory {
|
||||||
|
|
@ -1,7 +1,10 @@
|
|||||||
package org.enso.languageserver.protocol.data.factory
|
package org.enso.languageserver.protocol.binary.factory
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.executioncontext
|
import org.enso.languageserver.protocol.binary.{
|
||||||
|
VisualisationContext => BinaryVisualisationContext,
|
||||||
|
VisualisationUpdate => BinaryVisualisationUpdate
|
||||||
|
}
|
||||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
||||||
VisualisationContext,
|
VisualisationContext,
|
||||||
VisualisationUpdate
|
VisualisationUpdate
|
||||||
@ -23,9 +26,8 @@ object VisualisationUpdateFactory {
|
|||||||
): Int = {
|
): Int = {
|
||||||
val ctx = createVisualisationCtx(update.visualisationContext)
|
val ctx = createVisualisationCtx(update.visualisationContext)
|
||||||
val data =
|
val data =
|
||||||
executioncontext.VisualisationUpdate
|
BinaryVisualisationUpdate.createDataVector(builder, update.data)
|
||||||
.createDataVector(builder, update.data)
|
BinaryVisualisationUpdate.createVisualisationUpdate(
|
||||||
executioncontext.VisualisationUpdate.createVisualisationUpdate(
|
|
||||||
builder,
|
builder,
|
||||||
ctx,
|
ctx,
|
||||||
data
|
data
|
||||||
@ -44,14 +46,20 @@ object VisualisationUpdateFactory {
|
|||||||
def createVisualisationCtx(ctx: VisualisationContext)(
|
def createVisualisationCtx(ctx: VisualisationContext)(
|
||||||
implicit builder: FlatBufferBuilder
|
implicit builder: FlatBufferBuilder
|
||||||
): Int = {
|
): Int = {
|
||||||
executioncontext.VisualisationContext.startVisualisationContext(builder)
|
BinaryVisualisationContext.startVisualisationContext(builder)
|
||||||
executioncontext.VisualisationContext
|
BinaryVisualisationContext.addContextId(
|
||||||
.addContextId(builder, EnsoUuidFactory.create(ctx.contextId))
|
builder,
|
||||||
executioncontext.VisualisationContext
|
EnsoUuidFactory.create(ctx.contextId)
|
||||||
.addExpressionId(builder, EnsoUuidFactory.create(ctx.expressionId))
|
)
|
||||||
executioncontext.VisualisationContext
|
BinaryVisualisationContext.addExpressionId(
|
||||||
.addVisualisationId(builder, EnsoUuidFactory.create(ctx.visualisationId))
|
builder,
|
||||||
executioncontext.VisualisationContext.endVisualisationContext(builder)
|
EnsoUuidFactory.create(ctx.expressionId)
|
||||||
|
)
|
||||||
|
BinaryVisualisationContext.addVisualisationId(
|
||||||
|
builder,
|
||||||
|
EnsoUuidFactory.create(ctx.visualisationId)
|
||||||
|
)
|
||||||
|
BinaryVisualisationContext.endVisualisationContext(builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.protocol.rpc
|
package org.enso.languageserver.protocol.json
|
||||||
|
|
||||||
import org.enso.jsonrpc.Error
|
import org.enso.jsonrpc.Error
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.protocol.rpc
|
package org.enso.languageserver.protocol.json
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ import org.enso.languageserver.runtime.VisualisationApi.{
|
|||||||
DetachVisualisation,
|
DetachVisualisation,
|
||||||
ModifyVisualisation
|
ModifyVisualisation
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.session.SessionApi.{
|
import org.enso.languageserver.session.SessionApi.{
|
||||||
InitProtocolConnection,
|
InitProtocolConnection,
|
||||||
SessionAlreadyInitialisedError,
|
SessionAlreadyInitialisedError,
|
||||||
@ -59,7 +59,7 @@ import scala.concurrent.duration._
|
|||||||
* @param contextRegistry a router that dispatches execution context requests
|
* @param contextRegistry a router that dispatches execution context requests
|
||||||
* @param requestTimeout a request timeout
|
* @param requestTimeout a request timeout
|
||||||
*/
|
*/
|
||||||
class RpcConnectionController(
|
class JsonConnectionController(
|
||||||
val connectionId: UUID,
|
val connectionId: UUID,
|
||||||
val bufferRegistry: ActorRef,
|
val bufferRegistry: ActorRef,
|
||||||
val capabilityRouter: ActorRef,
|
val capabilityRouter: ActorRef,
|
||||||
@ -101,7 +101,7 @@ class RpcConnectionController(
|
|||||||
InitProtocolConnection.Params(clientId)
|
InitProtocolConnection.Params(clientId)
|
||||||
) =>
|
) =>
|
||||||
log.info(s"RPC session initialized for client: $clientId")
|
log.info(s"RPC session initialized for client: $clientId")
|
||||||
val session = RpcSession(clientId, self)
|
val session = JsonSession(clientId, self)
|
||||||
context.system.eventStream.publish(RpcSessionInitialized(session))
|
context.system.eventStream.publish(RpcSessionInitialized(session))
|
||||||
val requestHandlers = createRequestHandlers(session)
|
val requestHandlers = createRequestHandlers(session)
|
||||||
val handler = context.actorOf(
|
val handler = context.actorOf(
|
||||||
@ -119,7 +119,7 @@ class RpcConnectionController(
|
|||||||
|
|
||||||
private def initialised(
|
private def initialised(
|
||||||
webActor: ActorRef,
|
webActor: ActorRef,
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
requestHandlers: Map[Method, Props]
|
requestHandlers: Map[Method, Props]
|
||||||
): Receive = {
|
): Receive = {
|
||||||
case Request(InitProtocolConnection, id, _) =>
|
case Request(InitProtocolConnection, id, _) =>
|
||||||
@ -157,7 +157,7 @@ class RpcConnectionController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def createRequestHandlers(
|
private def createRequestHandlers(
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Map[Method, Props] =
|
): Map[Method, Props] =
|
||||||
Map(
|
Map(
|
||||||
Ping -> PingHandler.props(
|
Ping -> PingHandler.props(
|
||||||
@ -213,10 +213,10 @@ class RpcConnectionController(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object RpcConnectionController {
|
object JsonConnectionController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a configuration object used to create a [[RpcConnectionController]].
|
* Creates a configuration object used to create a [[JsonConnectionController]].
|
||||||
*
|
*
|
||||||
* @param connectionId the internal connection id.
|
* @param connectionId the internal connection id.
|
||||||
* @param bufferRegistry a router that dispatches text editing requests
|
* @param bufferRegistry a router that dispatches text editing requests
|
||||||
@ -235,7 +235,7 @@ object RpcConnectionController {
|
|||||||
requestTimeout: FiniteDuration = 10.seconds
|
requestTimeout: FiniteDuration = 10.seconds
|
||||||
): Props =
|
): Props =
|
||||||
Props(
|
Props(
|
||||||
new RpcConnectionController(
|
new JsonConnectionController(
|
||||||
connectionId,
|
connectionId,
|
||||||
bufferRegistry,
|
bufferRegistry,
|
||||||
capabilityRouter,
|
capabilityRouter,
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.protocol.rpc
|
package org.enso.languageserver.protocol.json
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ import org.enso.jsonrpc.ClientControllerFactory
|
|||||||
* @param capabilityRouter the capability router actor ref
|
* @param capabilityRouter the capability router actor ref
|
||||||
* @param system the actor system
|
* @param system the actor system
|
||||||
*/
|
*/
|
||||||
class RpcConnectionControllerFactory(
|
class JsonConnectionControllerFactory(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
capabilityRouter: ActorRef,
|
capabilityRouter: ActorRef,
|
||||||
fileManager: ActorRef,
|
fileManager: ActorRef,
|
||||||
@ -28,7 +28,7 @@ class RpcConnectionControllerFactory(
|
|||||||
*/
|
*/
|
||||||
override def createClientController(clientId: UUID): ActorRef =
|
override def createClientController(clientId: UUID): ActorRef =
|
||||||
system.actorOf(
|
system.actorOf(
|
||||||
RpcConnectionController.props(
|
JsonConnectionController.props(
|
||||||
clientId,
|
clientId,
|
||||||
bufferRegistry,
|
bufferRegistry,
|
||||||
capabilityRouter,
|
capabilityRouter,
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.protocol.rpc
|
package org.enso.languageserver.protocol.json
|
||||||
|
|
||||||
import io.circe.generic.auto._
|
import io.circe.generic.auto._
|
||||||
import org.enso.jsonrpc.Protocol
|
import org.enso.jsonrpc.Protocol
|
@ -13,7 +13,7 @@ import org.enso.languageserver.capability.CapabilityProtocol.{
|
|||||||
import org.enso.languageserver.data.CapabilityRegistration
|
import org.enso.languageserver.data.CapabilityRegistration
|
||||||
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -28,7 +28,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class AcquireCapabilityHandler(
|
class AcquireCapabilityHandler(
|
||||||
capabilityRouter: ActorRef,
|
capabilityRouter: ActorRef,
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -91,7 +91,7 @@ object AcquireCapabilityHandler {
|
|||||||
def props(
|
def props(
|
||||||
capabilityRouter: ActorRef,
|
capabilityRouter: ActorRef,
|
||||||
requestTimeout: FiniteDuration,
|
requestTimeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(
|
Props(
|
||||||
new AcquireCapabilityHandler(capabilityRouter, requestTimeout, rpcSession)
|
new AcquireCapabilityHandler(capabilityRouter, requestTimeout, rpcSession)
|
||||||
|
@ -15,7 +15,7 @@ import org.enso.languageserver.capability.CapabilityProtocol.{
|
|||||||
}
|
}
|
||||||
import org.enso.languageserver.data.CapabilityRegistration
|
import org.enso.languageserver.data.CapabilityRegistration
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -30,7 +30,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class ReleaseCapabilityHandler(
|
class ReleaseCapabilityHandler(
|
||||||
capabilityRouter: ActorRef,
|
capabilityRouter: ActorRef,
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -86,7 +86,7 @@ object ReleaseCapabilityHandler {
|
|||||||
def props(
|
def props(
|
||||||
capabilityRouter: ActorRef,
|
capabilityRouter: ActorRef,
|
||||||
requestTimeout: FiniteDuration,
|
requestTimeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(
|
Props(
|
||||||
new ReleaseCapabilityHandler(capabilityRouter, requestTimeout, rpcSession)
|
new ReleaseCapabilityHandler(capabilityRouter, requestTimeout, rpcSession)
|
||||||
|
@ -14,7 +14,7 @@ import org.enso.languageserver.runtime.{
|
|||||||
ContextRegistryProtocol,
|
ContextRegistryProtocol,
|
||||||
RuntimeFailureMapper
|
RuntimeFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -29,7 +29,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class CreateHandler(
|
class CreateHandler(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -85,7 +85,7 @@ object CreateHandler {
|
|||||||
def props(
|
def props(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new CreateHandler(timeout, contextRegistry, rpcSession))
|
Props(new CreateHandler(timeout, contextRegistry, rpcSession))
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import org.enso.languageserver.runtime.{
|
|||||||
ContextRegistryProtocol,
|
ContextRegistryProtocol,
|
||||||
RuntimeFailureMapper
|
RuntimeFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -24,7 +24,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class DestroyHandler(
|
class DestroyHandler(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -80,7 +80,7 @@ object DestroyHandler {
|
|||||||
def props(
|
def props(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new DestroyHandler(timeout, contextRegistry, rpcSession))
|
Props(new DestroyHandler(timeout, contextRegistry, rpcSession))
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import org.enso.languageserver.runtime.{
|
|||||||
ContextRegistryProtocol,
|
ContextRegistryProtocol,
|
||||||
RuntimeFailureMapper
|
RuntimeFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -24,7 +24,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class PopHandler(
|
class PopHandler(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -76,7 +76,7 @@ object PopHandler {
|
|||||||
def props(
|
def props(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new PopHandler(timeout, contextRegistry, rpcSession))
|
Props(new PopHandler(timeout, contextRegistry, rpcSession))
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import org.enso.languageserver.runtime.{
|
|||||||
ContextRegistryProtocol,
|
ContextRegistryProtocol,
|
||||||
RuntimeFailureMapper
|
RuntimeFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -24,7 +24,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class PushHandler(
|
class PushHandler(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -84,7 +84,7 @@ object PushHandler {
|
|||||||
def props(
|
def props(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new PushHandler(timeout, contextRegistry, rpcSession))
|
Props(new PushHandler(timeout, contextRegistry, rpcSession))
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import org.enso.languageserver.runtime.{
|
|||||||
ContextRegistryProtocol,
|
ContextRegistryProtocol,
|
||||||
RuntimeFailureMapper
|
RuntimeFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
|
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
@ -24,7 +24,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class RecomputeHandler(
|
class RecomputeHandler(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
session: RpcSession
|
session: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -84,7 +84,7 @@ object RecomputeHandler {
|
|||||||
def props(
|
def props(
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
contextRegistry: ActorRef,
|
contextRegistry: ActorRef,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new RecomputeHandler(timeout, contextRegistry, rpcSession))
|
Props(new RecomputeHandler(timeout, contextRegistry, rpcSession))
|
||||||
|
|
||||||
|
@ -5,13 +5,15 @@ import org.enso.languageserver.filemanager.{
|
|||||||
FileManagerProtocol,
|
FileManagerProtocol,
|
||||||
FileSystemFailureMapper
|
FileSystemFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.envelope.InboundMessage
|
import org.enso.languageserver.protocol.binary.{
|
||||||
import org.enso.languageserver.protocol.data.factory.{
|
EnsoUUID,
|
||||||
|
InboundMessage,
|
||||||
|
ReadFileCommand
|
||||||
|
}
|
||||||
|
import org.enso.languageserver.protocol.binary.factory.{
|
||||||
ErrorFactory,
|
ErrorFactory,
|
||||||
FileContentsReplyFactory
|
FileContentsReplyFactory
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.filemanager.ReadFileCommand
|
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
import org.enso.languageserver.util.file.PathUtils
|
import org.enso.languageserver.util.file.PathUtils
|
||||||
@ -45,7 +47,7 @@ class ReadBinaryFileHandler(
|
|||||||
fileManager ! FileManagerProtocol.ReadBinaryFile(path)
|
fileManager ! FileManagerProtocol.ReadBinaryFile(path)
|
||||||
val cancellable = context.system.scheduler
|
val cancellable = context.system.scheduler
|
||||||
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
||||||
context.become(responseStage(msg.requestId(), cancellable))
|
context.become(responseStage(msg.messageId(), cancellable))
|
||||||
}
|
}
|
||||||
|
|
||||||
private def responseStage(
|
private def responseStage(
|
||||||
|
@ -5,13 +5,15 @@ import org.enso.languageserver.filemanager.{
|
|||||||
FileManagerProtocol,
|
FileManagerProtocol,
|
||||||
FileSystemFailureMapper
|
FileSystemFailureMapper
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.envelope.InboundMessage
|
import org.enso.languageserver.protocol.binary.{
|
||||||
import org.enso.languageserver.protocol.data.factory.{
|
EnsoUUID,
|
||||||
|
InboundMessage,
|
||||||
|
WriteFileCommand
|
||||||
|
}
|
||||||
|
import org.enso.languageserver.protocol.binary.factory.{
|
||||||
ErrorFactory,
|
ErrorFactory,
|
||||||
SuccessReplyFactory
|
SuccessReplyFactory
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.filemanager.WriteFileCommand
|
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
import org.enso.languageserver.util.file.PathUtils
|
import org.enso.languageserver.util.file.PathUtils
|
||||||
@ -48,7 +50,7 @@ class WriteBinaryFileHandler(
|
|||||||
fileManager ! FileManagerProtocol.WriteBinaryFile(path, contents)
|
fileManager ! FileManagerProtocol.WriteBinaryFile(path, contents)
|
||||||
val cancellable = context.system.scheduler
|
val cancellable = context.system.scheduler
|
||||||
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
||||||
context.become(responseStage(msg.requestId(), cancellable))
|
context.become(responseStage(msg.messageId(), cancellable))
|
||||||
}
|
}
|
||||||
|
|
||||||
private def responseStage(
|
private def responseStage(
|
||||||
|
@ -4,7 +4,7 @@ import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
|||||||
import org.enso.jsonrpc.Errors.ServiceError
|
import org.enso.jsonrpc.Errors.ServiceError
|
||||||
import org.enso.jsonrpc._
|
import org.enso.jsonrpc._
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.text.TextApi._
|
import org.enso.languageserver.text.TextApi._
|
||||||
import org.enso.languageserver.text.TextProtocol
|
import org.enso.languageserver.text.TextProtocol
|
||||||
import org.enso.languageserver.text.TextProtocol.{ApplyEdit => _, _}
|
import org.enso.languageserver.text.TextProtocol.{ApplyEdit => _, _}
|
||||||
@ -22,7 +22,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class ApplyEditHandler(
|
class ApplyEditHandler(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -92,7 +92,7 @@ object ApplyEditHandler {
|
|||||||
def props(
|
def props(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
requestTimeout: FiniteDuration,
|
requestTimeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new ApplyEditHandler(bufferRegistry, requestTimeout, rpcSession))
|
Props(new ApplyEditHandler(bufferRegistry, requestTimeout, rpcSession))
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
|||||||
import org.enso.jsonrpc.Errors.ServiceError
|
import org.enso.jsonrpc.Errors.ServiceError
|
||||||
import org.enso.jsonrpc._
|
import org.enso.jsonrpc._
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.text.TextApi.{CloseFile, FileNotOpenedError}
|
import org.enso.languageserver.text.TextApi.{CloseFile, FileNotOpenedError}
|
||||||
import org.enso.languageserver.text.TextProtocol
|
import org.enso.languageserver.text.TextProtocol
|
||||||
import org.enso.languageserver.text.TextProtocol.{FileClosed, FileNotOpened}
|
import org.enso.languageserver.text.TextProtocol.{FileClosed, FileNotOpened}
|
||||||
@ -22,7 +22,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class CloseFileHandler(
|
class CloseFileHandler(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -74,7 +74,7 @@ object CloseFileHandler {
|
|||||||
def props(
|
def props(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
requestTimeout: FiniteDuration,
|
requestTimeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new CloseFileHandler(bufferRegistry, requestTimeout, rpcSession))
|
Props(new CloseFileHandler(bufferRegistry, requestTimeout, rpcSession))
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import org.enso.jsonrpc.Errors.ServiceError
|
|||||||
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult}
|
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult}
|
||||||
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.text.TextApi.OpenFile
|
import org.enso.languageserver.text.TextApi.OpenFile
|
||||||
import org.enso.languageserver.text.TextProtocol
|
import org.enso.languageserver.text.TextProtocol
|
||||||
import org.enso.languageserver.text.TextProtocol.{
|
import org.enso.languageserver.text.TextProtocol.{
|
||||||
@ -26,7 +26,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class OpenFileHandler(
|
class OpenFileHandler(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -86,7 +86,7 @@ object OpenFileHandler {
|
|||||||
def props(
|
def props(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
requestTimeout: FiniteDuration,
|
requestTimeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new OpenFileHandler(bufferRegistry, requestTimeout, rpcSession))
|
Props(new OpenFileHandler(bufferRegistry, requestTimeout, rpcSession))
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import org.enso.jsonrpc.Errors.ServiceError
|
|||||||
import org.enso.jsonrpc._
|
import org.enso.jsonrpc._
|
||||||
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
||||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.text.TextApi.{
|
import org.enso.languageserver.text.TextApi.{
|
||||||
FileNotOpenedError,
|
FileNotOpenedError,
|
||||||
InvalidVersionError,
|
InvalidVersionError,
|
||||||
@ -28,7 +28,7 @@ import scala.concurrent.duration.FiniteDuration
|
|||||||
class SaveFileHandler(
|
class SaveFileHandler(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
timeout: FiniteDuration,
|
timeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
) extends Actor
|
) extends Actor
|
||||||
with ActorLogging
|
with ActorLogging
|
||||||
with UnhandledLogging {
|
with UnhandledLogging {
|
||||||
@ -105,7 +105,7 @@ object SaveFileHandler {
|
|||||||
def props(
|
def props(
|
||||||
bufferRegistry: ActorRef,
|
bufferRegistry: ActorRef,
|
||||||
requestTimeout: FiniteDuration,
|
requestTimeout: FiniteDuration,
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Props =
|
): Props =
|
||||||
Props(new SaveFileHandler(bufferRegistry, requestTimeout, rpcSession))
|
Props(new SaveFileHandler(bufferRegistry, requestTimeout, rpcSession))
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
|||||||
VisualisationUpdate
|
VisualisationUpdate
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.runtime.ExecutionApi.ContextId
|
import org.enso.languageserver.runtime.ExecutionApi.ContextId
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.session.SessionRouter.DeliverToDataController
|
import org.enso.languageserver.session.SessionRouter.DeliverToBinaryController
|
||||||
import org.enso.languageserver.util.UnhandledLogging
|
import org.enso.languageserver.util.UnhandledLogging
|
||||||
import org.enso.polyglot.runtime.Runtime.Api
|
import org.enso.polyglot.runtime.Runtime.Api
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ import org.enso.polyglot.runtime.Runtime.Api
|
|||||||
*/
|
*/
|
||||||
final class ContextEventsListener(
|
final class ContextEventsListener(
|
||||||
config: Config,
|
config: Config,
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
contextId: ContextId,
|
contextId: ContextId,
|
||||||
sessionRouter: ActorRef
|
sessionRouter: ActorRef
|
||||||
) extends Actor
|
) extends Actor
|
||||||
@ -49,7 +49,7 @@ final class ContextEventsListener(
|
|||||||
),
|
),
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
sessionRouter ! DeliverToDataController(rpcSession.clientId, payload)
|
sessionRouter ! DeliverToBinaryController(rpcSession.clientId, payload)
|
||||||
|
|
||||||
case Api.ExpressionValuesComputed(`contextId`, apiUpdates) =>
|
case Api.ExpressionValuesComputed(`contextId`, apiUpdates) =>
|
||||||
val updates = apiUpdates.flatMap { update =>
|
val updates = apiUpdates.flatMap { update =>
|
||||||
@ -121,7 +121,7 @@ object ContextEventsListener {
|
|||||||
*/
|
*/
|
||||||
def props(
|
def props(
|
||||||
config: Config,
|
config: Config,
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
contextId: ContextId,
|
contextId: ContextId,
|
||||||
sessionRouter: ActorRef
|
sessionRouter: ActorRef
|
||||||
): Props =
|
): Props =
|
||||||
|
@ -5,7 +5,7 @@ import java.util.UUID
|
|||||||
import org.enso.languageserver.data.ClientId
|
import org.enso.languageserver.data.ClientId
|
||||||
import org.enso.languageserver.filemanager.FileSystemFailure
|
import org.enso.languageserver.filemanager.FileSystemFailure
|
||||||
import org.enso.languageserver.runtime.ExecutionApi.ContextId
|
import org.enso.languageserver.runtime.ExecutionApi.ContextId
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
|
|
||||||
object ContextRegistryProtocol {
|
object ContextRegistryProtocol {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ object ContextRegistryProtocol {
|
|||||||
*
|
*
|
||||||
* @param rpcSession reference to the client
|
* @param rpcSession reference to the client
|
||||||
*/
|
*/
|
||||||
case class CreateContextRequest(rpcSession: RpcSession)
|
case class CreateContextRequest(rpcSession: JsonSession)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A response about creation of a new execution context.
|
* A response about creation of a new execution context.
|
||||||
@ -33,7 +33,10 @@ object ContextRegistryProtocol {
|
|||||||
*
|
*
|
||||||
* @param rpcSession reference to the client
|
* @param rpcSession reference to the client
|
||||||
*/
|
*/
|
||||||
case class DestroyContextRequest(rpcSession: RpcSession, contextId: ContextId)
|
case class DestroyContextRequest(
|
||||||
|
rpcSession: JsonSession,
|
||||||
|
contextId: ContextId
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A response about deletion of an execution context.
|
* A response about deletion of an execution context.
|
||||||
@ -51,7 +54,7 @@ object ContextRegistryProtocol {
|
|||||||
* @param stackItem an object representing an item on the stack
|
* @param stackItem an object representing an item on the stack
|
||||||
*/
|
*/
|
||||||
case class PushContextRequest(
|
case class PushContextRequest(
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
contextId: ContextId,
|
contextId: ContextId,
|
||||||
stackItem: StackItem
|
stackItem: StackItem
|
||||||
)
|
)
|
||||||
@ -70,7 +73,7 @@ object ContextRegistryProtocol {
|
|||||||
* @param rpcSession reference to the client
|
* @param rpcSession reference to the client
|
||||||
* @param contextId execution context identifier
|
* @param contextId execution context identifier
|
||||||
*/
|
*/
|
||||||
case class PopContextRequest(rpcSession: RpcSession, contextId: ContextId)
|
case class PopContextRequest(rpcSession: JsonSession, contextId: ContextId)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A response about popping the stack.
|
* A response about popping the stack.
|
||||||
@ -87,7 +90,7 @@ object ContextRegistryProtocol {
|
|||||||
* @param invalidatedExpressions the expressions that should be invalidated
|
* @param invalidatedExpressions the expressions that should be invalidated
|
||||||
*/
|
*/
|
||||||
case class RecomputeContextRequest(
|
case class RecomputeContextRequest(
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
contextId: ContextId,
|
contextId: ContextId,
|
||||||
invalidatedExpressions: Option[InvalidatedExpressions]
|
invalidatedExpressions: Option[InvalidatedExpressions]
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package org.enso.languageserver.runtime
|
package org.enso.languageserver.runtime
|
||||||
|
|
||||||
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
||||||
import org.enso.languageserver.protocol.rpc.ErrorApi._
|
import org.enso.languageserver.protocol.json.ErrorApi._
|
||||||
import org.enso.languageserver.runtime.ExecutionApi._
|
import org.enso.languageserver.runtime.ExecutionApi._
|
||||||
import org.enso.polyglot.runtime.Runtime.Api
|
import org.enso.polyglot.runtime.Runtime.Api
|
||||||
import org.enso.jsonrpc.Error
|
import org.enso.jsonrpc.Error
|
||||||
|
@ -11,4 +11,4 @@ import org.enso.languageserver.data.ClientId
|
|||||||
* @param dataController the actor handling remote client communications, used
|
* @param dataController the actor handling remote client communications, used
|
||||||
* to push requests and notifications.
|
* to push requests and notifications.
|
||||||
*/
|
*/
|
||||||
case class DataSession(clientId: ClientId, dataController: ActorRef)
|
case class BinarySession(clientId: ClientId, dataController: ActorRef)
|
@ -11,7 +11,7 @@ import org.enso.languageserver.data.ClientId
|
|||||||
* @param rpcController the actor handling remote client communications, used
|
* @param rpcController the actor handling remote client communications, used
|
||||||
* to push requests and notifications.
|
* to push requests and notifications.
|
||||||
*/
|
*/
|
||||||
case class RpcSession(
|
case class JsonSession(
|
||||||
clientId: ClientId,
|
clientId: ClientId,
|
||||||
rpcController: ActorRef
|
rpcController: ActorRef
|
||||||
)
|
)
|
@ -7,26 +7,26 @@ import org.enso.languageserver.data.ClientId
|
|||||||
* rpc and data protocol.
|
* rpc and data protocol.
|
||||||
*
|
*
|
||||||
* @param clientId the internal id of this client
|
* @param clientId the internal id of this client
|
||||||
* @param maybeRpcSession a session for rpc protocol
|
* @param maybeJsonSession a session for rpc protocol
|
||||||
* @param maybeDataSession a session for data protocol
|
* @param maybeBinarySession a session for data protocol
|
||||||
*/
|
*/
|
||||||
case class Session(
|
case class Session(
|
||||||
clientId: ClientId,
|
clientId: ClientId,
|
||||||
maybeRpcSession: Option[RpcSession],
|
maybeJsonSession: Option[JsonSession],
|
||||||
maybeDataSession: Option[DataSession]
|
maybeBinarySession: Option[BinarySession]
|
||||||
) {
|
) {
|
||||||
|
|
||||||
def attachRpcSession(rpcSession: RpcSession): Session =
|
def attachJsonSession(rpcSession: JsonSession): Session =
|
||||||
this.copy(maybeRpcSession = Some(rpcSession))
|
this.copy(maybeJsonSession = Some(rpcSession))
|
||||||
|
|
||||||
def attachDataSession(dataSession: DataSession): Session =
|
def attachBinarySession(dataSession: BinarySession): Session =
|
||||||
this.copy(maybeDataSession = Some(dataSession))
|
this.copy(maybeBinarySession = Some(dataSession))
|
||||||
|
|
||||||
def detachRpcSession(): Session = this.copy(maybeRpcSession = None)
|
def detachJsonSession(): Session = this.copy(maybeJsonSession = None)
|
||||||
|
|
||||||
def detachDataSession(): Session = this.copy(maybeDataSession = None)
|
def detachBinarySession(): Session = this.copy(maybeBinarySession = None)
|
||||||
|
|
||||||
def isSessionTerminated: Boolean =
|
def isSessionTerminated: Boolean =
|
||||||
maybeRpcSession.isEmpty && maybeDataSession.isEmpty
|
maybeJsonSession.isEmpty && maybeBinarySession.isEmpty
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ import org.enso.languageserver.event.{
|
|||||||
SessionEvent
|
SessionEvent
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.SessionRouter.{
|
import org.enso.languageserver.session.SessionRouter.{
|
||||||
DeliverToDataController,
|
DeliverToBinaryController,
|
||||||
DeliverToRpcController
|
DeliverToJsonController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,43 +28,43 @@ class SessionRouter extends Actor {
|
|||||||
running(Map.empty.withDefault(clientId => Session(clientId, None, None)))
|
running(Map.empty.withDefault(clientId => Session(clientId, None, None)))
|
||||||
|
|
||||||
private def running(sessions: Map[ClientId, Session]): Receive = {
|
private def running(sessions: Map[ClientId, Session]): Receive = {
|
||||||
case RpcSessionInitialized(s @ RpcSession(clientId, _)) =>
|
case RpcSessionInitialized(s @ JsonSession(clientId, _)) =>
|
||||||
context.become(
|
context.become(
|
||||||
running(
|
running(
|
||||||
sessions + (clientId -> sessions(clientId).attachRpcSession(s))
|
sessions + (clientId -> sessions(clientId).attachJsonSession(s))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
case RpcSessionTerminated(RpcSession(clientId, _)) =>
|
case RpcSessionTerminated(JsonSession(clientId, _)) =>
|
||||||
val updatedSessions =
|
val updatedSessions =
|
||||||
(sessions + (clientId -> sessions(clientId).detachRpcSession()))
|
(sessions + (clientId -> sessions(clientId).detachJsonSession()))
|
||||||
.filterNot(_._2.isSessionTerminated)
|
.filterNot(_._2.isSessionTerminated)
|
||||||
|
|
||||||
context.become(running(updatedSessions))
|
context.become(running(updatedSessions))
|
||||||
|
|
||||||
case DataSessionInitialized(s @ DataSession(clientId, _)) =>
|
case DataSessionInitialized(s @ BinarySession(clientId, _)) =>
|
||||||
context.become(
|
context.become(
|
||||||
running(
|
running(
|
||||||
sessions + (clientId -> sessions(clientId).attachDataSession(s))
|
sessions + (clientId -> sessions(clientId).attachBinarySession(s))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
case DataSessionTerminated(DataSession(clientId, _)) =>
|
case DataSessionTerminated(BinarySession(clientId, _)) =>
|
||||||
val updatedSessions =
|
val updatedSessions =
|
||||||
(sessions + (clientId -> sessions(clientId).detachDataSession()))
|
(sessions + (clientId -> sessions(clientId).detachBinarySession()))
|
||||||
.filterNot(_._2.isSessionTerminated)
|
.filterNot(_._2.isSessionTerminated)
|
||||||
|
|
||||||
context.become(running(updatedSessions))
|
context.become(running(updatedSessions))
|
||||||
|
|
||||||
case DeliverToRpcController(clientId, payload) =>
|
case DeliverToJsonController(clientId, payload) =>
|
||||||
sessions
|
sessions
|
||||||
.get(clientId)
|
.get(clientId)
|
||||||
.foreach(_.maybeRpcSession.foreach(_.rpcController ! payload))
|
.foreach(_.maybeJsonSession.foreach(_.rpcController ! payload))
|
||||||
|
|
||||||
case DeliverToDataController(clientId, payload) =>
|
case DeliverToBinaryController(clientId, payload) =>
|
||||||
sessions
|
sessions
|
||||||
.get(clientId)
|
.get(clientId)
|
||||||
.foreach(_.maybeDataSession.foreach(_.dataController ! payload))
|
.foreach(_.maybeBinarySession.foreach(_.dataController ! payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ object SessionRouter {
|
|||||||
* @param payload a payload that is delivered to the controller
|
* @param payload a payload that is delivered to the controller
|
||||||
* @tparam A a type of payload
|
* @tparam A a type of payload
|
||||||
*/
|
*/
|
||||||
case class DeliverToRpcController[A](clientId: ClientId, payload: A)
|
case class DeliverToJsonController[A](clientId: ClientId, payload: A)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A command used to deliver an arbitrary `payload` to a data controller
|
* A command used to deliver an arbitrary `payload` to a data controller
|
||||||
@ -89,7 +89,7 @@ object SessionRouter {
|
|||||||
* @param payload a payload that is delivered to the controller
|
* @param payload a payload that is delivered to the controller
|
||||||
* @tparam A a type of payload
|
* @tparam A a type of payload
|
||||||
*/
|
*/
|
||||||
case class DeliverToDataController[A](clientId: ClientId, payload: A)
|
case class DeliverToBinaryController[A](clientId: ClientId, payload: A)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates configuration object used to create a [[SessionRouter]].
|
* Creates configuration object used to create a [[SessionRouter]].
|
||||||
|
@ -24,7 +24,7 @@ import org.enso.languageserver.filemanager.{
|
|||||||
OperationTimeout,
|
OperationTimeout,
|
||||||
Path
|
Path
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
import org.enso.languageserver.text.Buffer.Version
|
import org.enso.languageserver.text.Buffer.Version
|
||||||
import org.enso.languageserver.text.CollaborativeBuffer.IOTimeout
|
import org.enso.languageserver.text.CollaborativeBuffer.IOTimeout
|
||||||
import org.enso.languageserver.text.TextProtocol._
|
import org.enso.languageserver.text.TextProtocol._
|
||||||
@ -74,7 +74,7 @@ class CollaborativeBuffer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def waitingForFileContent(
|
private def waitingForFileContent(
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
replyTo: ActorRef,
|
replyTo: ActorRef,
|
||||||
timeoutCancellable: Cancellable
|
timeoutCancellable: Cancellable
|
||||||
): Receive = {
|
): Receive = {
|
||||||
@ -97,8 +97,8 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def collaborativeEditing(
|
private def collaborativeEditing(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession]
|
lockHolder: Option[JsonSession]
|
||||||
): Receive = {
|
): Receive = {
|
||||||
case OpenFile(client, _) =>
|
case OpenFile(client, _) =>
|
||||||
openFile(buffer, clients, lockHolder, client)
|
openFile(buffer, clients, lockHolder, client)
|
||||||
@ -131,8 +131,8 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def saving(
|
private def saving(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
replyTo: ActorRef,
|
replyTo: ActorRef,
|
||||||
timeoutCancellable: Cancellable
|
timeoutCancellable: Cancellable
|
||||||
): Receive = {
|
): Receive = {
|
||||||
@ -158,8 +158,8 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def saveFile(
|
private def saveFile(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: ClientId,
|
clientId: ClientId,
|
||||||
clientVersion: Version
|
clientVersion: Version
|
||||||
): Unit = {
|
): Unit = {
|
||||||
@ -186,8 +186,8 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def edit(
|
private def edit(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: ClientId,
|
clientId: ClientId,
|
||||||
change: FileEdit
|
change: FileEdit
|
||||||
): Unit = {
|
): Unit = {
|
||||||
@ -210,7 +210,7 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def applyEdits(
|
private def applyEdits(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: ClientId,
|
clientId: ClientId,
|
||||||
change: FileEdit
|
change: FileEdit
|
||||||
): Either[ApplyEditFailure, Buffer] =
|
): Either[ApplyEditFailure, Buffer] =
|
||||||
@ -233,7 +233,7 @@ class CollaborativeBuffer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def validateAccess(
|
private def validateAccess(
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: ClientId
|
clientId: ClientId
|
||||||
): Either[ApplyEditFailure, Unit] = {
|
): Either[ApplyEditFailure, Unit] = {
|
||||||
val hasLock = lockHolder.exists(_.clientId == clientId)
|
val hasLock = lockHolder.exists(_.clientId == clientId)
|
||||||
@ -265,7 +265,7 @@ class CollaborativeBuffer(
|
|||||||
TextEditValidationFailed(s"Invalid position: $position")
|
TextEditValidationFailed(s"Invalid position: $position")
|
||||||
}
|
}
|
||||||
|
|
||||||
private def readFile(rpcSession: RpcSession, path: Path): Unit = {
|
private def readFile(rpcSession: JsonSession, path: Path): Unit = {
|
||||||
fileManager ! FileManagerProtocol.ReadFile(path)
|
fileManager ! FileManagerProtocol.ReadFile(path)
|
||||||
val timeoutCancellable = context.system.scheduler
|
val timeoutCancellable = context.system.scheduler
|
||||||
.scheduleOnce(timeout, self, IOTimeout)
|
.scheduleOnce(timeout, self, IOTimeout)
|
||||||
@ -275,7 +275,7 @@ class CollaborativeBuffer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def handleFileContent(
|
private def handleFileContent(
|
||||||
rpcSession: RpcSession,
|
rpcSession: JsonSession,
|
||||||
originalSender: ActorRef,
|
originalSender: ActorRef,
|
||||||
file: TextualFileContent
|
file: TextualFileContent
|
||||||
): Unit = {
|
): Unit = {
|
||||||
@ -298,9 +298,9 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def openFile(
|
private def openFile(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
rpcSession: RpcSession
|
rpcSession: JsonSession
|
||||||
): Unit = {
|
): Unit = {
|
||||||
val writeCapability =
|
val writeCapability =
|
||||||
if (lockHolder.isEmpty)
|
if (lockHolder.isEmpty)
|
||||||
@ -319,8 +319,8 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def removeClient(
|
private def removeClient(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: ClientId
|
clientId: ClientId
|
||||||
): Unit = {
|
): Unit = {
|
||||||
val newLock =
|
val newLock =
|
||||||
@ -339,8 +339,8 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def releaseWriteLock(
|
private def releaseWriteLock(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: ClientId
|
clientId: ClientId
|
||||||
): Unit = {
|
): Unit = {
|
||||||
lockHolder match {
|
lockHolder match {
|
||||||
@ -360,9 +360,9 @@ class CollaborativeBuffer(
|
|||||||
|
|
||||||
private def acquireWriteLock(
|
private def acquireWriteLock(
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
clients: Map[ClientId, RpcSession],
|
clients: Map[ClientId, JsonSession],
|
||||||
lockHolder: Option[RpcSession],
|
lockHolder: Option[JsonSession],
|
||||||
clientId: RpcSession,
|
clientId: JsonSession,
|
||||||
path: Path
|
path: Path
|
||||||
): Unit = {
|
): Unit = {
|
||||||
lockHolder match {
|
lockHolder match {
|
||||||
|
@ -2,7 +2,7 @@ package org.enso.languageserver.text
|
|||||||
|
|
||||||
import org.enso.languageserver.data.{CapabilityRegistration, ClientId}
|
import org.enso.languageserver.data.{CapabilityRegistration, ClientId}
|
||||||
import org.enso.languageserver.filemanager.{FileSystemFailure, Path}
|
import org.enso.languageserver.filemanager.{FileSystemFailure, Path}
|
||||||
import org.enso.languageserver.session.RpcSession
|
import org.enso.languageserver.session.JsonSession
|
||||||
|
|
||||||
object TextProtocol {
|
object TextProtocol {
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ object TextProtocol {
|
|||||||
* @param rpcSession the client opening the file.
|
* @param rpcSession the client opening the file.
|
||||||
* @param path the file path.
|
* @param path the file path.
|
||||||
*/
|
*/
|
||||||
case class OpenFile(rpcSession: RpcSession, path: Path)
|
case class OpenFile(rpcSession: JsonSession, path: Path)
|
||||||
|
|
||||||
/** Sent by the server in response to [[OpenFile]]
|
/** Sent by the server in response to [[OpenFile]]
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package org.enso.languageserver.util.file
|
package org.enso.languageserver.util.file
|
||||||
|
|
||||||
import org.enso.languageserver.filemanager.Path
|
import org.enso.languageserver.filemanager.Path
|
||||||
import org.enso.languageserver.protocol.data.filemanager.{Path => BinaryPath}
|
import org.enso.languageserver.protocol.binary.{Path => BinaryPath}
|
||||||
|
|
||||||
object PathUtils {
|
object PathUtils {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package org.enso.languageserver.util.file
|
|||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||||
|
|
||||||
object UuidUtils {
|
object UuidUtils {
|
||||||
|
|
||||||
|
144
engine/language-server/src/main/schema/binary_protocol.fbs
Normal file
144
engine/language-server/src/main/schema/binary_protocol.fbs
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
namespace org.enso.languageserver.protocol.binary;
|
||||||
|
|
||||||
|
//A mapping between payload enum and inbound payload types.
|
||||||
|
union InboundPayload {
|
||||||
|
INIT_SESSION_CMD: InitSessionCommand,
|
||||||
|
WRITE_FILE_CMD: WriteFileCommand,
|
||||||
|
READ_FILE_CMD: ReadFileCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
//An envelope for inbound requests and commands.
|
||||||
|
table InboundMessage {
|
||||||
|
|
||||||
|
//A unique id of the message sent to the server.
|
||||||
|
messageId: EnsoUUID (required);
|
||||||
|
|
||||||
|
//An optional correlation id used to correlate a response with a request.
|
||||||
|
correlationId: EnsoUUID;
|
||||||
|
|
||||||
|
//A message payload that carries requests sent by a client.
|
||||||
|
payload: InboundPayload (required);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//A mapping between payload enum and outbound payload types.
|
||||||
|
union OutboundPayload {
|
||||||
|
ERROR: Error,
|
||||||
|
SUCCESS: Success,
|
||||||
|
VISUALISATION_UPDATE: VisualisationUpdate,
|
||||||
|
FILE_CONTENTS_REPLY: FileContentsReply
|
||||||
|
}
|
||||||
|
|
||||||
|
//An envelope for outbound responses.
|
||||||
|
table OutboundMessage {
|
||||||
|
|
||||||
|
//A unique id of the message sent from the server.
|
||||||
|
messageId: EnsoUUID (required);
|
||||||
|
|
||||||
|
//An optional correlation id used to correlate a response with a request.
|
||||||
|
correlationId: EnsoUUID;
|
||||||
|
|
||||||
|
//A message payload that carries responses and notifications sent by a server
|
||||||
|
payload: OutboundPayload (required);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//A binary representation of universally unique identifiers.
|
||||||
|
struct EnsoUUID {
|
||||||
|
|
||||||
|
//The most significant bits of the UUID.
|
||||||
|
leastSigBits:uint64;
|
||||||
|
|
||||||
|
//The most significant bits of the UUID.
|
||||||
|
mostSigBits:uint64;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//This message type is used to indicate failure of some operation performed.
|
||||||
|
table Error {
|
||||||
|
|
||||||
|
//A unique error code identifying error type.
|
||||||
|
code: int;
|
||||||
|
|
||||||
|
//An error message.
|
||||||
|
message: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Indicates an operation has succeeded.
|
||||||
|
table Success {}
|
||||||
|
|
||||||
|
//A command initializing a data session.
|
||||||
|
table InitSessionCommand {
|
||||||
|
|
||||||
|
//A unique identifier of a client initializing the session.
|
||||||
|
identifier: EnsoUUID (required);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
root_type InitSessionCommand;
|
||||||
|
|
||||||
|
//A visualisation context identifying a concrete visualisation.
|
||||||
|
table VisualisationContext {
|
||||||
|
|
||||||
|
//A visualisation identifier.
|
||||||
|
visualisationId: EnsoUUID (required);
|
||||||
|
|
||||||
|
//A context identifier.
|
||||||
|
contextId: EnsoUUID (required);
|
||||||
|
|
||||||
|
//An expression identifier.
|
||||||
|
expressionId: EnsoUUID (required);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//An event signaling visualisation update.
|
||||||
|
table VisualisationUpdate {
|
||||||
|
|
||||||
|
//A visualisation context identifying a concrete visualisation.
|
||||||
|
visualisationContext: VisualisationContext (required);
|
||||||
|
|
||||||
|
//A visualisation data.
|
||||||
|
data: [ubyte] (required);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//A representation of a path relative to a specified content root.
|
||||||
|
table Path {
|
||||||
|
|
||||||
|
//a content root id that the path is relative to
|
||||||
|
rootId: EnsoUUID;
|
||||||
|
|
||||||
|
//path segments
|
||||||
|
segments: [string];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//A command writing binary contents to a file.
|
||||||
|
table WriteFileCommand {
|
||||||
|
|
||||||
|
//A path to a file.
|
||||||
|
path: Path;
|
||||||
|
|
||||||
|
//Binary contents.
|
||||||
|
contents: [ubyte];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//A command reading binary contents from a file.
|
||||||
|
table ReadFileCommand {
|
||||||
|
|
||||||
|
//A path to a file.
|
||||||
|
path: Path;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//A reply for a ReadFileCommand.
|
||||||
|
table FileContentsReply {
|
||||||
|
|
||||||
|
//Binary contents.
|
||||||
|
contents: [ubyte];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//todo Split up the schema once Rust bugs will be resolved.
|
@ -1,49 +0,0 @@
|
|||||||
include "util.fbs";
|
|
||||||
include "session.fbs";
|
|
||||||
include "execution_context.fbs";
|
|
||||||
include "file_manager.fbs";
|
|
||||||
|
|
||||||
namespace org.enso.languageserver.protocol.data.envelope;
|
|
||||||
|
|
||||||
//A mapping between payload enum and inbound payload types.
|
|
||||||
union InboundPayload {
|
|
||||||
INIT_SESSION_CMD: org.enso.languageserver.protocol.data.session.InitSessionCommand,
|
|
||||||
WRITE_FILE_CMD: org.enso.languageserver.protocol.data.filemanager.WriteFileCommand,
|
|
||||||
READ_FILE_CMD: org.enso.languageserver.protocol.data.filemanager.ReadFileCommand
|
|
||||||
}
|
|
||||||
|
|
||||||
//An envelope for inbound requests and commands.
|
|
||||||
table InboundMessage {
|
|
||||||
|
|
||||||
//A unique id of the request sent to the server.
|
|
||||||
requestId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
|
||||||
|
|
||||||
//An optional correlation id used to correlate a response with a request.
|
|
||||||
correlationId: org.enso.languageserver.protocol.data.util.EnsoUUID;
|
|
||||||
|
|
||||||
//A message payload that carries requests sent by a client.
|
|
||||||
payload: InboundPayload (required);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//A mapping between payload enum and outbound payload types.
|
|
||||||
union OutboundPayload {
|
|
||||||
ERROR: org.enso.languageserver.protocol.data.util.Error,
|
|
||||||
SUCCESS: org.enso.languageserver.protocol.data.util.Success,
|
|
||||||
VISUALISATION_UPDATE: org.enso.languageserver.protocol.data.executioncontext.VisualisationUpdate,
|
|
||||||
FILE_CONTENTS_REPLY: org.enso.languageserver.protocol.data.filemanager.FileContentsReply
|
|
||||||
}
|
|
||||||
|
|
||||||
//An envelope for outbound responses.
|
|
||||||
table OutboundMessage {
|
|
||||||
|
|
||||||
//A unique id of the request sent to the server.
|
|
||||||
requestId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
|
||||||
|
|
||||||
//An optional correlation id used to correlate a response with a request.
|
|
||||||
correlationId: org.enso.languageserver.protocol.data.util.EnsoUUID;
|
|
||||||
|
|
||||||
//A message payload that carries responses and notifications sent by a server
|
|
||||||
payload: OutboundPayload (required);
|
|
||||||
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
include "util.fbs";
|
|
||||||
|
|
||||||
namespace org.enso.languageserver.protocol.data.executioncontext;
|
|
||||||
|
|
||||||
//A visualisation context identifying a concrete visualisation.
|
|
||||||
table VisualisationContext {
|
|
||||||
|
|
||||||
//A visualisation identifier.
|
|
||||||
visualisationId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
|
||||||
|
|
||||||
//A context identifier.
|
|
||||||
contextId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
|
||||||
|
|
||||||
//An expression identifier.
|
|
||||||
expressionId: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//An event signaling visualisation update.
|
|
||||||
table VisualisationUpdate {
|
|
||||||
|
|
||||||
//A visualisation context identifying a concrete visualisation.
|
|
||||||
visualisationContext: VisualisationContext (required);
|
|
||||||
|
|
||||||
//A visualisation data.
|
|
||||||
data: [ubyte] (required);
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
include "util.fbs";
|
|
||||||
|
|
||||||
namespace org.enso.languageserver.protocol.data.filemanager;
|
|
||||||
|
|
||||||
//A representation of a path relative to a specified content root.
|
|
||||||
table Path {
|
|
||||||
|
|
||||||
//a content root id that the path is relative to
|
|
||||||
rootId: org.enso.languageserver.protocol.data.util.EnsoUUID;
|
|
||||||
|
|
||||||
//path segments
|
|
||||||
segments: [string];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//A command writing binary contents to a file.
|
|
||||||
table WriteFileCommand {
|
|
||||||
|
|
||||||
//A path to a file.
|
|
||||||
path: org.enso.languageserver.protocol.data.filemanager.Path;
|
|
||||||
|
|
||||||
//Binary contents.
|
|
||||||
contents: [ubyte];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//A command reading binary contents from a file.
|
|
||||||
table ReadFileCommand {
|
|
||||||
|
|
||||||
//A path to a file.
|
|
||||||
path: org.enso.languageserver.protocol.data.filemanager.Path;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//A reply for a ReadFileCommand.
|
|
||||||
table FileContentsReply {
|
|
||||||
|
|
||||||
//Binary contents.
|
|
||||||
contents: [ubyte];
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
include "util.fbs";
|
|
||||||
|
|
||||||
namespace org.enso.languageserver.protocol.data.session;
|
|
||||||
|
|
||||||
//A command initializing a data session.
|
|
||||||
table InitSessionCommand {
|
|
||||||
|
|
||||||
//A unique identifier of a client initializing the session.
|
|
||||||
identifier: org.enso.languageserver.protocol.data.util.EnsoUUID (required);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
root_type InitSessionCommand;
|
|
@ -1,26 +0,0 @@
|
|||||||
namespace org.enso.languageserver.protocol.data.util;
|
|
||||||
|
|
||||||
//A binary representation of universally unique identifiers.
|
|
||||||
struct EnsoUUID {
|
|
||||||
|
|
||||||
//The most significant bits of the UUID.
|
|
||||||
leastSigBits:uint64;
|
|
||||||
|
|
||||||
//The most significant bits of the UUID.
|
|
||||||
mostSigBits:uint64;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//This message type is used to indicate failure of some operation performed.
|
|
||||||
table Error {
|
|
||||||
|
|
||||||
//A unique error code identifying error type.
|
|
||||||
code: int;
|
|
||||||
|
|
||||||
//An error message.
|
|
||||||
message: string;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Indicates an operation has succeeded.
|
|
||||||
table Success {}
|
|
@ -4,7 +4,7 @@
|
|||||||
<!-- encoders are assigned the type
|
<!-- encoders are assigned the type
|
||||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{HH:mm:ss.SSS} [%-15thread] %-5level %msg%n</pattern>
|
<pattern>%d{HH:mm:ss.SSS} [%-15thread] %-5level %logger{36} %msg%n</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.data
|
package org.enso.languageserver.websocket.binary
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
@ -15,9 +15,9 @@ import org.enso.languageserver.data.{
|
|||||||
import org.enso.languageserver.effect.ZioExec
|
import org.enso.languageserver.effect.ZioExec
|
||||||
import org.enso.languageserver.filemanager.{FileManager, FileSystem}
|
import org.enso.languageserver.filemanager.{FileManager, FileSystem}
|
||||||
import org.enso.languageserver.http.server.ConnectionControllerFactory
|
import org.enso.languageserver.http.server.ConnectionControllerFactory
|
||||||
import org.enso.languageserver.protocol.data.BinaryConnectionController
|
import org.enso.languageserver.protocol.binary.BinaryConnectionController
|
||||||
import org.enso.languageserver.protocol.data.envelope.InboundPayload
|
import org.enso.languageserver.protocol.binary.InboundPayload
|
||||||
import org.enso.languageserver.websocket.data.factory.{
|
import org.enso.languageserver.websocket.binary.factory.{
|
||||||
InboundMessageFactory,
|
InboundMessageFactory,
|
||||||
SessionInitFactory
|
SessionInitFactory
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.data
|
package org.enso.languageserver.websocket.binary
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
@ -6,13 +6,13 @@ import java.util.UUID
|
|||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import org.enso.languageserver.protocol.data.envelope.{
|
import org.enso.languageserver.protocol.binary.{
|
||||||
InboundPayload,
|
InboundPayload,
|
||||||
OutboundMessage,
|
OutboundMessage,
|
||||||
OutboundPayload
|
OutboundPayload
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.filemanager.FileContentsReply
|
import org.enso.languageserver.protocol.binary.FileContentsReply
|
||||||
import org.enso.languageserver.websocket.data.factory.{
|
import org.enso.languageserver.websocket.binary.factory.{
|
||||||
InboundMessageFactory,
|
InboundMessageFactory,
|
||||||
PathFactory,
|
PathFactory,
|
||||||
ReadFileCommandFactory,
|
ReadFileCommandFactory,
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.data
|
package org.enso.languageserver.websocket.binary
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import org.enso.languageserver.http.server.{
|
|||||||
BinaryWebSocketServer,
|
BinaryWebSocketServer,
|
||||||
ConnectionControllerFactory
|
ConnectionControllerFactory
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.InboundMessageDecoder
|
import org.enso.languageserver.protocol.binary.InboundMessageDecoder
|
||||||
import org.enso.languageserver.util.binary.{
|
import org.enso.languageserver.util.binary.{
|
||||||
BinaryDecoder,
|
BinaryDecoder,
|
||||||
BinaryEncoder,
|
BinaryEncoder,
|
@ -1,14 +1,14 @@
|
|||||||
package org.enso.languageserver.websocket.data
|
package org.enso.languageserver.websocket.binary
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.envelope.{
|
import org.enso.languageserver.protocol.binary.{
|
||||||
InboundPayload,
|
InboundPayload,
|
||||||
OutboundMessage,
|
OutboundMessage,
|
||||||
OutboundPayload
|
OutboundPayload
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.websocket.data.factory.{
|
import org.enso.languageserver.websocket.binary.factory.{
|
||||||
InboundMessageFactory,
|
InboundMessageFactory,
|
||||||
SessionInitFactory
|
SessionInitFactory
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package org.enso.languageserver.websocket.data
|
package org.enso.languageserver.websocket.binary
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
import org.enso.languageserver.protocol.data.envelope.OutboundMessage
|
import org.enso.languageserver.protocol.binary.OutboundMessage
|
||||||
import org.enso.languageserver.util.binary.{BinaryDecoder, DecodingFailure}
|
import org.enso.languageserver.util.binary.{BinaryDecoder, DecodingFailure}
|
||||||
|
|
||||||
object OutboundMessageDecoder extends BinaryDecoder[OutboundMessage] {
|
object OutboundMessageDecoder extends BinaryDecoder[OutboundMessage] {
|
@ -1,13 +1,13 @@
|
|||||||
package org.enso.languageserver.websocket.data
|
package org.enso.languageserver.websocket.binary
|
||||||
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import org.enso.languageserver.protocol.data.envelope.{
|
import org.enso.languageserver.protocol.binary.{
|
||||||
OutboundMessage,
|
OutboundMessage,
|
||||||
OutboundPayload
|
OutboundPayload,
|
||||||
|
VisualisationUpdate => BinaryVisualisationUpdate
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.data.executioncontext
|
|
||||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
||||||
VisualisationContext,
|
VisualisationContext,
|
||||||
VisualisationUpdate
|
VisualisationUpdate
|
||||||
@ -37,8 +37,8 @@ class VisualisationProtocolTest extends BaseBinaryServerTest with Eventually {
|
|||||||
//then
|
//then
|
||||||
msg.payloadType() shouldBe OutboundPayload.VISUALISATION_UPDATE
|
msg.payloadType() shouldBe OutboundPayload.VISUALISATION_UPDATE
|
||||||
val payload = msg
|
val payload = msg
|
||||||
.payload(new executioncontext.VisualisationUpdate)
|
.payload(new BinaryVisualisationUpdate)
|
||||||
.asInstanceOf[executioncontext.VisualisationUpdate]
|
.asInstanceOf[BinaryVisualisationUpdate]
|
||||||
payload.dataAsByteBuffer().compareTo(ByteBuffer.wrap(data)) shouldBe 0
|
payload.dataAsByteBuffer().compareTo(ByteBuffer.wrap(data)) shouldBe 0
|
||||||
payload
|
payload
|
||||||
.visualisationContext()
|
.visualisationContext()
|
@ -1,11 +1,10 @@
|
|||||||
package org.enso.languageserver.websocket.data.factory
|
package org.enso.languageserver.websocket.binary.factory
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.envelope.InboundMessage
|
import org.enso.languageserver.protocol.binary.{EnsoUUID, InboundMessage}
|
||||||
import org.enso.languageserver.protocol.data.factory.EnsoUuidFactory
|
import org.enso.languageserver.protocol.binary.factory.EnsoUuidFactory
|
||||||
import org.enso.languageserver.protocol.data.util.EnsoUUID
|
|
||||||
|
|
||||||
object InboundMessageFactory {
|
object InboundMessageFactory {
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ object InboundMessageFactory {
|
|||||||
)(implicit builder: FlatBufferBuilder): Int = {
|
)(implicit builder: FlatBufferBuilder): Int = {
|
||||||
InboundMessage.startInboundMessage(builder)
|
InboundMessage.startInboundMessage(builder)
|
||||||
val reqId = EnsoUuidFactory.create(requestId)
|
val reqId = EnsoUuidFactory.create(requestId)
|
||||||
InboundMessage.addRequestId(builder, reqId)
|
InboundMessage.addMessageId(builder, reqId)
|
||||||
maybeCorrelationId.foreach { uuid =>
|
maybeCorrelationId.foreach { uuid =>
|
||||||
val corId = EnsoUuidFactory.create(uuid)
|
val corId = EnsoUuidFactory.create(uuid)
|
||||||
InboundMessage.addCorrelationId(builder, corId)
|
InboundMessage.addCorrelationId(builder, corId)
|
@ -1,10 +1,10 @@
|
|||||||
package org.enso.languageserver.websocket.data.factory
|
package org.enso.languageserver.websocket.binary.factory
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.factory.EnsoUuidFactory
|
import org.enso.languageserver.protocol.binary.Path
|
||||||
import org.enso.languageserver.protocol.data.filemanager.Path
|
import org.enso.languageserver.protocol.binary.factory.EnsoUuidFactory
|
||||||
|
|
||||||
object PathFactory {
|
object PathFactory {
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.enso.languageserver.websocket.data.factory
|
package org.enso.languageserver.websocket.binary.factory
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.filemanager.ReadFileCommand
|
import org.enso.languageserver.protocol.binary.ReadFileCommand
|
||||||
|
|
||||||
object ReadFileCommandFactory {
|
object ReadFileCommandFactory {
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
package org.enso.languageserver.websocket.data.factory
|
package org.enso.languageserver.websocket.binary.factory
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.factory.EnsoUuidFactory
|
import org.enso.languageserver.protocol.binary.InitSessionCommand
|
||||||
import org.enso.languageserver.protocol.data.session.InitSessionCommand
|
import org.enso.languageserver.protocol.binary.factory.EnsoUuidFactory
|
||||||
|
|
||||||
object SessionInitFactory {
|
object SessionInitFactory {
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.enso.languageserver.websocket.data.factory
|
package org.enso.languageserver.websocket.binary.factory
|
||||||
|
|
||||||
import com.google.flatbuffers.FlatBufferBuilder
|
import com.google.flatbuffers.FlatBufferBuilder
|
||||||
import org.enso.languageserver.protocol.data.filemanager.WriteFileCommand
|
import org.enso.languageserver.protocol.binary.WriteFileCommand
|
||||||
|
|
||||||
object WriteFileCommandFactory {
|
object WriteFileCommandFactory {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
@ -15,9 +15,9 @@ import org.enso.languageserver.filemanager.{
|
|||||||
FileSystem,
|
FileSystem,
|
||||||
ReceivesTreeUpdatesHandler
|
ReceivesTreeUpdatesHandler
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.protocol.rpc.{
|
import org.enso.languageserver.protocol.json.{
|
||||||
JsonRpc,
|
JsonConnectionControllerFactory,
|
||||||
RpcConnectionControllerFactory
|
JsonRpc
|
||||||
}
|
}
|
||||||
import org.enso.languageserver.runtime.ContextRegistry
|
import org.enso.languageserver.runtime.ContextRegistry
|
||||||
import org.enso.languageserver.session.SessionRouter
|
import org.enso.languageserver.session.SessionRouter
|
||||||
@ -66,7 +66,7 @@ class BaseServerTest extends JsonRpcServerTestKit {
|
|||||||
lazy val capabilityRouter =
|
lazy val capabilityRouter =
|
||||||
system.actorOf(CapabilityRouter.props(bufferRegistry, fileEventRegistry))
|
system.actorOf(CapabilityRouter.props(bufferRegistry, fileEventRegistry))
|
||||||
|
|
||||||
new RpcConnectionControllerFactory(
|
new JsonConnectionControllerFactory(
|
||||||
bufferRegistry,
|
bufferRegistry,
|
||||||
capabilityRouter,
|
capabilityRouter,
|
||||||
fileManager,
|
fileManager,
|
@ -1,10 +1,10 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import io.circe.literal._
|
import io.circe.literal._
|
||||||
import org.enso.languageserver.websocket.rpc.{
|
import org.enso.languageserver.websocket.json.{
|
||||||
ExecutionContextJsonMessages => json
|
ExecutionContextJsonMessages => json
|
||||||
}
|
}
|
||||||
import org.enso.polyglot.runtime.Runtime.Api
|
import org.enso.polyglot.runtime.Runtime.Api
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import org.enso.polyglot.runtime.Runtime.Api
|
import org.enso.polyglot.runtime.Runtime.Api
|
||||||
import io.circe.literal._
|
import io.circe.literal._
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import java.nio.file.attribute.BasicFileAttributes
|
import java.nio.file.attribute.BasicFileAttributes
|
||||||
import java.nio.file.{Files, Paths}
|
import java.nio.file.{Files, Paths}
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import io.circe.literal._
|
import io.circe.literal._
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import java.nio.file.{Files, Paths}
|
import java.nio.file.{Files, Paths}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import io.circe.literal._
|
import io.circe.literal._
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
|
|
||||||
import akka.testkit.TestProbe
|
import akka.testkit.TestProbe
|
||||||
import io.circe.literal._
|
import io.circe.literal._
|
@ -1,4 +1,4 @@
|
|||||||
package org.enso.languageserver.websocket.rpc
|
package org.enso.languageserver.websocket.json
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import io.circe.literal._
|
import io.circe.literal._
|
@ -4,7 +4,7 @@
|
|||||||
<!-- encoders are assigned the type
|
<!-- encoders are assigned the type
|
||||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{HH:mm:ss.SSS} [%-15thread] %-5level %msg%n</pattern>
|
<pattern>%d{HH:mm:ss.SSS} %-5level [%-15thread] %-36logger{36} %msg%n</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package org.enso.projectmanager.data
|
|||||||
/**
|
/**
|
||||||
* Sockets that a language server listens on.
|
* Sockets that a language server listens on.
|
||||||
*
|
*
|
||||||
* @param rpcSocket a socket used for RPC protocol
|
* @param jsonSocket a socket used for JSON-RPC protocol
|
||||||
* @param dataSocket a socket used fot data protocol
|
* @param binarySocket a socket used fot binary protocol
|
||||||
*/
|
*/
|
||||||
case class LanguageServerSockets(rpcSocket: Socket, dataSocket: Socket)
|
case class LanguageServerSockets(jsonSocket: Socket, binarySocket: Socket)
|
||||||
|
@ -3,6 +3,7 @@ package org.enso.projectmanager.infrastructure.languageserver
|
|||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import akka.actor.{Actor, ActorLogging, Cancellable, Props, Scheduler}
|
import akka.actor.{Actor, ActorLogging, Cancellable, Props, Scheduler}
|
||||||
|
import akka.stream.SubscriptionWithCancelException.StageWasCompleted
|
||||||
import io.circe.parser._
|
import io.circe.parser._
|
||||||
import org.enso.projectmanager.data.Socket
|
import org.enso.projectmanager.data.Socket
|
||||||
import org.enso.projectmanager.infrastructure.http.WebSocketConnection.{
|
import org.enso.projectmanager.infrastructure.http.WebSocketConnection.{
|
||||||
@ -121,16 +122,14 @@ class HeartbeatSession(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def socketClosureStage(cancellable: Cancellable): Receive = {
|
private def socketClosureStage(cancellable: Cancellable): Receive = {
|
||||||
case WebSocketStreamClosed =>
|
case WebSocketStreamClosed | WebSocketStreamFailure(StageWasCompleted) =>
|
||||||
context.stop(self)
|
context.stop(self)
|
||||||
cancellable.cancel()
|
cancellable.cancel()
|
||||||
()
|
|
||||||
|
|
||||||
case WebSocketStreamFailure(th) =>
|
case WebSocketStreamFailure(th) =>
|
||||||
log.error(s"An error occurred during closing web socket", th)
|
log.error(th, s"An error occurred during closing web socket")
|
||||||
context.stop(self)
|
context.stop(self)
|
||||||
cancellable.cancel()
|
cancellable.cancel()
|
||||||
()
|
|
||||||
|
|
||||||
case SocketClosureTimeout =>
|
case SocketClosureTimeout =>
|
||||||
log.error(s"Socket closure timed out")
|
log.error(s"Socket closure timed out")
|
||||||
|
@ -43,8 +43,8 @@ object ProjectManagementApi {
|
|||||||
case class Params(projectId: UUID)
|
case class Params(projectId: UUID)
|
||||||
|
|
||||||
case class Result(
|
case class Result(
|
||||||
languageServerRpcAddress: Socket,
|
languageServerJsonAddress: Socket,
|
||||||
languageServerDataAddress: Socket
|
languageServerBinaryAddress: Socket
|
||||||
)
|
)
|
||||||
|
|
||||||
implicit val hasParams = new HasParams[this.type] {
|
implicit val hasParams = new HasParams[this.type] {
|
||||||
|
@ -71,7 +71,7 @@ class ProjectOpenHandler[F[+_, +_]: Exec](
|
|||||||
replyTo ! ResponseResult(
|
replyTo ! ResponseResult(
|
||||||
ProjectOpen,
|
ProjectOpen,
|
||||||
id,
|
id,
|
||||||
ProjectOpen.Result(sockets.rpcSocket, sockets.dataSocket)
|
ProjectOpen.Result(sockets.jsonSocket, sockets.binarySocket)
|
||||||
)
|
)
|
||||||
cancellable.cancel()
|
cancellable.cancel()
|
||||||
context.stop(self)
|
context.stop(self)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<!-- encoders are assigned the type
|
<!-- encoders are assigned the type
|
||||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{HH:mm:ss.SSS} [%-15thread] %-5level %msg%n</pattern>
|
<pattern>%d{HH:mm:ss.SSS} [%-15thread] %-5level %logger{36} %msg%n</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user