Consistent naming of visualization (#7124)

This commit is contained in:
Hubert Plociniczak 2023-06-26 19:04:35 +02:00 committed by GitHub
parent ae4666c4d3
commit 4e5cb9cca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
99 changed files with 2030 additions and 2030 deletions

View File

@ -33,7 +33,7 @@
Enso is an award-winning interactive programming language with dual visual and Enso is an award-winning interactive programming language with dual visual and
textual representations. It is a tool that spans the entire stack, going from textual representations. It is a tool that spans the entire stack, going from
high-level visualisation and communication to the nitty-gritty of backend high-level visualization and communication to the nitty-gritty of backend
services, all in a single language. Watch the following introduction video to services, all in a single language. Watch the following introduction video to
learn what Enso is, and how it helps companies build data workflows in minutes learn what Enso is, and how it helps companies build data workflows in minutes
instead of weeks. instead of weeks.

View File

@ -23,7 +23,7 @@
Enso is an award-winning interactive programming language with dual visual and Enso is an award-winning interactive programming language with dual visual and
textual representations. It is a tool that spans the entire stack, going from textual representations. It is a tool that spans the entire stack, going from
high-level visualisation and communication to the nitty-gritty of backend high-level visualization and communication to the nitty-gritty of backend
services, all in a single language. Watch the following introduction video to services, all in a single language. Watch the following introduction video to
learn what Enso is, and how it helps companies build data workflows in minutes learn what Enso is, and how it helps companies build data workflows in minutes
instead of weeks. instead of weeks.

View File

@ -8,7 +8,7 @@ use crate::binary::message::FromServerPayloadOwned;
use crate::binary::message::MessageFromServerOwned; use crate::binary::message::MessageFromServerOwned;
use crate::binary::message::MessageToServerRef; use crate::binary::message::MessageToServerRef;
use crate::binary::message::ToServerPayload; use crate::binary::message::ToServerPayload;
use crate::binary::message::VisualisationContext; use crate::binary::message::VisualizationContext;
use crate::common::error::UnexpectedMessage; use crate::common::error::UnexpectedMessage;
use crate::handler::Disposition; use crate::handler::Disposition;
use crate::handler::Handler; use crate::handler::Handler;
@ -44,7 +44,7 @@ pub enum Notification {
/// A new data has been sent for a visualization. /// A new data has been sent for a visualization.
VisualizationUpdate { VisualizationUpdate {
/// Identifies the specific visualization. /// Identifies the specific visualization.
context: VisualisationContext, context: VisualizationContext,
/// Data to be passed to the visualization. /// Data to be passed to the visualization.
data: Vec<u8>, data: Vec<u8>,
}, },
@ -371,7 +371,7 @@ mod tests {
fixture.executor.run_until_stalled(); fixture.executor.run_until_stalled();
event_fut.expect_pending(); event_fut.expect_pending();
let context = VisualisationContext { let context = VisualizationContext {
visualization_id: Uuid::new_v4(), visualization_id: Uuid::new_v4(),
expression_id: Uuid::new_v4(), expression_id: Uuid::new_v4(),
context_id: Uuid::new_v4(), context_id: Uuid::new_v4(),

View File

@ -62,7 +62,7 @@ impl<T> MessageFromServer<T> {
/// Identifies the visualization in the update message. /// Identifies the visualization in the update message.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Clone, Debug, Copy, PartialEq, Eq)] #[derive(Clone, Debug, Copy, PartialEq, Eq)]
pub struct VisualisationContext { pub struct VisualizationContext {
pub visualization_id: Uuid, pub visualization_id: Uuid,
pub context_id: Uuid, pub context_id: Uuid,
pub expression_id: Uuid, pub expression_id: Uuid,
@ -110,7 +110,7 @@ pub enum ToServerPayloadOwned {
pub enum FromServerPayloadOwned { pub enum FromServerPayloadOwned {
Error { code: i32, message: String, data: Option<ErrorPayload> }, Error { code: i32, message: String, data: Option<ErrorPayload> },
Success {}, Success {},
VisualizationUpdate { context: VisualisationContext, data: Vec<u8> }, VisualizationUpdate { context: VisualizationContext, data: Vec<u8> },
FileContentsReply { contents: Vec<u8> }, FileContentsReply { contents: Vec<u8> },
WriteBytesReply { checksum: EnsoDigest }, WriteBytesReply { checksum: EnsoDigest },
ReadBytesReply { checksum: EnsoDigest, bytes: Vec<u8> }, ReadBytesReply { checksum: EnsoDigest, bytes: Vec<u8> },
@ -149,7 +149,7 @@ pub enum ToServerPayload<'a> {
pub enum FromServerPayload<'a> { pub enum FromServerPayload<'a> {
Error { code: i32, message: &'a str, data: Option<ErrorPayload> }, Error { code: i32, message: &'a str, data: Option<ErrorPayload> },
Success {}, Success {},
VisualizationUpdate { context: VisualisationContext, data: &'a [u8] }, VisualizationUpdate { context: VisualizationContext, data: &'a [u8] },
FileContentsReply { contents: &'a [u8] }, FileContentsReply { contents: &'a [u8] },
WriteBytesReply { checksum: EnsoDigest }, WriteBytesReply { checksum: EnsoDigest },
ReadBytesReply { checksum: EnsoDigest, bytes: &'a [u8] }, ReadBytesReply { checksum: EnsoDigest, bytes: &'a [u8] },

View File

@ -77,22 +77,22 @@ impl<'a> SerializableDeserializableObject<'a> for Vec<String> {
} }
// === impl VisualisationContext === // === impl VisualizationContext ===
impl<'a> SerializableDeserializableObject<'a> for message::VisualisationContext { impl<'a> SerializableDeserializableObject<'a> for message::VisualizationContext {
type Out = VisualisationContext<'a>; type Out = VisualizationContext<'a>;
fn serialize(&self, builder: &mut FlatBufferBuilder<'a>) -> WIPOffset<Self::Out> { fn serialize(&self, builder: &mut FlatBufferBuilder<'a>) -> WIPOffset<Self::Out> {
VisualisationContext::create(builder, &VisualisationContextArgs { VisualizationContext::create(builder, &VisualizationContextArgs {
visualisationId: Some(&self.visualization_id.into()), visualizationId: Some(&self.visualization_id.into()),
expressionId: Some(&self.expression_id.into()), expressionId: Some(&self.expression_id.into()),
contextId: Some(&self.context_id.into()), contextId: Some(&self.context_id.into()),
}) })
} }
fn deserialize(fbs: Self::Out) -> Result<Self, DeserializationError> { fn deserialize(fbs: Self::Out) -> Result<Self, DeserializationError> {
Ok(message::VisualisationContext { Ok(message::VisualizationContext {
context_id: fbs.contextId().into(), context_id: fbs.contextId().into(),
visualization_id: fbs.visualisationId().into(), visualization_id: fbs.visualizationId().into(),
expression_id: fbs.expressionId().into(), expression_id: fbs.expressionId().into(),
}) })
} }
@ -325,9 +325,9 @@ impl SerializableUnion for FromServerPayloadOwned {
FromServerPayloadOwned::VisualizationUpdate { data, context } => { FromServerPayloadOwned::VisualizationUpdate { data, context } => {
let data = builder.create_vector(data); let data = builder.create_vector(data);
let context = context.serialize(builder); let context = context.serialize(builder);
VisualisationUpdate::create(builder, &VisualisationUpdateArgs { VisualizationUpdate::create(builder, &VisualizationUpdateArgs {
data: Some(data), data: Some(data),
visualisationContext: Some(context), visualizationContext: Some(context),
}) })
.as_union_value() .as_union_value()
} }
@ -362,7 +362,7 @@ impl SerializableUnion for FromServerPayloadOwned {
FromServerPayloadOwned::FileContentsReply { .. } => FromServerPayloadOwned::FileContentsReply { .. } =>
OutboundPayload::FILE_CONTENTS_REPLY, OutboundPayload::FILE_CONTENTS_REPLY,
FromServerPayloadOwned::VisualizationUpdate { .. } => FromServerPayloadOwned::VisualizationUpdate { .. } =>
OutboundPayload::VISUALISATION_UPDATE, OutboundPayload::VISUALIZATION_UPDATE,
FromServerPayloadOwned::WriteBytesReply { .. } => OutboundPayload::WRITE_BYTES_REPLY, FromServerPayloadOwned::WriteBytesReply { .. } => OutboundPayload::WRITE_BYTES_REPLY,
FromServerPayloadOwned::ReadBytesReply { .. } => OutboundPayload::READ_BYTES_REPLY, FromServerPayloadOwned::ReadBytesReply { .. } => OutboundPayload::READ_BYTES_REPLY,
FromServerPayloadOwned::ChecksumBytesReply { .. } => FromServerPayloadOwned::ChecksumBytesReply { .. } =>
@ -424,12 +424,12 @@ impl<'a> DeserializableUnionField<'a, OutboundMessage<'a>> for FromServerPayload
}) })
} }
OutboundPayload::SUCCESS => Ok(FromServerPayload::Success {}), OutboundPayload::SUCCESS => Ok(FromServerPayload::Success {}),
OutboundPayload::VISUALISATION_UPDATE => { OutboundPayload::VISUALIZATION_UPDATE => {
let payload = message.payload_as_visualisation_update().unwrap(); let payload = message.payload_as_visualization_update().unwrap();
let context = payload.visualisationContext(); let context = payload.visualizationContext();
Ok(FromServerPayload::VisualizationUpdate { Ok(FromServerPayload::VisualizationUpdate {
data: payload.data(), data: payload.data(),
context: message::VisualisationContext::deserialize(context)?, context: message::VisualizationContext::deserialize(context)?,
}) })
} }
OutboundPayload::WRITE_BYTES_REPLY => { OutboundPayload::WRITE_BYTES_REPLY => {
@ -531,12 +531,12 @@ impl<'a> DeserializableUnionField<'a, OutboundMessage<'a>> for FromServerPayload
}) })
} }
OutboundPayload::SUCCESS => Ok(FromServerPayloadOwned::Success {}), OutboundPayload::SUCCESS => Ok(FromServerPayloadOwned::Success {}),
OutboundPayload::VISUALISATION_UPDATE => { OutboundPayload::VISUALIZATION_UPDATE => {
let payload = message.payload_as_visualisation_update().unwrap(); let payload = message.payload_as_visualization_update().unwrap();
let context = payload.visualisationContext(); let context = payload.visualizationContext();
Ok(FromServerPayloadOwned::VisualizationUpdate { Ok(FromServerPayloadOwned::VisualizationUpdate {
data: Vec::from(payload.data()), data: Vec::from(payload.data()),
context: message::VisualisationContext::deserialize(context)?, context: message::VisualizationContext::deserialize(context)?,
}) })
} }
OutboundPayload::WRITE_BYTES_REPLY => { OutboundPayload::WRITE_BYTES_REPLY => {

View File

@ -131,7 +131,7 @@ pub mod org {
NONE = 0, NONE = 0,
ERROR = 1, ERROR = 1,
SUCCESS = 2, SUCCESS = 2,
VISUALISATION_UPDATE = 3, VISUALIZATION_UPDATE = 3,
FILE_CONTENTS_REPLY = 4, FILE_CONTENTS_REPLY = 4,
WRITE_BYTES_REPLY = 5, WRITE_BYTES_REPLY = 5,
READ_BYTES_REPLY = 6, READ_BYTES_REPLY = 6,
@ -177,7 +177,7 @@ pub mod org {
OutboundPayload::NONE, OutboundPayload::NONE,
OutboundPayload::ERROR, OutboundPayload::ERROR,
OutboundPayload::SUCCESS, OutboundPayload::SUCCESS,
OutboundPayload::VISUALISATION_UPDATE, OutboundPayload::VISUALIZATION_UPDATE,
OutboundPayload::FILE_CONTENTS_REPLY, OutboundPayload::FILE_CONTENTS_REPLY,
OutboundPayload::WRITE_BYTES_REPLY, OutboundPayload::WRITE_BYTES_REPLY,
OutboundPayload::READ_BYTES_REPLY, OutboundPayload::READ_BYTES_REPLY,
@ -189,7 +189,7 @@ pub mod org {
"NONE", "NONE",
"ERROR", "ERROR",
"SUCCESS", "SUCCESS",
"VISUALISATION_UPDATE", "VISUALIZATION_UPDATE",
"FILE_CONTENTS_REPLY", "FILE_CONTENTS_REPLY",
"WRITE_BYTES_REPLY", "WRITE_BYTES_REPLY",
"READ_BYTES_REPLY", "READ_BYTES_REPLY",
@ -629,12 +629,12 @@ pub mod org {
#[inline] #[inline]
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub fn payload_as_visualisation_update( pub fn payload_as_visualization_update(
&self, &self,
) -> Option<VisualisationUpdate<'a>> { ) -> Option<VisualizationUpdate<'a>> {
if self.payload_type() == OutboundPayload::VISUALISATION_UPDATE { if self.payload_type() == OutboundPayload::VISUALIZATION_UPDATE {
let u = self.payload(); let u = self.payload();
Some(VisualisationUpdate::init_from_table(u)) Some(VisualizationUpdate::init_from_table(u))
} else { } else {
None None
} }
@ -1115,179 +1115,179 @@ pub mod org {
} }
} }
pub enum VisualisationContextOffset {} pub enum VisualizationContextOffset {}
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct VisualisationContext<'a> { pub struct VisualizationContext<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for VisualisationContext<'a> { impl<'a> flatbuffers::Follow<'a> for VisualizationContext<'a> {
type Inner = VisualisationContext<'a>; type Inner = VisualizationContext<'a>;
#[inline] #[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table { buf, loc } } Self { _tab: flatbuffers::Table { buf, loc } }
} }
} }
impl<'a> VisualisationContext<'a> { impl<'a> VisualizationContext<'a> {
#[inline] #[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
VisualisationContext { _tab: table } VisualizationContext { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args VisualisationContextArgs<'args>, args: &'args VisualizationContextArgs<'args>,
) -> flatbuffers::WIPOffset<VisualisationContext<'bldr>> ) -> flatbuffers::WIPOffset<VisualizationContext<'bldr>>
{ {
let mut builder = VisualisationContextBuilder::new(_fbb); let mut builder = VisualizationContextBuilder::new(_fbb);
if let Some(x) = args.expressionId { if let Some(x) = args.expressionId {
builder.add_expressionId(x); builder.add_expressionId(x);
} }
if let Some(x) = args.contextId { if let Some(x) = args.contextId {
builder.add_contextId(x); builder.add_contextId(x);
} }
if let Some(x) = args.visualisationId { if let Some(x) = args.visualizationId {
builder.add_visualisationId(x); builder.add_visualizationId(x);
} }
builder.finish() builder.finish()
} }
pub const VT_VISUALISATIONID: flatbuffers::VOffsetT = 4; pub const VT_VISUALIZATIONID: flatbuffers::VOffsetT = 4;
pub const VT_CONTEXTID: flatbuffers::VOffsetT = 6; pub const VT_CONTEXTID: flatbuffers::VOffsetT = 6;
pub const VT_EXPRESSIONID: flatbuffers::VOffsetT = 8; pub const VT_EXPRESSIONID: flatbuffers::VOffsetT = 8;
#[inline] #[inline]
pub fn visualisationId(&self) -> &'a EnsoUUID { pub fn visualizationId(&self) -> &'a EnsoUUID {
self._tab self._tab
.get::<EnsoUUID>(VisualisationContext::VT_VISUALISATIONID, None) .get::<EnsoUUID>(VisualizationContext::VT_VISUALIZATIONID, None)
.unwrap() .unwrap()
} }
#[inline] #[inline]
pub fn contextId(&self) -> &'a EnsoUUID { pub fn contextId(&self) -> &'a EnsoUUID {
self._tab self._tab
.get::<EnsoUUID>(VisualisationContext::VT_CONTEXTID, None) .get::<EnsoUUID>(VisualizationContext::VT_CONTEXTID, None)
.unwrap() .unwrap()
} }
#[inline] #[inline]
pub fn expressionId(&self) -> &'a EnsoUUID { pub fn expressionId(&self) -> &'a EnsoUUID {
self._tab self._tab
.get::<EnsoUUID>(VisualisationContext::VT_EXPRESSIONID, None) .get::<EnsoUUID>(VisualizationContext::VT_EXPRESSIONID, None)
.unwrap() .unwrap()
} }
} }
pub struct VisualisationContextArgs<'a> { pub struct VisualizationContextArgs<'a> {
pub visualisationId: Option<&'a EnsoUUID>, pub visualizationId: Option<&'a EnsoUUID>,
pub contextId: Option<&'a EnsoUUID>, pub contextId: Option<&'a EnsoUUID>,
pub expressionId: Option<&'a EnsoUUID>, pub expressionId: Option<&'a EnsoUUID>,
} }
impl<'a> Default for VisualisationContextArgs<'a> { impl<'a> Default for VisualizationContextArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
VisualisationContextArgs { VisualizationContextArgs {
visualisationId: None, // required field visualizationId: None, // required field
contextId: None, // required field contextId: None, // required field
expressionId: None, // required field expressionId: None, // required field
} }
} }
} }
pub struct VisualisationContextBuilder<'a: 'b, 'b> { pub struct VisualizationContextBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b> VisualisationContextBuilder<'a, 'b> { impl<'a: 'b, 'b> VisualizationContextBuilder<'a, 'b> {
#[inline] #[inline]
pub fn add_visualisationId(&mut self, visualisationId: &'b EnsoUUID) { pub fn add_visualizationId(&mut self, visualizationId: &'b EnsoUUID) {
self.fbb_.push_slot_always::<&EnsoUUID>( self.fbb_.push_slot_always::<&EnsoUUID>(
VisualisationContext::VT_VISUALISATIONID, VisualizationContext::VT_VISUALIZATIONID,
visualisationId, visualizationId,
); );
} }
#[inline] #[inline]
pub fn add_contextId(&mut self, contextId: &'b EnsoUUID) { pub fn add_contextId(&mut self, contextId: &'b EnsoUUID) {
self.fbb_.push_slot_always::<&EnsoUUID>( self.fbb_.push_slot_always::<&EnsoUUID>(
VisualisationContext::VT_CONTEXTID, VisualizationContext::VT_CONTEXTID,
contextId, contextId,
); );
} }
#[inline] #[inline]
pub fn add_expressionId(&mut self, expressionId: &'b EnsoUUID) { pub fn add_expressionId(&mut self, expressionId: &'b EnsoUUID) {
self.fbb_.push_slot_always::<&EnsoUUID>( self.fbb_.push_slot_always::<&EnsoUUID>(
VisualisationContext::VT_EXPRESSIONID, VisualizationContext::VT_EXPRESSIONID,
expressionId, expressionId,
); );
} }
#[inline] #[inline]
pub fn new( pub fn new(
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
) -> VisualisationContextBuilder<'a, 'b> { ) -> VisualizationContextBuilder<'a, 'b> {
let start = _fbb.start_table(); let start = _fbb.start_table();
VisualisationContextBuilder { fbb_: _fbb, start_: start } VisualizationContextBuilder { fbb_: _fbb, start_: start }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<VisualisationContext<'a>> { pub fn finish(self) -> flatbuffers::WIPOffset<VisualizationContext<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
self.fbb_.required( self.fbb_.required(
o, o,
VisualisationContext::VT_VISUALISATIONID, VisualizationContext::VT_VISUALIZATIONID,
"visualisation_id", "visualization_id",
); );
self.fbb_.required(o, VisualisationContext::VT_CONTEXTID, "context_id"); self.fbb_.required(o, VisualizationContext::VT_CONTEXTID, "context_id");
self.fbb_.required( self.fbb_.required(
o, o,
VisualisationContext::VT_EXPRESSIONID, VisualizationContext::VT_EXPRESSIONID,
"expression_id", "expression_id",
); );
flatbuffers::WIPOffset::new(o.value()) flatbuffers::WIPOffset::new(o.value())
} }
} }
pub enum VisualisationUpdateOffset {} pub enum VisualizationUpdateOffset {}
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct VisualisationUpdate<'a> { pub struct VisualizationUpdate<'a> {
pub _tab: flatbuffers::Table<'a>, pub _tab: flatbuffers::Table<'a>,
} }
impl<'a> flatbuffers::Follow<'a> for VisualisationUpdate<'a> { impl<'a> flatbuffers::Follow<'a> for VisualizationUpdate<'a> {
type Inner = VisualisationUpdate<'a>; type Inner = VisualizationUpdate<'a>;
#[inline] #[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table { buf, loc } } Self { _tab: flatbuffers::Table { buf, loc } }
} }
} }
impl<'a> VisualisationUpdate<'a> { impl<'a> VisualizationUpdate<'a> {
#[inline] #[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self { pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
VisualisationUpdate { _tab: table } VisualizationUpdate { _tab: table }
} }
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args VisualisationUpdateArgs<'args>, args: &'args VisualizationUpdateArgs<'args>,
) -> flatbuffers::WIPOffset<VisualisationUpdate<'bldr>> ) -> flatbuffers::WIPOffset<VisualizationUpdate<'bldr>>
{ {
let mut builder = VisualisationUpdateBuilder::new(_fbb); let mut builder = VisualizationUpdateBuilder::new(_fbb);
if let Some(x) = args.data { if let Some(x) = args.data {
builder.add_data(x); builder.add_data(x);
} }
if let Some(x) = args.visualisationContext { if let Some(x) = args.visualizationContext {
builder.add_visualisationContext(x); builder.add_visualizationContext(x);
} }
builder.finish() builder.finish()
} }
pub const VT_VISUALISATIONCONTEXT: flatbuffers::VOffsetT = 4; pub const VT_VISUALIZATIONCONTEXT: flatbuffers::VOffsetT = 4;
pub const VT_DATA: flatbuffers::VOffsetT = 6; pub const VT_DATA: flatbuffers::VOffsetT = 6;
#[inline] #[inline]
pub fn visualisationContext(&self) -> VisualisationContext<'a> { pub fn visualizationContext(&self) -> VisualizationContext<'a> {
self._tab self._tab
.get::<flatbuffers::ForwardsUOffset<VisualisationContext<'a>>>( .get::<flatbuffers::ForwardsUOffset<VisualizationContext<'a>>>(
VisualisationUpdate::VT_VISUALISATIONCONTEXT, VisualizationUpdate::VT_VISUALIZATIONCONTEXT,
None, None,
) )
.unwrap() .unwrap()
@ -1296,7 +1296,7 @@ pub mod org {
pub fn data(&self) -> &'a [u8] { pub fn data(&self) -> &'a [u8] {
self._tab self._tab
.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>( .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(
VisualisationUpdate::VT_DATA, VisualizationUpdate::VT_DATA,
None, None,
) )
.map(|v| v.safe_slice()) .map(|v| v.safe_slice())
@ -1304,34 +1304,34 @@ pub mod org {
} }
} }
pub struct VisualisationUpdateArgs<'a> { pub struct VisualizationUpdateArgs<'a> {
pub visualisationContext: pub visualizationContext:
Option<flatbuffers::WIPOffset<VisualisationContext<'a>>>, Option<flatbuffers::WIPOffset<VisualizationContext<'a>>>,
pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>, pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
} }
impl<'a> Default for VisualisationUpdateArgs<'a> { impl<'a> Default for VisualizationUpdateArgs<'a> {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
VisualisationUpdateArgs { VisualizationUpdateArgs {
visualisationContext: None, // required field visualizationContext: None, // required field
data: None, // required field data: None, // required field
} }
} }
} }
pub struct VisualisationUpdateBuilder<'a: 'b, 'b> { pub struct VisualizationUpdateBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
} }
impl<'a: 'b, 'b> VisualisationUpdateBuilder<'a, 'b> { impl<'a: 'b, 'b> VisualizationUpdateBuilder<'a, 'b> {
#[inline] #[inline]
pub fn add_visualisationContext( pub fn add_visualizationContext(
&mut self, &mut self,
visualisationContext: flatbuffers::WIPOffset<VisualisationContext<'b>>, visualizationContext: flatbuffers::WIPOffset<VisualizationContext<'b>>,
) { ) {
self.fbb_ self.fbb_
.push_slot_always::<flatbuffers::WIPOffset<VisualisationContext>>( .push_slot_always::<flatbuffers::WIPOffset<VisualizationContext>>(
VisualisationUpdate::VT_VISUALISATIONCONTEXT, VisualizationUpdate::VT_VISUALIZATIONCONTEXT,
visualisationContext, visualizationContext,
); );
} }
#[inline] #[inline]
@ -1340,26 +1340,26 @@ pub mod org {
data: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u8>>, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u8>>,
) { ) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>( self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
VisualisationUpdate::VT_DATA, VisualizationUpdate::VT_DATA,
data, data,
); );
} }
#[inline] #[inline]
pub fn new( pub fn new(
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
) -> VisualisationUpdateBuilder<'a, 'b> { ) -> VisualizationUpdateBuilder<'a, 'b> {
let start = _fbb.start_table(); let start = _fbb.start_table();
VisualisationUpdateBuilder { fbb_: _fbb, start_: start } VisualizationUpdateBuilder { fbb_: _fbb, start_: start }
} }
#[inline] #[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<VisualisationUpdate<'a>> { pub fn finish(self) -> flatbuffers::WIPOffset<VisualizationUpdate<'a>> {
let o = self.fbb_.end_table(self.start_); let o = self.fbb_.end_table(self.start_);
self.fbb_.required( self.fbb_.required(
o, o,
VisualisationUpdate::VT_VISUALISATIONCONTEXT, VisualizationUpdate::VT_VISUALIZATIONCONTEXT,
"visualisation_context", "visualization_context",
); );
self.fbb_.required(o, VisualisationUpdate::VT_DATA, "data"); self.fbb_.required(o, VisualizationUpdate::VT_DATA, "data");
flatbuffers::WIPOffset::new(o.value()) flatbuffers::WIPOffset::new(o.value())
} }
} }

View File

@ -132,24 +132,24 @@ trait API {
#[MethodInput=PopFromExecutionContextInput, rpc_name="executionContext/pop"] #[MethodInput=PopFromExecutionContextInput, rpc_name="executionContext/pop"]
fn pop_from_execution_context(&self, context_id: ContextId) -> (); fn pop_from_execution_context(&self, context_id: ContextId) -> ();
/// Attach a visualisation, potentially preprocessed by some arbitrary Enso code, to a given /// Attach a visualization, potentially preprocessed by some arbitrary Enso code, to a given
/// node in the program. /// node in the program.
#[MethodInput=AttachVisualisationInput, rpc_name="executionContext/attachVisualisation"] #[MethodInput=AttachVisualizationInput, rpc_name="executionContext/attachVisualization"]
fn attach_visualisation fn attach_visualization
( &self ( &self
, visualisation_id : Uuid , visualization_id : Uuid
, expression_id : Uuid , expression_id : Uuid
, visualisation_config : VisualisationConfiguration) -> (); , visualization_config : VisualizationConfiguration) -> ();
/// Detach a visualisation from the executing code. /// Detach a visualization from the executing code.
#[MethodInput=DetachVisualisationInput, rpc_name="executionContext/detachVisualisation"] #[MethodInput=DetachVisualizationInput, rpc_name="executionContext/detachVisualization"]
fn detach_visualisation fn detach_visualization
(&self, context_id: Uuid, visualisation_id: Uuid, expression_id: Uuid) -> (); (&self, context_id: Uuid, visualization_id: Uuid, expression_id: Uuid) -> ();
/// Modify the configuration for an existing visualisation. /// Modify the configuration for an existing visualization.
#[MethodInput=ModifyVisualisationInput, rpc_name="executionContext/modifyVisualisation"] #[MethodInput=ModifyVisualizationInput, rpc_name="executionContext/modifyVisualization"]
fn modify_visualisation fn modify_visualization
(&self, visualisation_id: Uuid, visualisation_config: VisualisationConfiguration) -> (); (&self, visualization_id: Uuid, visualization_config: VisualizationConfiguration) -> ();
/// Interrupt the program execution. /// Interrupt the program execution.
#[MethodInput=InterruptInput, rpc_name="executionContext/interrupt"] #[MethodInput=InterruptInput, rpc_name="executionContext/interrupt"]
@ -256,7 +256,7 @@ mod test {
let error = RpcError::RemoteError(msg).into(); let error = RpcError::RemoteError(msg).into();
assert!(is_timeout_error(&error)); assert!(is_timeout_error(&error));
let text = r#"{"code":2007,"message":"Evaluation of the visualisation expression failed"}"#; let text = r#"{"code":2007,"message":"Evaluation of the visualization expression failed"}"#;
let msg = serde_json::from_str::<json_rpc::messages::Error>(text).unwrap(); let msg = serde_json::from_str::<json_rpc::messages::Error>(text).unwrap();
let error = RpcError::RemoteError(msg).into(); let error = RpcError::RemoteError(msg).into();
assert!(!is_timeout_error(&error)); assert!(!is_timeout_error(&error));

View File

@ -423,7 +423,7 @@ fn test_execution_context() {
unit_json.clone(), unit_json.clone(),
(), (),
); );
let visualisation_id = Uuid::default(); let visualization_id = Uuid::default();
let expression_id = Uuid::default(); let expression_id = Uuid::default();
let visualization_function = "foo"; let visualization_function = "foo";
let visualization_module = "[Foo.Bar.Baz]"; let visualization_module = "[Foo.Bar.Baz]";
@ -433,20 +433,20 @@ fn test_execution_context() {
name: visualization_function.to_string(), name: visualization_function.to_string(),
}; };
let positional_arguments_expressions = vec![1, 2, 3].iter().map(|x| x.to_string()).collect(); let positional_arguments_expressions = vec![1, 2, 3].iter().map(|x| x.to_string()).collect();
let visualisation_config = VisualisationConfiguration { let visualization_config = VisualizationConfiguration {
execution_context_id: context_id, execution_context_id: context_id,
expression, expression,
positional_arguments_expressions, positional_arguments_expressions,
}; };
test_request( test_request(
|client| { |client| {
client.attach_visualisation(&visualisation_id, &expression_id, &visualisation_config) client.attach_visualization(&visualization_id, &expression_id, &visualization_config)
}, },
"executionContext/attachVisualisation", "executionContext/attachVisualization",
json!({ json!({
"visualisationId" : "00000000-0000-0000-0000-000000000000", "visualizationId" : "00000000-0000-0000-0000-000000000000",
"expressionId" : "00000000-0000-0000-0000-000000000000", "expressionId" : "00000000-0000-0000-0000-000000000000",
"visualisationConfig" : { "visualizationConfig" : {
"executionContextId" : "00000000-0000-0000-0000-000000000000", "executionContextId" : "00000000-0000-0000-0000-000000000000",
"expression" : { "expression" : {
"module" : "[Foo.Bar.Baz]", "module" : "[Foo.Bar.Baz]",
@ -460,11 +460,11 @@ fn test_execution_context() {
(), (),
); );
test_request( test_request(
|client| client.detach_visualisation(&context_id, &visualisation_id, &expression_id), |client| client.detach_visualization(&context_id, &visualization_id, &expression_id),
"executionContext/detachVisualisation", "executionContext/detachVisualization",
json!({ json!({
"contextId" : "00000000-0000-0000-0000-000000000000", "contextId" : "00000000-0000-0000-0000-000000000000",
"visualisationId" : "00000000-0000-0000-0000-000000000000", "visualizationId" : "00000000-0000-0000-0000-000000000000",
"expressionId" : "00000000-0000-0000-0000-000000000000" "expressionId" : "00000000-0000-0000-0000-000000000000"
}), }),
unit_json.clone(), unit_json.clone(),
@ -478,17 +478,17 @@ fn test_execution_context() {
name: visualization_function.to_string(), name: visualization_function.to_string(),
}; };
let positional_arguments_expressions = vec!["foo"].iter().map(|x| x.to_string()).collect(); let positional_arguments_expressions = vec!["foo"].iter().map(|x| x.to_string()).collect();
let visualisation_config = VisualisationConfiguration { let visualization_config = VisualizationConfiguration {
execution_context_id: context_id, execution_context_id: context_id,
expression, expression,
positional_arguments_expressions, positional_arguments_expressions,
}; };
test_request( test_request(
|client| client.modify_visualisation(&visualisation_id, &visualisation_config), |client| client.modify_visualization(&visualization_id, &visualization_config),
"executionContext/modifyVisualisation", "executionContext/modifyVisualization",
json!({ json!({
"visualisationId" : "00000000-0000-0000-0000-000000000000", "visualizationId" : "00000000-0000-0000-0000-000000000000",
"visualisationConfig" : { "visualizationConfig" : {
"executionContextId" : "00000000-0000-0000-0000-000000000000", "executionContextId" : "00000000-0000-0000-0000-000000000000",
"expression" : { "expression" : {
"module" : "[Foo.Bar.Baz]", "module" : "[Foo.Bar.Baz]",

View File

@ -166,9 +166,9 @@ pub enum Notification {
ContentRootRemoved { id: Uuid }, ContentRootRemoved { id: Uuid },
/// Sent from server to the client to inform about a failure during execution of a /// Sent from server to the client to inform about a failure during execution of a
/// visualisation. /// visualization.
#[serde(rename = "executionContext/visualisationEvaluationFailed")] #[serde(rename = "executionContext/visualizationEvaluationFailed")]
VisualisationEvaluationFailed(VisualisationEvaluationFailed), VisualizationEvaluationFailed(VisualizationEvaluationFailed),
} }
/// Sent from the server to the client to inform about a failure during execution of an execution /// Sent from the server to the client to inform about a failure during execution of an execution
@ -181,13 +181,13 @@ pub struct ExecutionFailed {
pub message: String, pub message: String,
} }
/// Sent from server to the client to inform about a failure during execution of a visualisation. /// Sent from server to the client to inform about a failure during execution of a visualization.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Eq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Eq)]
#[allow(missing_docs)] #[allow(missing_docs)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VisualisationEvaluationFailed { pub struct VisualizationEvaluationFailed {
pub context_id: ContextId, pub context_id: ContextId,
pub visualisation_id: Uuid, pub visualization_id: Uuid,
pub expression_id: ExpressionId, pub expression_id: ExpressionId,
pub message: String, pub message: String,
pub diagnostic: Option<Diagnostic>, pub diagnostic: Option<Diagnostic>,
@ -708,11 +708,11 @@ pub type ContextId = Uuid;
/// Execution context expression ID. /// Execution context expression ID.
pub type ExpressionId = Uuid; pub type ExpressionId = Uuid;
/// A configuration object for properties of the visualisation. /// A configuration object for properties of the visualization.
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
#[allow(missing_docs)] #[allow(missing_docs)]
pub struct VisualisationConfiguration { pub struct VisualizationConfiguration {
/// An execution context of the visualization. /// An execution context of the visualization.
pub execution_context_id: ContextId, pub execution_context_id: ContextId,
/// An enso function that will transform the data into expected format. /// An enso function that will transform the data into expected format.

View File

@ -2,7 +2,7 @@
//! //!
//! This controller provides operations on a specific graph with some execution context - these //! This controller provides operations on a specific graph with some execution context - these
//! operations usually involves retrieving values on nodes: that's are i.e. operations on //! operations usually involves retrieving values on nodes: that's are i.e. operations on
//! visualisations, retrieving types on ports, etc. //! visualizations, retrieving types on ports, etc.
use crate::prelude::*; use crate::prelude::*;

View File

@ -11,7 +11,7 @@ use engine_protocol::language_server::ExecutionEnvironment;
use engine_protocol::language_server::ExpressionUpdate; use engine_protocol::language_server::ExpressionUpdate;
use engine_protocol::language_server::ExpressionUpdatePayload; use engine_protocol::language_server::ExpressionUpdatePayload;
use engine_protocol::language_server::MethodPointer; use engine_protocol::language_server::MethodPointer;
use engine_protocol::language_server::VisualisationConfiguration; use engine_protocol::language_server::VisualizationConfiguration;
use ensogl::data::color; use ensogl::data::color;
use flo_stream::Subscriber; use flo_stream::Subscriber;
use mockall::automock; use mockall::automock;
@ -341,11 +341,11 @@ impl Visualization {
Visualization { id, expression_id, method_pointer, arguments } Visualization { id, expression_id, method_pointer, arguments }
} }
/// Creates a `VisualisationConfiguration` that is used in communication with language server. /// Creates a `VisualizationConfiguration` that is used in communication with language server.
pub fn config(&self, execution_context_id: Uuid) -> VisualisationConfiguration { pub fn config(&self, execution_context_id: Uuid) -> VisualizationConfiguration {
let expression = self.method_pointer.clone().into(); let expression = self.method_pointer.clone().into();
let positional_arguments_expressions = self.arguments.clone(); let positional_arguments_expressions = self.arguments.clone();
VisualisationConfiguration { VisualizationConfiguration {
execution_context_id, execution_context_id,
expression, expression,
positional_arguments_expressions, positional_arguments_expressions,

View File

@ -13,7 +13,7 @@ use crate::model::execution_context::VisualizationUpdateData;
use engine_protocol::language_server::ExecutionEnvironment; use engine_protocol::language_server::ExecutionEnvironment;
use engine_protocol::language_server::MethodPointer; use engine_protocol::language_server::MethodPointer;
use engine_protocol::language_server::VisualisationConfiguration; use engine_protocol::language_server::VisualizationConfiguration;
use futures::future::LocalBoxFuture; use futures::future::LocalBoxFuture;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -99,13 +99,13 @@ impl ExecutionContext {
} }
} }
/// Creates a `VisualisationConfiguration` for the visualization with given id. It may be used /// Creates a `VisualizationConfiguration` for the visualization with given id. It may be used
/// in communication with language server. /// in communication with language server.
pub fn visualization_config( pub fn visualization_config(
&self, &self,
id: VisualizationId, id: VisualizationId,
execution_context_id: Uuid, execution_context_id: Uuid,
) -> FallibleResult<VisualisationConfiguration> { ) -> FallibleResult<VisualizationConfiguration> {
let err = || InvalidVisualizationId(id); let err = || InvalidVisualizationId(id);
let visualizations = self.visualizations.borrow(); let visualizations = self.visualizations.borrow();
Ok(visualizations.get(&id).ok_or_else(err)?.visualization.config(execution_context_id)) Ok(visualizations.get(&id).ok_or_else(err)?.visualization.config(execution_context_id))

View File

@ -137,7 +137,7 @@ impl ExecutionContext {
let ast_id = vis.expression_id; let ast_id = vis.expression_id;
let ls = self.language_server.clone_ref(); let ls = self.language_server.clone_ref();
info!("About to detach visualization by id: {vis_id}."); info!("About to detach visualization by id: {vis_id}.");
ls.detach_visualisation(&exe_id, &vis_id, &ast_id).await?; ls.detach_visualization(&exe_id, &vis_id, &ast_id).await?;
if let Err(err) = self.model.detach_visualization(vis_id) { if let Err(err) = self.model.detach_visualization(vis_id) {
warn!("Failed to update model after detaching visualization: {err:?}.") warn!("Failed to update model after detaching visualization: {err:?}.")
} }
@ -244,7 +244,7 @@ impl model::execution_context::API for ExecutionContext {
async move { async move {
let result = self let result = self
.language_server .language_server
.attach_visualisation(&vis.id, &vis.expression_id, &config) .attach_visualization(&vis.id, &vis.expression_id, &config)
.await; .await;
if let Err(e) = result { if let Err(e) = result {
self.model.detach_visualization(vis.id)?; self.model.detach_visualization(vis.id)?;
@ -277,7 +277,7 @@ impl model::execution_context::API for ExecutionContext {
let new_config = self.model.visualization_config(id, self.id); let new_config = self.model.visualization_config(id, self.id);
async move { async move {
result?; result?;
self.language_server.modify_visualisation(&id, &new_config?).await?; self.language_server.modify_visualization(&id, &new_config?).await?;
Ok(()) Ok(())
} }
.boxed_local() .boxed_local()
@ -542,8 +542,8 @@ pub mod test {
let ast_id = vis.expression_id; let ast_id = vis.expression_id;
let config = vis.config(exe_id); let config = vis.config(exe_id);
expect_call!(ls.attach_visualisation(vis_id,ast_id,config) => Ok(())); expect_call!(ls.attach_visualization(vis_id,ast_id,config) => Ok(()));
expect_call!(ls.detach_visualisation(exe_id,vis_id,ast_id) => Ok(())); expect_call!(ls.detach_visualization(exe_id,vis_id,ast_id) => Ok(()));
}); });
test.run_task(async move { test.run_task(async move {
@ -595,10 +595,10 @@ pub mod test {
let config = vis.config(exe_id); let config = vis.config(exe_id);
let config2 = vis2.config(exe_id); let config2 = vis2.config(exe_id);
expect_call!(ls.attach_visualisation(vis_id,ast_id,config) => Ok(())); expect_call!(ls.attach_visualization(vis_id,ast_id,config) => Ok(()));
expect_call!(ls.attach_visualisation(vis2_id,ast_id,config2) => Ok(())); expect_call!(ls.attach_visualization(vis2_id,ast_id,config2) => Ok(()));
expect_call!(ls.detach_visualisation(exe_id,vis_id,ast_id) => Ok(())); expect_call!(ls.detach_visualization(exe_id,vis_id,ast_id) => Ok(()));
expect_call!(ls.detach_visualisation(exe_id,vis2_id,ast_id) => Ok(())); expect_call!(ls.detach_visualization(exe_id,vis2_id,ast_id) => Ok(()));
}); });
test.run_task(async move { test.run_task(async move {
// We discard visualization update streams -- they are covered by a separate test. // We discard visualization update streams -- they are covered by a separate test.
@ -632,14 +632,14 @@ pub mod test {
let ast_id = vis.expression_id; let ast_id = vis.expression_id;
let config = vis.config(exe_id); let config = vis.config(exe_id);
let expected_config = language_server::types::VisualisationConfiguration { let expected_config = language_server::types::VisualizationConfiguration {
execution_context_id: data.context_id, execution_context_id: data.context_id,
expression: new_expression.clone().into(), expression: new_expression.clone().into(),
positional_arguments_expressions: arguments.clone(), positional_arguments_expressions: arguments.clone(),
}; };
expect_call!(ls.attach_visualisation(vis_id,ast_id,config) => Ok(())); expect_call!(ls.attach_visualization(vis_id,ast_id,config) => Ok(()));
expect_call!(ls.modify_visualisation(vis_id,expected_config) => Ok(())); expect_call!(ls.modify_visualization(vis_id,expected_config) => Ok(()));
}); });
test.run_task(async move { test.run_task(async move {

View File

@ -12,7 +12,7 @@ use crate::transport::web::WebSocket;
use double_representation::name::project; use double_representation::name::project;
use engine_protocol::binary; use engine_protocol::binary;
use engine_protocol::binary::message::VisualisationContext; use engine_protocol::binary::message::VisualizationContext;
use engine_protocol::common::error::code; use engine_protocol::common::error::code;
use engine_protocol::language_server; use engine_protocol::language_server;
use engine_protocol::language_server::response; use engine_protocol::language_server::response;
@ -80,7 +80,7 @@ impl ExecutionContextsRegistry {
/// Route the visualization update into the appropriate execution context. /// Route the visualization update into the appropriate execution context.
pub fn dispatch_visualization_update( pub fn dispatch_visualization_update(
&self, &self,
context: VisualisationContext, context: VisualizationContext,
data: VisualizationUpdateData, data: VisualizationUpdateData,
) -> FallibleResult { ) -> FallibleResult {
self.with_context(context.context_id, |ctx| { self.with_context(context.context_id, |ctx| {
@ -577,12 +577,12 @@ impl Project {
content_roots.remove(id); content_roots.remove(id);
} }
} }
Event::Notification(Notification::VisualisationEvaluationFailed(update)) => { Event::Notification(Notification::VisualizationEvaluationFailed(update)) => {
error!( error!(
"Visualisation evaluation failed in context {} for visualisation {} of \ "Visualization evaluation failed in context {} for visualization {} of \
expression {}. Error: {}", expression {}. Error: {}",
update.context_id, update.context_id,
update.visualisation_id, update.visualization_id,
update.expression_id, update.expression_id,
update.message update.message
); );

View File

@ -60,7 +60,7 @@ Number.foo = x ->
[[{"index": {"value": 98}, "size": {"value": 5}}, "5fc0c11d-bd83-4ca3-b847-b8e362f7658c"],[{"index": {"value": 81}, "size": {"value": 8}}, "1cda3676-bd62-41f8-b6a1-a1e1b7c73d18"],[{"index": {"value": 42}, "size": {"value": 5}}, "899a11e5-4d2b-43dc-a867-2f2ef2d2ba62"],[{"index": {"value": 26}, "size": {"value": 7}}, "37f284d4-c593-4e65-a4be-4948fbd2adfb"],[{"index": {"value": 16}, "size": {"value": 1}}, "c553533e-a2b9-4305-9f12-b8fe7781f933"]] [[{"index": {"value": 98}, "size": {"value": 5}}, "5fc0c11d-bd83-4ca3-b847-b8e362f7658c"],[{"index": {"value": 81}, "size": {"value": 8}}, "1cda3676-bd62-41f8-b6a1-a1e1b7c73d18"],[{"index": {"value": 42}, "size": {"value": 5}}, "899a11e5-4d2b-43dc-a867-2f2ef2d2ba62"],[{"index": {"value": 26}, "size": {"value": 7}}, "37f284d4-c593-4e65-a4be-4948fbd2adfb"],[{"index": {"value": 16}, "size": {"value": 1}}, "c553533e-a2b9-4305-9f12-b8fe7781f933"]]
[]"#; []"#;
const VISUALISATION_CODE: &str = r#" const VISUALIZATION_CODE: &str = r#"
encode = x -> x.to_text encode = x -> x.to_text
incAndEncode = x -> here.encode x+1 incAndEncode = x -> here.encode x+1
@ -84,10 +84,10 @@ async fn ls_text_protocol_test() {
let result = client.write_file(&file, &contents).await; let result = client.write_file(&file, &contents).await;
result.expect("Couldn't write main code file."); result.expect("Couldn't write main code file.");
let visualisation_file = Path::new(root_id, &["src", "Visualisation.enso"]); let visualization_file = Path::new(root_id, &["src", "Visualization.enso"]);
let contents = VISUALISATION_CODE.to_string(); let contents = VISUALIZATION_CODE.to_string();
let response = client.write_file(&visualisation_file, &contents).await; let response = client.write_file(&visualization_file, &contents).await;
response.expect("Couldn't write visualisation file."); response.expect("Couldn't write visualization file.");
let package_file = Path::new(root_id, &["package.yaml"]); let package_file = Path::new(root_id, &["package.yaml"]);
let contents = PACKAGE_YAML.to_string(); let contents = PACKAGE_YAML.to_string();
@ -125,45 +125,45 @@ async fn ls_text_protocol_test() {
// Setting visualization. // Setting visualization.
let visualisation_id = uuid::Uuid::new_v4(); let visualization_id = uuid::Uuid::new_v4();
let expression_id = uuid::Uuid::parse_str("c553533e-a2b9-4305-9f12-b8fe7781f933"); let expression_id = uuid::Uuid::parse_str("c553533e-a2b9-4305-9f12-b8fe7781f933");
let expression_id = expression_id.expect("Couldn't parse expression ID."); let expression_id = expression_id.expect("Couldn't parse expression ID.");
let visualization_function = "foo".to_string(); let visualization_function = "foo".to_string();
let visualization_module = "Test.Visualisation"; let visualization_module = "Test.Visualization";
let expression = MethodPointer { let expression = MethodPointer {
module: visualization_module.to_string(), module: visualization_module.to_string(),
defined_on_type: visualization_module.to_string(), defined_on_type: visualization_module.to_string(),
name: visualization_function, name: visualization_function,
}; };
let positional_arguments_expressions = vec!["1".to_owned()]; let positional_arguments_expressions = vec!["1".to_owned()];
let visualisation_config = VisualisationConfiguration { let visualization_config = VisualizationConfiguration {
execution_context_id, execution_context_id,
expression, expression,
positional_arguments_expressions, positional_arguments_expressions,
}; };
let response = let response =
client.attach_visualisation(&visualisation_id, &expression_id, &visualisation_config); client.attach_visualization(&visualization_id, &expression_id, &visualization_config);
response.await.expect("Couldn't attach visualisation."); response.await.expect("Couldn't attach visualization.");
let visualization_function = "bar".to_string(); let visualization_function = "bar".to_string();
let visualization_module = "Test.Visualisation"; let visualization_module = "Test.Visualization";
let expression = MethodPointer { let expression = MethodPointer {
module: visualization_module.to_string(), module: visualization_module.to_string(),
defined_on_type: visualization_module.to_string(), defined_on_type: visualization_module.to_string(),
name: visualization_function, name: visualization_function,
}; };
let positional_arguments_expressions = vec!["1".to_owned(), "2".to_owned()]; let positional_arguments_expressions = vec!["1".to_owned(), "2".to_owned()];
let visualisation_config = VisualisationConfiguration { let visualization_config = VisualizationConfiguration {
execution_context_id, execution_context_id,
expression, expression,
positional_arguments_expressions, positional_arguments_expressions,
}; };
let response = client.modify_visualisation(&visualisation_id, &visualisation_config).await; let response = client.modify_visualization(&visualization_id, &visualization_config).await;
response.expect("Couldn't modify visualisation."); response.expect("Couldn't modify visualization.");
let response = let response =
client.detach_visualisation(&execution_context_id, &visualisation_id, &expression_id).await; client.detach_visualization(&execution_context_id, &visualization_id, &expression_id).await;
response.expect("Couldn't detach visualisation."); response.expect("Couldn't detach visualization.");
let response = client.destroy_execution_context(&execution_context_id).await; let response = client.destroy_execution_context(&execution_context_id).await;
response.expect("Couldn't destroy execution context."); response.expect("Couldn't destroy execution context.");

View File

@ -41,7 +41,7 @@ class Heatmap extends Visualization {
} }
/** /**
* Indicates whether this visualisation has been initialised. * Indicates whether this visualization has been initialised.
*/ */
isInitialised() { isInitialised() {
ok(this.svg) ok(this.svg)

View File

@ -76,7 +76,7 @@ class Histogram extends Visualization {
} }
/** /**
* Indicates whether this visualisation has been initialised. * Indicates whether this visualization has been initialised.
*/ */
isInitialised() { isInitialised() {
ok(this.svg) ok(this.svg)

View File

@ -12,4 +12,4 @@ pub mod text_visualization;
pub use bubble_chart::BubbleChart; pub use bubble_chart::BubbleChart;
pub use error::Error; pub use error::Error;
pub use text_visualization::TextVisualisation; pub use text_visualization::TextVisualization;

View File

@ -1,4 +1,4 @@
//! Bubble Chart visualisation implemented using the native shape system. //! Bubble Chart visualization implemented using the native shape system.
use crate::component::visualization::*; use crate::component::visualization::*;
use crate::prelude::*; use crate::prelude::*;

View File

@ -1,4 +1,4 @@
//! Example visualisation showing the provided data as text. //! Example visualization showing the provided data as text.
use crate::component::visualization::*; use crate::component::visualization::*;
use crate::prelude::*; use crate::prelude::*;
@ -35,12 +35,12 @@ const PADDING_TEXT: f32 = 10.0;
/// The module containing the `PREPROCESSOR_FUNCTION`. See there. /// The module containing the `PREPROCESSOR_FUNCTION`. See there.
// NOTE: contents of this const need to be kept in sync with Scala test in // NOTE: contents of this const need to be kept in sync with Scala test in
// RuntimeVisualisationsTest.scala, used to verify the snippet's correctness // RuntimeVisualizationsTest.scala, used to verify the snippet's correctness
const PREPROCESSOR_MODULE: &str = "Standard.Visualization.Preprocessor"; const PREPROCESSOR_MODULE: &str = "Standard.Visualization.Preprocessor";
/// The method name of the error preprocessor. /// The method name of the error preprocessor.
// NOTE: contents of this const need to be kept in sync with Scala test in // NOTE: contents of this const need to be kept in sync with Scala test in
// RuntimeVisualisationsTest.scala, used to verify the snippet's correctness // RuntimeVisualizationsTest.scala, used to verify the snippet's correctness
const PREPROCESSOR_METHOD: &str = "error_preprocessor"; const PREPROCESSOR_METHOD: &str = "error_preprocessor";
/// The list of arguments passed to the error preprocessor. /// The list of arguments passed to the error preprocessor.

View File

@ -1,8 +1,8 @@
//! Text visualisation that can show text based data from the backend. If the text is larger than //! Text visualization that can show text based data from the backend. If the text is larger than
//! the available space, it will use lazy loading to request only a subset of the data to //! the available space, it will use lazy loading to request only a subset of the data to
//! display. This is useful for large texts to avoid overwhelming the visualisation. //! display. This is useful for large texts to avoid overwhelming the visualization.
//! //!
//! The visualisation is made up of text `chunks` that are cached and will be requested form the //! The visualization is made up of text `chunks` that are cached and will be requested form the
//! backend. The size of the chunks is determined by the `chunk_size` parameter and each hunk is //! backend. The size of the chunks is determined by the `chunk_size` parameter and each hunk is
//! shown as a cell in a grid. //! shown as a cell in a grid.
//! //!
@ -52,10 +52,10 @@ use text_provider::TextProvider;
/// Number of characters that can be displayed in one grid cell and will be requested together from /// Number of characters that can be displayed in one grid cell and will be requested together from
/// the engine. Also referred to as `chunk`. This value can be changed to tweak the size of the /// the engine. Also referred to as `chunk`. This value can be changed to tweak the size of the
/// messages sent to the visualisation as well as the caching performance. A larger value will /// messages sent to the visualization as well as the caching performance. A larger value will
/// result in fewer, smaller messages, but the visualisation might have to load more data that is /// result in fewer, smaller messages, but the visualization might have to load more data that is
/// not needed, as it will be cropped. For example, a value of 100, would mean that the /// not needed, as it will be cropped. For example, a value of 100, would mean that the
/// visualisation would request 100 characters per chunk, even if it can only show 10 characters at /// visualization would request 100 characters per chunk, even if it can only show 10 characters at
/// once in the available viewport. /// once in the available viewport.
const CHARS_PER_CHUNK: usize = 20; const CHARS_PER_CHUNK: usize = 20;
/// Extra chunks to load around the visible grid to ensure smooth scrolling. Extra chunks are /// Extra chunks to load around the visible grid to ensure smooth scrolling. Extra chunks are
@ -480,22 +480,22 @@ impl FontLoadedNotifier {
// =========================== // ===========================
// === Visualisation Types === // === Visualization Types ===
// =========================== // ===========================
/// A text grid backed by a `String`. Used for testing and backend agnostic development and demos. /// A text grid backed by a `String`. Used for testing and backend agnostic development and demos.
/// Should not be used in production as it is not optimized for performance. /// Should not be used in production as it is not optimized for performance.
pub type DebugTextGridVisualisation = TextGrid<String>; pub type DebugTextGridVisualization = TextGrid<String>;
/// A text grid backed by a the engine. Requests data from the engine on demand and renders it. /// A text grid backed by a the engine. Requests data from the engine on demand and renders it.
pub type TextVisualisation = TextGrid<BackendTextProvider>; pub type TextVisualization = TextGrid<BackendTextProvider>;
/// Return definition of a lazy text visualisation. /// Return definition of a lazy text visualization.
pub fn text_visualisation() -> visualization::Definition { pub fn text_visualization() -> visualization::Definition {
let path = visualization::Path::builtin("JSON"); let path = visualization::Path::builtin("JSON");
visualization::Definition::new( visualization::Definition::new(
visualization::Signature::new_for_any_type(path, visualization::Format::Json), visualization::Signature::new_for_any_type(path, visualization::Format::Json),
|app| { |app| {
let grid = TextVisualisation::new(app.clone_ref()); let grid = TextVisualization::new(app.clone_ref());
grid.set_text_provider(BackendTextProvider::new( grid.set_text_provider(BackendTextProvider::new(
grid.frp.inputs.send_data.clone_ref(), grid.frp.inputs.send_data.clone_ref(),
grid.frp.preprocessor_change.clone_ref(), grid.frp.preprocessor_change.clone_ref(),

View File

@ -222,7 +222,7 @@ ensogl::define_endpoints_2! {
/// visualization state is explicitly changed by the user. The preview looks the same as /// visualization state is explicitly changed by the user. The preview looks the same as
/// normal visualization, but its state is not persisted in the node's metadata. /// normal visualization, but its state is not persisted in the node's metadata.
show_preview (), show_preview (),
/// Indicate whether preview visualisations should be delayed or immediate. /// Indicate whether preview visualizations should be delayed or immediate.
quick_preview_vis (bool), quick_preview_vis (bool),
set_view_mode (view::Mode), set_view_mode (view::Mode),
set_profiling_min_global_duration (f32), set_profiling_min_global_duration (f32),
@ -769,7 +769,7 @@ impl Node {
visualization.set_view_state <+ action_bar.user_action_visibility.on_false().constant(visualization::ViewState::Disabled); visualization.set_view_state <+ action_bar.user_action_visibility.on_false().constant(visualization::ViewState::Disabled);
// Show preview visualisation after some delay, depending on whether we show an error // Show preview visualization after some delay, depending on whether we show an error
// or are in quick preview mode. Also, omit the preview if we don't have an // or are in quick preview mode. Also, omit the preview if we don't have an
// expression. // expression.
has_tooltip <- model.output.frp.tooltip.map(|tt| tt.has_content()); has_tooltip <- model.output.frp.tooltip.map(|tt| tt.has_content());

View File

@ -1,12 +1,12 @@
//! This module defines the `Container` struct and related functionality. This represent the view //! This module defines the `Container` struct and related functionality. This represent the view
//! a visualisation in the graph editor and includes a visual box that contains the visualisation, //! a visualization in the graph editor and includes a visual box that contains the visualization,
//! and action bar that allows setting the visualisation type. //! and action bar that allows setting the visualization type.
//! //!
//! The `[Container]` struct is responsible for managing the visualisation and action bar and //! The `[Container]` struct is responsible for managing the visualization and action bar and
//! providing a unified interface to the graph editor. This includes ensuring that the visualisation //! providing a unified interface to the graph editor. This includes ensuring that the visualization
//! is correctly positioned, sized and layouted in its different [ViewState]s (which include the //! is correctly positioned, sized and layouted in its different [ViewState]s (which include the
//! `Enabled`, `Fullscreen` and `Preview` states). Importantly, this also includes EnsoGL layer //! `Enabled`, `Fullscreen` and `Preview` states). Importantly, this also includes EnsoGL layer
//! management to ensure correct occlusion of the visualisation with respect to other scene objects. //! management to ensure correct occlusion of the visualization with respect to other scene objects.
// FIXME There is a serious performance problem in this implementation. It assumes that the // FIXME There is a serious performance problem in this implementation. It assumes that the
// FIXME visualization is a child of the container. However, this is very inefficient. Consider a // FIXME visualization is a child of the container. However, this is very inefficient. Consider a
@ -53,7 +53,7 @@ pub mod visualization_chooser;
// === Constants === // === Constants ===
// ================= // =================
/// Default width and height of the visualisation container. /// Default width and height of the visualization container.
pub const DEFAULT_SIZE: (f32, f32) = (200.0, 200.0); pub const DEFAULT_SIZE: (f32, f32) = (200.0, 200.0);
const PADDING: f32 = 20.0; const PADDING: f32 = 20.0;
const CORNER_RADIUS: f32 = super::super::node::CORNER_RADIUS; const CORNER_RADIUS: f32 = super::super::node::CORNER_RADIUS;
@ -65,7 +65,7 @@ const ACTION_BAR_HEIGHT: f32 = 2.0 * CORNER_RADIUS;
// === Shape === // === Shape ===
// ============= // =============
/// Container overlay shape definition. Used to capture events over the visualisation within the /// Container overlay shape definition. Used to capture events over the visualization within the
/// container. /// container.
pub mod overlay { pub mod overlay {
use super::*; use super::*;
@ -134,32 +134,32 @@ pub mod background {
// === Frp === // === Frp ===
// =========== // ===========
/// Indicates the visibility state of the visualisation. /// Indicates the visibility state of the visualization.
#[derive(Clone, Copy, Debug, PartialEq, Derivative)] #[derive(Clone, Copy, Debug, PartialEq, Derivative)]
#[derivative(Default)] #[derivative(Default)]
pub enum ViewState { pub enum ViewState {
/// Visualisation is permanently enabled and visible in the graph editor. It is attached to a /// Visualization is permanently enabled and visible in the graph editor. It is attached to a
/// single node and can be moved and interacted with when selected. /// single node and can be moved and interacted with when selected.
Enabled, Enabled,
/// Visualisation is disabled and hidden in the graph editor. /// Visualization is disabled and hidden in the graph editor.
#[derivative(Default)] #[derivative(Default)]
Disabled, Disabled,
/// Visualisation is temporarily enabled and visible in the graph editor. It should be placed /// Visualization is temporarily enabled and visible in the graph editor. It should be placed
/// above other scene elements to allow quick inspection. /// above other scene elements to allow quick inspection.
Preview, Preview,
/// Visualisation is enabled and visible in the graph editor in fullscreen mode. It occludes /// Visualization is enabled and visible in the graph editor in fullscreen mode. It occludes
/// the whole graph and can be interacted with. /// the whole graph and can be interacted with.
Fullscreen, Fullscreen,
} }
impl ViewState { impl ViewState {
/// Indicates whether the visualisation is visible in the graph editor. It is always visible /// Indicates whether the visualization is visible in the graph editor. It is always visible
/// when not disabled. /// when not disabled.
pub fn is_visible(&self) -> bool { pub fn is_visible(&self) -> bool {
!matches!(self, ViewState::Disabled) !matches!(self, ViewState::Disabled)
} }
/// Indicates whether the visualisation is fullscreen mode. /// Indicates whether the visualization is fullscreen mode.
pub fn is_fullscreen(&self) -> bool { pub fn is_fullscreen(&self) -> bool {
matches!(self, ViewState::Fullscreen) matches!(self, ViewState::Fullscreen)
} }
@ -179,7 +179,7 @@ ensogl::define_endpoints_2! {
} }
Output { Output {
preprocessor (PreprocessorConfiguration), preprocessor (PreprocessorConfiguration),
visualisation (Option<visualization::Definition>), visualization (Option<visualization::Definition>),
visualization_path (Option<visualization::Path>), visualization_path (Option<visualization::Path>),
size (Vector2), size (Vector2),
is_selected (bool), is_selected (bool),
@ -304,7 +304,7 @@ impl display::Object for View {
#[allow(missing_docs)] #[allow(missing_docs)]
pub struct ContainerModel { pub struct ContainerModel {
display_object: display::object::Instance, display_object: display::object::Instance,
/// Internal root for all sub-objects. Will be moved when the visualisation /// Internal root for all sub-objects. Will be moved when the visualization
/// container position is changed by dragging. /// container position is changed by dragging.
drag_root: display::object::Instance, drag_root: display::object::Instance,
visualization: RefCell<Option<visualization::Instance>>, visualization: RefCell<Option<visualization::Instance>>,
@ -569,28 +569,28 @@ impl Container {
output.visible <+ output.view_state.map(|state| state.is_visible()).on_change(); output.visible <+ output.view_state.map(|state| state.is_visible()).on_change();
output.size <+ input.set_size.on_change(); output.size <+ input.set_size.on_change();
visualisation_not_selected <- input.set_visualization.map(|t| t.is_none()); visualization_not_selected <- input.set_visualization.map(|t| t.is_none());
input_type_not_set <- input.set_vis_input_type.is_some().not(); input_type_not_set <- input.set_vis_input_type.is_some().not();
uninitialised <- visualisation_not_selected && input_type_not_set; uninitialised <- visualization_not_selected && input_type_not_set;
set_default_visualisation <- uninitialised.on_change().on_true().map(|_| { set_default_visualization <- uninitialised.on_change().on_true().map(|_| {
Some(visualization::Registry::default_visualisation()) Some(visualization::Registry::default_visualization())
}); });
vis_input_type_changed <- input.set_vis_input_type.on_change(); vis_input_type_changed <- input.set_vis_input_type.on_change();
vis_input_type_changed_without_selection <- vis_input_type_changed_without_selection <-
vis_input_type_changed.gate(&visualisation_not_selected).unwrap(); vis_input_type_changed.gate(&visualization_not_selected).unwrap();
set_default_visualisation_for_type <- vis_input_type_changed_without_selection.map(f!((tp) { set_default_visualization_for_type <- vis_input_type_changed_without_selection.map(f!((tp) {
registry.default_visualization_for_type(tp) registry.default_visualization_for_type(tp)
})); }));
set_default_visualisation <- any( set_default_visualization <- any(
&set_default_visualisation, &set_default_visualisation_for_type); &set_default_visualization, &set_default_visualization_for_type);
} }
// === Visualisation Chooser Bindings === // === Visualization Chooser Bindings ===
frp::extend! { network frp::extend! { network
selected_definition <- action_bar.visualisation_selection.map(f!([registry](path) selected_definition <- action_bar.visualization_selection.map(f!([registry](path)
path.as_ref().and_then(|path| registry.definition_from_path(path)) path.as_ref().and_then(|path| registry.definition_from_path(path))
)); ));
action_bar.hide_icons <+ selected_definition.constant(()); action_bar.hide_icons <+ selected_definition.constant(());
@ -603,7 +603,7 @@ impl Container {
// === Cycling Visualizations === // === Cycling Visualizations ===
frp::extend! { network frp::extend! { network
vis_after_cycling <- input.cycle_visualization.map3(&output.visualisation, &output.vis_input_type, vis_after_cycling <- input.cycle_visualization.map3(&output.visualization, &output.vis_input_type,
f!(((),vis,input_type) model.next_visualization(vis,input_type)) f!(((),vis,input_type) model.next_visualization(vis,input_type))
); );
} }
@ -616,10 +616,10 @@ impl Container {
input.set_visualization, input.set_visualization,
selected_definition, selected_definition,
vis_after_cycling, vis_after_cycling,
set_default_visualisation); set_default_visualization);
new_vis_definition <- vis_definition_set.on_change(); new_vis_definition <- vis_definition_set.on_change();
let preprocessor = &output.preprocessor; let preprocessor = &output.preprocessor;
output.visualisation <+ new_vis_definition.map2(&output.view_state, f!( output.visualization <+ new_vis_definition.map2(&output.view_state, f!(
[model,action_bar,app,preprocessor](vis_definition, view_state) { [model,action_bar,app,preprocessor](vis_definition, view_state) {
if let Some(definition) = vis_definition { if let Some(definition) = vis_definition {
@ -637,15 +637,15 @@ impl Container {
vis_definition.clone() vis_definition.clone()
})); }));
output.visualization_path <+ output.visualisation.map(|definition| { output.visualization_path <+ output.visualization.map(|definition| {
definition.as_ref().map(|def| def.signature.path.clone_ref()) definition.as_ref().map(|def| def.signature.path.clone_ref())
}); });
} }
// === Visualisation Loading Spinner === // === Visualization Loading Spinner ===
frp::extend! { network frp::extend! { network
eval_ output.visualisation ( model.view.show_waiting_screen() ); eval_ output.visualization ( model.view.show_waiting_screen() );
eval_ input.set_data ( model.view.disable_waiting_screen() ); eval_ input.set_data ( model.view.disable_waiting_screen() );
} }

View File

@ -239,7 +239,7 @@ ensogl::define_endpoints! {
} }
Output { Output {
visualisation_selection (Option<visualization::Path>), visualization_selection (Option<visualization::Path>),
mouse_over (), mouse_over (),
mouse_out (), mouse_out (),
on_container_reset_position (), on_container_reset_position (),
@ -333,7 +333,7 @@ impl display::Object for Model {
// ================== // ==================
/// UI for executing actions on a node. Consists of label indicating the active visualization /// UI for executing actions on a node. Consists of label indicating the active visualization
/// and a drop-down menu for selecting a new visualisation. /// and a drop-down menu for selecting a new visualization.
/// ///
/// Layout /// Layout
/// ------ /// ------
@ -391,10 +391,10 @@ impl ActionBar {
hide <- any(mouse_out_no_menu,remote_click); hide <- any(mouse_out_no_menu,remote_click);
eval_ hide (model.hide()); eval_ hide (model.hide());
// The action bar does not allow to deselect the visualisation, so we prohibit these // The action bar does not allow to deselect the visualization, so we prohibit these
// events, which can occur on re-initialization. // events, which can occur on re-initialization.
has_selection <- visualization_chooser.chosen_entry.is_some(); has_selection <- visualization_chooser.chosen_entry.is_some();
frp.source.visualisation_selection frp.source.visualization_selection
<+ visualization_chooser.chosen_entry.gate(&has_selection); <+ visualization_chooser.chosen_entry.gate(&has_selection);
let reset_position_icon = &model.icons.reset_position_icon.events_deprecated; let reset_position_icon = &model.icons.reset_position_icon.events_deprecated;
@ -411,7 +411,7 @@ impl ActionBar {
eval show_reset_icon((visibility) model.icons.set_reset_icon_visibility(*visibility)); eval show_reset_icon((visibility) model.icons.set_reset_icon_visibility(*visibility));
// === Visualisation Chooser === // === Visualization Chooser ===
// Note: we only want to update the chooser if it is visible, or when it becomes // Note: we only want to update the chooser if it is visible, or when it becomes
// visible. During startup we get the type information for every node, and propagate // visible. During startup we get the type information for every node, and propagate

View File

@ -1,4 +1,4 @@
//! UI entity that allows for the selection of a visualisation. Uses the //! UI entity that allows for the selection of a visualization. Uses the
//! `drop_down_menu::DropDownMenu` but provides convenience functionality to extract map the //! `drop_down_menu::DropDownMenu` but provides convenience functionality to extract map the
//! indices of the `DropDownMenu` to `Path` values. //! indices of the `DropDownMenu` to `Path` values.
//! //!
@ -83,10 +83,10 @@ impl display::Object for Model {
// ============================ // ============================
// === VisualisationChooser === // === VisualizationChooser ===
// ============================ // ============================
/// UI entity that shows a button that opens a list of visualisations that can be selected from. /// UI entity that shows a button that opens a list of visualizations that can be selected from.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Clone, CloneRef, Debug)] #[derive(Clone, CloneRef, Debug)]
pub struct VisualizationChooser { pub struct VisualizationChooser {
@ -122,7 +122,7 @@ impl VisualizationChooser {
entries.iter().position(|item| item == s) entries.iter().position(|item| item == s)
); );
if selected.is_some() && selected_ix.is_none() { if selected.is_some() && selected_ix.is_none() {
warn!("Invalid visualisation selected {selected:?} from available {entries:?}"); warn!("Invalid visualization selected {selected:?} from available {entries:?}");
}; };
selected_ix selected_ix
}); });
@ -146,7 +146,7 @@ impl VisualizationChooser {
if let Some(entry) = entry{ if let Some(entry) = entry{
let event = "graph_editor::visualization_chooser::vis_selected"; let event = "graph_editor::visualization_chooser::vis_selected";
let name:&str = entry.name.as_ref(); let name:&str = entry.name.as_ref();
let field = "visualisation_name"; let field = "visualization_name";
let data = analytics::AnonymousData(|| name.to_string()); let data = analytics::AnonymousData(|| name.to_string());
analytics::remote_log_value(event,field,data); analytics::remote_log_value(event,field,data);
} }

View File

@ -51,7 +51,7 @@ impl Json {
// === Data Format === // === Data Format ===
// ==================== // ====================
/// Data formats that can be used in a visualisation. /// Data formats that can be used in a visualization.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum Format { pub enum Format {

View File

@ -98,7 +98,7 @@ pub type InstantiationResult = Result<visualization::Instance, InstantiationErro
// === Errors === // === Errors ===
/// Indicates that instantiating a `Visualisation` from a `Definition` has failed. /// Indicates that instantiating a `Visualization` from a `Definition` has failed.
#[derive(Debug)] #[derive(Debug)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum InstantiationError { pub enum InstantiationError {
@ -109,7 +109,7 @@ impl Display for InstantiationError {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self { match self {
InstantiationError::ConstructorError(value) => f.write_fmt(format_args!( InstantiationError::ConstructorError(value) => f.write_fmt(format_args!(
"Could not construct visualisation because of error: {value:?}" "Could not construct visualization because of error: {value:?}"
)), )),
} }
} }

View File

@ -207,7 +207,7 @@ impl JsConsArgs {
self.theme.clone() self.theme.clone()
} }
/// Helper method to emit an preprocessor change event from the visualisation. /// Helper method to emit an preprocessor change event from the visualization.
pub fn emit_preprocessor_change( pub fn emit_preprocessor_change(
&self, &self,
module: Option<String>, module: Option<String>,

View File

@ -118,7 +118,7 @@ impl InstanceModel {
Ok(root_node) Ok(root_node)
} }
/// We need to provide a closure to the Visualisation on the JS side, which we then later /// We need to provide a closure to the Visualization on the JS side, which we then later
/// can hook up to the FRP. Here we create a `PreprocessorCallbackCell`, which can hold a /// can hook up to the FRP. Here we create a `PreprocessorCallbackCell`, which can hold a
/// closure, and a `PreprocessorCallback` which holds a weak reference to the closure inside of /// closure, and a `PreprocessorCallback` which holds a weak reference to the closure inside of
/// the `PreprocessorCallbackCell`. This allows us to pass the `PreprocessorCallback` to the /// the `PreprocessorCallbackCell`. This allows us to pass the `PreprocessorCallback` to the
@ -161,7 +161,7 @@ impl InstanceModel {
Ok(java_script::binding::Visualization::new()) Ok(java_script::binding::Visualization::new())
} }
/// Tries to create a InstanceModel from the given visualisation class. /// Tries to create a InstanceModel from the given visualization class.
pub fn from_class(class: &JsValue, scene: &Scene) -> result::Result<Self, Error> { pub fn from_class(class: &JsValue, scene: &Scene) -> result::Result<Self, Error> {
let root_node = Self::create_root(scene)?; let root_node = Self::create_root(scene)?;
let (preprocessor_change, closure) = Self::preprocessor_change_callback(); let (preprocessor_change, closure) = Self::preprocessor_change_callback();

View File

@ -1,4 +1,4 @@
//! Functionality that allows one to manage occlusion/layers of visualisations in the scene. //! Functionality that allows one to manage occlusion/layers of visualizations in the scene.
use ensogl::display::DomSymbol; use ensogl::display::DomSymbol;
use ensogl::display::Scene; use ensogl::display::Scene;
@ -9,14 +9,14 @@ use ensogl::display::Scene;
// === Layer === // === Layer ===
// ============= // =============
/// Indicates where the visualisation should be displayed. /// Indicates where the visualization should be displayed.
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Layer { pub enum Layer {
/// Display the visualisation as part of the scene. /// Display the visualization as part of the scene.
Default, Default,
/// Display the visualisation over the scene. /// Display the visualization over the scene.
Front, Front,
/// Display the visualisation in fullscreen mode. /// Display the visualization in fullscreen mode.
Fullscreen, Fullscreen,
} }

View File

@ -82,7 +82,7 @@ impl Registry {
&self, &self,
tp: &enso::Type, tp: &enso::Type,
) -> Option<visualization::Definition> { ) -> Option<visualization::Definition> {
// TODO[MM]: Visualisations are order by "matching the type" first, followed by and then // TODO[MM]: Visualizations are order by "matching the type" first, followed by and then
// "matching any type". So we just take the first one, which should be the most appropriate // "matching any type". So we just take the first one, which should be the most appropriate
// one. This should be replaced with the proper solution described in // one. This should be replaced with the proper solution described in
// https://github.com/enso-org/enso/issues/5195 // https://github.com/enso-org/enso/issues/5195
@ -106,10 +106,10 @@ impl Registry {
/// Add default visualizations to the registry. /// Add default visualizations to the registry.
pub fn add_default_visualizations(&self) { pub fn add_default_visualizations(&self) {
// Note that the order is important. Visualisations that are added first will be // Note that the order is important. Visualizations that are added first will be
// prioritised as default (as long as they have a matching type to the value they will // prioritised as default (as long as they have a matching type to the value they will
// represent. // represent.
self.add(builtin::visualization::native::text_visualization::text_visualisation()); self.add(builtin::visualization::native::text_visualization::text_visualization());
self.try_add_java_script(builtin::visualization::java_script::table_visualization()); self.try_add_java_script(builtin::visualization::java_script::table_visualization());
self.try_add_java_script(builtin::visualization::java_script::scatter_plot_visualization()); self.try_add_java_script(builtin::visualization::java_script::scatter_plot_visualization());
self.try_add_java_script(builtin::visualization::java_script::histogram_visualization()); self.try_add_java_script(builtin::visualization::java_script::histogram_visualization());
@ -120,9 +120,9 @@ impl Registry {
self.try_add_java_script(builtin::visualization::java_script::warnings_visualization()); self.try_add_java_script(builtin::visualization::java_script::warnings_visualization());
} }
/// Return a default visualisation definition. /// Return a default visualization definition.
pub fn default_visualisation() -> visualization::Definition { pub fn default_visualization() -> visualization::Definition {
builtin::visualization::native::text_visualization::text_visualisation() builtin::visualization::native::text_visualization::text_visualization()
} }
} }
@ -145,7 +145,7 @@ mod tests {
} }
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn assert_no_duplicate_default_visualisations() { fn assert_no_duplicate_default_visualizations() {
let registry = Registry::new(); let registry = Registry::new();
registry.add_default_visualizations(); registry.add_default_visualizations();

View File

@ -589,8 +589,8 @@ ensogl::define_endpoints_2! {
// === Scene Navigation === // === Scene Navigation ===
/// Stop the scene camera from moving around, locking the scene in place. /// Stop the scene camera from moving around, locking the scene in place.
/// Can be used, e.g., if there is a fullscreen visualisation active, or navigation should /// Can be used, e.g., if there is a fullscreen visualization active, or navigation should
///only work for a selected visualisation. ///only work for a selected visualization.
set_navigator_disabled(bool), set_navigator_disabled(bool),
@ -655,9 +655,9 @@ ensogl::define_endpoints_2! {
reset_visualization_registry (), reset_visualization_registry (),
/// Reload visualization registry /// Reload visualization registry
reload_visualization_registry(), reload_visualization_registry(),
/// Show visualisation previews on nodes without delay. /// Show visualization previews on nodes without delay.
enable_quick_visualization_preview(), enable_quick_visualization_preview(),
/// Show visualisation previews on nodes with delay. /// Show visualization previews on nodes with delay.
disable_quick_visualization_preview(), disable_quick_visualization_preview(),
/// Drop an edge that is being dragged. /// Drop an edge that is being dragged.
@ -720,7 +720,7 @@ ensogl::define_endpoints_2! {
visualization_update_error ((NodeId, String)), visualization_update_error ((NodeId, String)),
on_visualization_select (Switch<NodeId>), on_visualization_select (Switch<NodeId>),
some_visualisation_selected (bool), some_visualization_selected (bool),
navigator_active (bool), navigator_active (bool),
widgets_requested (NodeId, ast::Id, ast::Id), widgets_requested (NodeId, ast::Id, ast::Id),
@ -1458,15 +1458,15 @@ struct Edges {
} }
#[derive(Debug, Clone, CloneRef, Default)] #[derive(Debug, Clone, CloneRef, Default)]
struct Visualisations { struct Visualizations {
/// This keeps track of the currently selected visualisation. There should only ever be one /// This keeps track of the currently selected visualization. There should only ever be one
/// visualisations selected, however due to the way that the selection is determined, it can /// visualizations selected, however due to the way that the selection is determined, it can
/// happen that while the FRP is resolved, temporarily, we have multiple visualisation in this /// happen that while the FRP is resolved, temporarily, we have multiple visualization in this
/// set. This happens because the selection status is determined bottom up from each /// set. This happens because the selection status is determined bottom up from each
/// visualisation and the reported via FRP to the graph editor. That means if the status /// visualization and the reported via FRP to the graph editor. That means if the status
/// we might see the new selection status for a visualisation getting set before we see the /// we might see the new selection status for a visualization getting set before we see the
/// previously selected visualisation report its deselection. If we ever have more than one /// previously selected visualization report its deselection. If we ever have more than one
/// visualisation in this set after the status updates have been resolved, that is a bug. /// visualization in this set after the status updates have been resolved, that is a bug.
selected: SharedHashSet<NodeId>, selected: SharedHashSet<NodeId>,
} }
@ -1776,9 +1776,9 @@ impl GraphEditorModel {
// === Visualizations === // === Visualizations ===
let visualisation = node.visualization(); let visualization = node.visualization();
visualization_shown <- visualisation.visible.on_true(); visualization_shown <- visualization.visible.on_true();
visualization_hidden <- visualisation.visible.on_false(); visualization_hidden <- visualization.visible.on_false();
let vis_is_selected = node_model.visualization.frp.is_selected.clone_ref(); let vis_is_selected = node_model.visualization.frp.is_selected.clone_ref();
@ -1797,10 +1797,10 @@ impl GraphEditorModel {
metadata <- any(...); metadata <- any(...);
metadata <+ node_model.visualization.frp.preprocessor.map(visualization::Metadata::new); metadata <+ node_model.visualization.frp.preprocessor.map(visualization::Metadata::new);
// Ensure the graph editor knows about internal changes to the visualisation. If the // Ensure the graph editor knows about internal changes to the visualization. If the
// visualisation changes that should indicate that the old one has been disabled and a // visualization changes that should indicate that the old one has been disabled and a
// new one has been enabled. // new one has been enabled.
// TODO: Create a better API for updating the controller about visualisation changes // TODO: Create a better API for updating the controller about visualization changes
// (see #896) // (see #896)
out.visualization_hidden <+ visualization_hidden.constant(node_id); out.visualization_hidden <+ visualization_hidden.constant(node_id);
out.visualization_shown <+ out.visualization_shown <+
@ -1808,7 +1808,7 @@ impl GraphEditorModel {
init <- source::<()>(); init <- source::<()>();
enabled_visualization_path <- init.all_with3( enabled_visualization_path <- init.all_with3(
&visualisation.visible, &visualisation.visualization_path, &visualization.visible, &visualization.visualization_path,
move |_init, is_enabled, path| (node_id, is_enabled.and_option(path.clone())) move |_init, is_enabled, path| (node_id, is_enabled.and_option(path.clone()))
); );
out.enabled_visualization_path <+ enabled_visualization_path; out.enabled_visualization_path <+ enabled_visualization_path;
@ -1866,7 +1866,7 @@ pub struct GraphEditorModel {
pub add_node_button: Rc<component::add_node_button::AddNodeButton>, pub add_node_button: Rc<component::add_node_button::AddNodeButton>,
tooltip: Tooltip, tooltip: Tooltip,
touch_state: TouchState, touch_state: TouchState,
visualisations: Visualisations, visualizations: Visualizations,
frp: api::Private, frp: api::Private,
frp_public: api::Public, frp_public: api::Public,
profiling_statuses: profiling::Statuses, profiling_statuses: profiling::Statuses,
@ -1889,7 +1889,7 @@ impl GraphEditorModel {
let nodes = Nodes::new(); let nodes = Nodes::new();
let edges = RefCell::new(Edges::default()); let edges = RefCell::new(Edges::default());
let vis_registry = visualization::Registry::with_default_visualizations(); let vis_registry = visualization::Registry::with_default_visualizations();
let visualisations = default(); let visualizations = default();
let touch_state = TouchState::new(network, scene); let touch_state = TouchState::new(network, scene);
let breadcrumbs = component::Breadcrumbs::new(app.clone_ref()); let breadcrumbs = component::Breadcrumbs::new(app.clone_ref());
let execution_environment_selector = let execution_environment_selector =
@ -1922,7 +1922,7 @@ impl GraphEditorModel {
drop_manager, drop_manager,
tooltip, tooltip,
touch_state, touch_state,
visualisations, visualizations,
navigator, navigator,
profiling_statuses, profiling_statuses,
add_node_button, add_node_button,
@ -2911,7 +2911,7 @@ fn init_remaining_graph_editor_frp(
// ======================== // ========================
frp::extend! { network frp::extend! { network
navigator_disabled <- out.some_visualisation_selected.or(&inputs.set_navigator_disabled); navigator_disabled <- out.some_visualization_selected.or(&inputs.set_navigator_disabled);
model.navigator.frp.set_enabled <+ navigator_disabled.not(); model.navigator.frp.set_enabled <+ navigator_disabled.not();
out.navigator_active <+ model.navigator.frp.enabled; out.navigator_active <+ model.navigator.frp.enabled;
} }
@ -3281,14 +3281,14 @@ fn init_remaining_graph_editor_frp(
frp::extend! { network frp::extend! { network
eval out.on_visualization_select ([model](switch) { eval out.on_visualization_select ([model](switch) {
if switch.is_on() { if switch.is_on() {
model.visualisations.selected.insert(switch.value); model.visualizations.selected.insert(switch.value);
} else { } else {
model.visualisations.selected.remove(&switch.value); model.visualizations.selected.remove(&switch.value);
} }
}); });
out.some_visualisation_selected <+ out.on_visualization_select.map(f_!([model] { out.some_visualization_selected <+ out.on_visualization_select.map(f_!([model] {
!model.visualisations.selected.is_empty() !model.visualizations.selected.is_empty()
})); }));
}; };
@ -3339,7 +3339,7 @@ fn init_remaining_graph_editor_frp(
// it was a key hold and we want to enter preview mode. // it was a key hold and we want to enter preview mode.
let long_enough = diff > VIZ_PREVIEW_MODE_TOGGLE_TIME_MS; let long_enough = diff > VIZ_PREVIEW_MODE_TOGGLE_TIME_MS;
// We also check the number of passed frames, since the time measure can be misleading, if // We also check the number of passed frames, since the time measure can be misleading, if
// there were dropped frames. The visualisation might have just appeared while more than // there were dropped frames. The visualization might have just appeared while more than
// the threshold time has passed. // the threshold time has passed.
let enough_frames = if let Some(counter) = counter { let enough_frames = if let Some(counter) = counter {
let frames = counter.frames_since_start(); let frames = counter.frames_since_start();
@ -3477,9 +3477,9 @@ fn init_remaining_graph_editor_frp(
eval selection_controller.area_selection ((area_selection) model.nodes.show_quick_actions(!area_selection)); eval selection_controller.area_selection ((area_selection) model.nodes.show_quick_actions(!area_selection));
} }
// === Visualisation + Selection === // === Visualization + Selection ===
// Do not allow area selection while we show a fullscreen visualisation. // Do not allow area selection while we show a fullscreen visualization.
frp::extend! { network frp::extend! { network
allow_area_selection <- out.is_fs_visualization_displayed.not(); allow_area_selection <- out.is_fs_visualization_displayed.not();
eval allow_area_selection ((area_selection) eval allow_area_selection ((area_selection)

View File

@ -6,8 +6,8 @@ from Standard.Table import Table, Column
import Standard.Table.Data.Row.Row import Standard.Table.Data.Row.Row
import project.Id.Id import project.Id.Id
from project.Text import get_lazy_visualisation_text_window from project.Text import get_lazy_visualization_text_window
import project.Table as Table_Visualisation import project.Table as Table_Visualization
## PRIVATE ## PRIVATE
Specifies that the builtin JSON visualization should be used for any type, Specifies that the builtin JSON visualization should be used for any type,
@ -220,37 +220,37 @@ Column.is_numeric self =
self.value_type.is_numeric self.value_type.is_numeric
## PRIVATE ## PRIVATE
Returns the data requested to render a lazy view of the default visualisation. Decides Returns the data requested to render a lazy view of the default visualization. Decides
whether to return a simplified version of the lazy data format. whether to return a simplified version of the lazy data format.
make_lazy_visualisation_data : Text -> Vector Integer -> Vector Integer -> Integer -> Text make_lazy_visualization_data : Text -> Vector Integer -> Vector Integer -> Integer -> Text
make_lazy_visualisation_data text text_window_position text_window_size chunk_size = make_lazy_visualization_data text text_window_position text_window_size chunk_size =
min_length_for_laziness = chunk_size * (text_window_size.first) * (text_window_size.second) min_length_for_laziness = chunk_size * (text_window_size.first) * (text_window_size.second)
if text.length < min_length_for_laziness then text else if text.length < min_length_for_laziness then text else
get_lazy_visualisation_text_window text text_window_position text_window_size chunk_size get_lazy_visualization_text_window text text_window_position text_window_size chunk_size
## PRIVATE ## PRIVATE
Returns the data requested to render a lazy view of the default visualisation. Returns the data requested to render a lazy view of the default visualization.
Any.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Integer -> Text Any.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Integer -> Text
Any.to_lazy_visualization_data self text_window_position text_window_size chunk_size = Any.to_lazy_visualization_data self text_window_position text_window_size chunk_size =
## Workaround so that the JS String is converted to a Text ## Workaround so that the JS String is converted to a Text
https://www.pivotaltracker.com/story/show/184061302 https://www.pivotaltracker.com/story/show/184061302
"" + make_lazy_visualisation_data self.to_default_visualization_data text_window_position text_window_size chunk_size "" + make_lazy_visualization_data self.to_default_visualization_data text_window_position text_window_size chunk_size
## PRIVATE ## PRIVATE
Returns the data requested to render a lazy view of the default visualisation. Returns the data requested to render a lazy view of the default visualization.
Text.to_default_visualization_data : Text Text.to_default_visualization_data : Text
Text.to_default_visualization_data self = Text.to_default_visualization_data self =
self.to_lazy_visualization_data [0,0] [10,10] 20 self.to_lazy_visualization_data [0,0] [10,10] 20
## PRIVATE ## PRIVATE
Returns the data requested to render a lazy view of the default visualisation. Returns the data requested to render a lazy view of the default visualization.
Text.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Integer -> Text Text.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Integer -> Text
Text.to_lazy_visualization_data self text_window_position text_window_size chunk_size = Text.to_lazy_visualization_data self text_window_position text_window_size chunk_size =
min_length_for_laziness = chunk_size * (text_window_size.first) * (text_window_size.second) min_length_for_laziness = chunk_size * (text_window_size.first) * (text_window_size.second)
if self.length < min_length_for_laziness then "" + self.to_json else if self.length < min_length_for_laziness then "" + self.to_json else
## Workaround so that the JS String is converted to a Text ## Workaround so that the JS String is converted to a Text
https://www.pivotaltracker.com/story/show/184061302 https://www.pivotaltracker.com/story/show/184061302
"" + get_lazy_visualisation_text_window self text_window_position text_window_size chunk_size "" + get_lazy_visualization_text_window self text_window_position text_window_size chunk_size
## PRIVATE ## PRIVATE
Shows a JSON serialization of a truncated version of this column, for the Shows a JSON serialization of a truncated version of this column, for the
@ -279,7 +279,7 @@ Row.to_default_visualization_data self =
self.to_vector.to_default_visualization_data self.to_vector.to_default_visualization_data
## PRIVATE ## PRIVATE
Returns the data requested to render a lazy view of the default visualisation. Returns the data requested to render a lazy view of the default visualization.
Table.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text Table.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text
Table.to_lazy_visualization_data self table_cell_position text_window_position text_window_size chunk_size = Table.to_lazy_visualization_data self table_cell_position text_window_position text_window_size chunk_size =
Table_Visualisation.get_lazy_visualisation_data self table_cell_position text_window_position text_window_size chunk_size Table_Visualization.get_lazy_visualization_data self table_cell_position text_window_position text_window_size chunk_size

View File

@ -10,7 +10,7 @@ import project.Helpers
Prepares the database table for visualization. Prepares the database table for visualization.
Arguments: Arguments:
- x: The database table to prepare for visualisation. - x: The database table to prepare for visualization.
For each interpolation it provides its value, its actual type name, its For each interpolation it provides its value, its actual type name, its
expected SQL type name and if it was possible to infer it, its expected Enso expected SQL type name and if it was possible to infer it, its expected Enso

View File

@ -39,15 +39,15 @@ type Table_Update
Return a sub-window of a table. The window is defined by a cell row/col and line/chunk Return a sub-window of a table. The window is defined by a cell row/col and line/chunk
coordinate as origin and the extent of the window in text chunks and lines. The size of coordinate as origin and the extent of the window in text chunks and lines. The size of
a chunk (the characters in it) is defined by `chunk_width`. The output is formatted as a message a chunk (the characters in it) is defined by `chunk_width`. The output is formatted as a message
that can be sent to the IDE's lazy text visualisation. that can be sent to the IDE's lazy text visualization.
get_lazy_visualisation_data : Table_Module.Table -> Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text get_lazy_visualization_data : Table_Module.Table -> Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text
get_lazy_visualisation_data table table_cell_position text_window_position text_window_size chunk_size = get_lazy_visualization_data table table_cell_position text_window_position text_window_size chunk_size =
update = compute_table_update table table_cell_position text_window_position text_window_size chunk_size update = compute_table_update table table_cell_position text_window_position text_window_size chunk_size
update.to_json update.to_json
## PRIVATE ## PRIVATE
Compute the table visualisation update. The table update contains information about the table Compute the table visualization update. The table update contains information about the table
layout and the table content. layout and the table content.
compute_table_update table table_cell_position text_window_position text_window_size chunk_size = compute_table_update table table_cell_position text_window_position text_window_size chunk_size =
text_window_width = text_window_size.get 0 text_window_width = text_window_size.get 0

View File

@ -16,7 +16,7 @@ import project.Helpers
Prepares a table or column for visualization. Prepares a table or column for visualization.
Arguments: Arguments:
- x: The table to prepare for visualisation. - x: The table to prepare for visualization.
- max_rows: The maximum number of rows to display. - max_rows: The maximum number of rows to display.
In case of Database backed data, it materializes a fragment of the data. In case of Database backed data, it materializes a fragment of the data.

View File

@ -19,8 +19,8 @@ type Message
## PRIVATE ## PRIVATE
Return a sub-window of a string. The window is defined by line/chunk coordinates. The size of Return a sub-window of a string. The window is defined by line/chunk coordinates. The size of
a chunk is defined by `chunk_width`. The output is formatted as a message that can be sent to a chunk is defined by `chunk_width`. The output is formatted as a message that can be sent to
the IDE's lazy text visualisation. the IDE's lazy text visualization.
get_lazy_visualisation_text_window text pos size chunk_width = get_lazy_visualization_text_window text pos size chunk_width =
get_text_chunk = get_item_from text chunk_width get_text_chunk = get_item_from text chunk_width
lines = text.lines.length lines = text.lines.length
pos_x = Math.max pos.first 0 pos_x = Math.max pos.first 0
@ -33,11 +33,11 @@ get_lazy_visualisation_text_window text pos size chunk_width =
chunks = coordinates.map (ix -> [ix, (get_text_chunk ix)]) chunks = coordinates.map (ix -> [ix, (get_text_chunk ix)])
active_lines = y_range.map text.lines.at active_lines = y_range.map text.lines.at
max_line_length = (active_lines.map (line -> line.length)).fold 0 (l -> r -> Math.max l r) max_line_length = (active_lines.map (line -> line.length)).fold 0 (l -> r -> Math.max l r)
make_grid_visualisation_response chunks lines max_line_length make_grid_visualization_response chunks lines max_line_length
## PRIVATE ## PRIVATE
Format a chunk of text and meta information for the lazy visualisation. Format a chunk of text and meta information for the lazy visualization.
make_grid_visualisation_response chunks lines max_line_length = make_grid_visualization_response chunks lines max_line_length =
message = Message.Value chunks lines max_line_length message = Message.Value chunks lines max_line_length
message.to_json + "" message.to_json + ""

View File

@ -799,7 +799,7 @@ Below are options uses by the Language Server:
Default value is 127.0.0.1 Default value is 127.0.0.1
- `--rpc-port <port>`: RPC port for processing all incoming connections. Default - `--rpc-port <port>`: RPC port for processing all incoming connections. Default
value is 8080. value is 8080.
- `--data-port <port>`: Data port for visualisation protocol. Default value - `--data-port <port>`: Data port for visualization protocol. Default value
is 8081. is 8081.
To run the Language Server on 127.0.0.1:8080 type: To run the Language Server on 127.0.0.1:8080 type:

View File

@ -143,7 +143,7 @@ domain requires a highly tailored toolbox for working with such data, and Enso
provides a coherent and unified foundation for building such toolboxes, on top provides a coherent and unified foundation for building such toolboxes, on top
of a growing library of existing ones. At its core, Enso delivers a powerful of a growing library of existing ones. At its core, Enso delivers a powerful
environment for the modelling of data flows, with extensive inbuilt capabilities environment for the modelling of data flows, with extensive inbuilt capabilities
for data visualisation and manipulation. for data visualization and manipulation.
## Tenets of Enso ## Tenets of Enso
@ -162,7 +162,7 @@ the cognitive load for users. They are elucidated below
- **Unified Syntax:** The language syntax should be simple, concise, and be - **Unified Syntax:** The language syntax should be simple, concise, and be
usable on both the type and term levels. usable on both the type and term levels.
- **Visual Communication:** A pure and functional language that lends itself - **Visual Communication:** A pure and functional language that lends itself
easily to visualisation of data-flows. easily to visualization of data-flows.
- **One Right Way:** There should, overwhelmingly, be only one way to perform a - **One Right Way:** There should, overwhelmingly, be only one way to perform a
given task. Limited choice breeds simplicity. given task. Limited choice breeds simplicity.
- **Help the User:** Enso should do its utmost to make things easier for the - **Help the User:** Enso should do its utmost to make things easier for the
@ -225,10 +225,10 @@ between _too many_ and _not enough_ syntactic constructs.
Humans are inherently visual creatures, and Enso is designed to enable a Humans are inherently visual creatures, and Enso is designed to enable a
_visual_ style of communication. When designing new language features, it is _visual_ style of communication. When designing new language features, it is
overwhelmingly important to consider their impact on Enso's visualisation overwhelmingly important to consider their impact on Enso's visualization
functionality. functionality.
- _How_ they impact the existing visualisation capabilities. - _How_ they impact the existing visualization capabilities.
- _How_ they can be visualised themselves. - _How_ they can be visualised themselves.
### One Right Way ### One Right Way

View File

@ -47,7 +47,7 @@ please see [the protocol message specifications](./README.md).
- [Binary Protocol Communication Patterns](#binary-protocol-communication-patterns) - [Binary Protocol Communication Patterns](#binary-protocol-communication-patterns)
- [Binary Protocol Transport](#binary-protocol-transport) - [Binary Protocol Transport](#binary-protocol-transport)
- [Binary Protocol Functionality](#binary-protocol-functionality) - [Binary Protocol Functionality](#binary-protocol-functionality)
- [Displaying Visualisations](#displaying-visualisations) - [Displaying Visualizations](#displaying-visualizations)
- [Service Connection Setup](#service-connection-setup) - [Service Connection Setup](#service-connection-setup)
- [Service Connection Teardown](#service-connection-teardown) - [Service Connection Teardown](#service-connection-teardown)
@ -191,7 +191,7 @@ format is already defined for us.
[JSON-RPC](https://en.wikipedia.org/wiki/JSON-RPC) over a WebSocket connection [JSON-RPC](https://en.wikipedia.org/wiki/JSON-RPC) over a WebSocket connection
(as defined in the LSP spec). (as defined in the LSP spec).
- As a protocol extension we also negotiate a secondary binary WebSocket - As a protocol extension we also negotiate a secondary binary WebSocket
connection for sending visualisation data. This transport is independent of connection for sending visualization data. This transport is independent of
the LSP spec, and hence is defined entirely by us. the LSP spec, and hence is defined entirely by us.
> The actionables for this section are: > The actionables for this section are:
@ -208,7 +208,7 @@ LSP messages. The following notes apply:
- Textual messages should be sent as LSP messages or extensions to them. - Textual messages should be sent as LSP messages or extensions to them.
- We have a hybrid extension to the protocol to allow us to send binary data - We have a hybrid extension to the protocol to allow us to send binary data
(for visualisations) over a second WebSocket connection. (for visualizations) over a second WebSocket connection.
This means that we have two pipes: one is the textual WebSocket defined by LSP, This means that we have two pipes: one is the textual WebSocket defined by LSP,
and the other is a binary WebSocket. and the other is a binary WebSocket.
@ -403,10 +403,10 @@ great to know which epoch is running).
- This could be achieved by a special kind of Monadic context (similar to - This could be achieved by a special kind of Monadic context (similar to
writer, but mutable buffer based). writer, but mutable buffer based).
- This would allow the function to log values without needing to return. - This would allow the function to log values without needing to return.
- These would be sent as visualisations for use in the IDE. - These would be sent as visualizations for use in the IDE.
LSP provides an inbuilt mechanism for reporting progress, but that will not work LSP provides an inbuilt mechanism for reporting progress, but that will not work
with visualisations. As a result that should be reserved for reporting progress with visualizations. As a result that should be reserved for reporting progress
of long-running operations within the _language server_ rather than in user of long-running operations within the _language server_ rather than in user
code. code.
@ -482,7 +482,7 @@ and will be expanded upon as necessary in the future.
These should include (but may not be limited to) the renaming, moving, These should include (but may not be limited to) the renaming, moving,
extraction and inlining of entities. In future this could be expanded to extraction and inlining of entities. In future this could be expanded to
include refactoring hints a la IntelliJ. include refactoring hints a la IntelliJ.
- **Arbitrary Visualisation Code:** Visualisations should be able to be defined - **Arbitrary Visualization Code:** Visualizations should be able to be defined
using Enso code and will require additional support. using Enso code and will require additional support.
- **IO Manager:** The ability to do sophisticated IO monitoring, such as - **IO Manager:** The ability to do sophisticated IO monitoring, such as
watching for file changes, in order to support minimal re-execution of watching for file changes, in order to support minimal re-execution of
@ -570,7 +570,7 @@ namespace org.enso.languageserver.protocol.binary;
union OutboundPayload { union OutboundPayload {
ERROR: Error, ERROR: Error,
SUCCESS: Success, SUCCESS: Success,
VISUALISATION_UPDATE: VisualisationUpdate, VISUALIZATION_UPDATE: VisualizationUpdate,
FILE_CONTENTS_REPLY: FileContentsReply FILE_CONTENTS_REPLY: FileContentsReply
} }
@ -630,33 +630,33 @@ for the protocol transport format. This choice has been made for a few reasons:
The binary protocol exists in order to serve the high-bandwidth data transfer The binary protocol exists in order to serve the high-bandwidth data transfer
requirements of the engine and the GUI. requirements of the engine and the GUI.
### Displaying Visualisations ### Displaying Visualizations
A major part of Enso Studio's functionality is the rich embedded visualisations A major part of Enso Studio's functionality is the rich embedded visualizations
that it supports. This means that the following functionality is necessary: that it supports. This means that the following functionality is necessary:
- Execution of an arbitrary Enso expression on a cached value designated by a - Execution of an arbitrary Enso expression on a cached value designated by a
source location. source location.
- The ability to create and destroy visualisation subscriptions with an - The ability to create and destroy visualization subscriptions with an
arbitrary piece of Enso code as the preprocessing function. arbitrary piece of Enso code as the preprocessing function.
- The ability to update _existing_ subscriptions with a new preprocessing - The ability to update _existing_ subscriptions with a new preprocessing
function. function.
Visualisations in Enso are able to output arbitrary data for display in the GUI, Visualizations in Enso are able to output arbitrary data for display in the GUI,
which requires a mechanism for transferring arbitrary data between the engine which requires a mechanism for transferring arbitrary data between the engine
and the GUI. These visualisations can output data in common formats, which will and the GUI. These visualizations can output data in common formats, which will
be serialised by the transport (e.g. text), but they can also write arbitrary be serialised by the transport (e.g. text), but they can also write arbitrary
binary data that can then be interpreted by the visualisation component itself binary data that can then be interpreted by the visualization component itself
in any language that can be used from within the IDE. in any language that can be used from within the IDE.
From the implementation perspective: From the implementation perspective:
- This will need to be an entirely separate set of protocol messages that should - This will need to be an entirely separate set of protocol messages that should
be specified in detail in this document. be specified in detail in this document.
- Visualisations should work on a pub/sub model, where an update is sent every - Visualizations should work on a pub/sub model, where an update is sent every
time the underlying data is recomputed. time the underlying data is recomputed.
- Protocol responses must contain a pointer into the binary pipe carrying the - Protocol responses must contain a pointer into the binary pipe carrying the
visualisation data to identify an update. visualization data to identify an update.
## Service Connection Setup ## Service Connection Setup

View File

@ -27,8 +27,8 @@ transport formats, please look [here](./protocol-architecture).
- [`ProfilingInfo`](#profilinginfo) - [`ProfilingInfo`](#profilinginfo)
- [`ExpressionUpdate`](#expressionupdate) - [`ExpressionUpdate`](#expressionupdate)
- [`ExpressionUpdatePayload`](#expressionupdatepayload) - [`ExpressionUpdatePayload`](#expressionupdatepayload)
- [`VisualisationConfiguration`](#visualisationconfiguration) - [`VisualizationConfiguration`](#visualizationconfiguration)
- [`VisualisationExpression`](#visualisationexpression) - [`VisualizationExpression`](#visualizationexpression)
- [`SuggestionEntryArgument`](#suggestionentryargument) - [`SuggestionEntryArgument`](#suggestionentryargument)
- [`SuggestionEntry`](#suggestionentry) - [`SuggestionEntry`](#suggestionentry)
- [`SuggestionEntryType`](#suggestionentrytype) - [`SuggestionEntryType`](#suggestionentrytype)
@ -142,11 +142,11 @@ transport formats, please look [here](./protocol-architecture).
- [`executionContext/executionComplete`](#executioncontextexecutioncomplete) - [`executionContext/executionComplete`](#executioncontextexecutioncomplete)
- [`executionContext/executionStatus`](#executioncontextexecutionstatus) - [`executionContext/executionStatus`](#executioncontextexecutionstatus)
- [`executionContext/executeExpression`](#executioncontextexecuteexpression) - [`executionContext/executeExpression`](#executioncontextexecuteexpression)
- [`executionContext/attachVisualisation`](#executioncontextattachvisualisation) - [`executionContext/attachVisualization`](#executioncontextattachvisualization)
- [`executionContext/detachVisualisation`](#executioncontextdetachvisualisation) - [`executionContext/detachVisualization`](#executioncontextdetachvisualization)
- [`executionContext/modifyVisualisation`](#executioncontextmodifyvisualisation) - [`executionContext/modifyVisualization`](#executioncontextmodifyvisualization)
- [`executionContext/visualisationUpdate`](#executioncontextvisualisationupdate) - [`executionContext/visualizationUpdate`](#executioncontextvisualizationupdate)
- [`executionContext/visualisationEvaluationFailed`](#executioncontextvisualisationevaluationfailed) - [`executionContext/visualizationEvaluationFailed`](#executioncontextvisualizationevaluationfailed)
- [Search Operations](#search-operations) - [Search Operations](#search-operations)
- [Suggestions Database Example](#suggestions-database-example) - [Suggestions Database Example](#suggestions-database-example)
- [`search/getSuggestionsDatabase`](#searchgetsuggestionsdatabase) - [`search/getSuggestionsDatabase`](#searchgetsuggestionsdatabase)
@ -197,8 +197,8 @@ transport formats, please look [here](./protocol-architecture).
- [`EmptyStackError`](#emptystackerror) - [`EmptyStackError`](#emptystackerror)
- [`InvalidStackItemError`](#invalidstackitemerror) - [`InvalidStackItemError`](#invalidstackitemerror)
- [`ModuleNotFoundError`](#modulenotfounderror) - [`ModuleNotFoundError`](#modulenotfounderror)
- [`VisualisationNotFoundError`](#visualisationnotfounderror) - [`VisualizationNotFoundError`](#visualizationnotfounderror)
- [`VisualisationExpressionError`](#visualisationexpressionerror) - [`VisualizationExpressionError`](#visualizationexpressionerror)
- [`FileNotOpenedError`](#filenotopenederror) - [`FileNotOpenedError`](#filenotopenederror)
- [`TextEditValidationError`](#texteditvalidationerror) - [`TextEditValidationError`](#texteditvalidationerror)
- [`InvalidVersionError`](#invalidversionerror) - [`InvalidVersionError`](#invalidversionerror)
@ -443,22 +443,22 @@ interface Warnings {
} }
``` ```
### `VisualisationConfiguration` ### `VisualizationConfiguration`
A configuration object for properties of the visualisation. A configuration object for properties of the visualization.
```typescript ```typescript
interface VisualisationConfiguration { interface VisualizationConfiguration {
/** An execution context of the visualisation. */ /** An execution context of the visualization. */
executionContextId: UUID; executionContextId: UUID;
/** /**
* A qualified name of the module containing the expression which creates * A qualified name of the module containing the expression which creates
* visualisation. * visualization.
*/ */
visualisationModule?: String; visualizationModule?: String;
/** An expression that creates a visualisation. */ /** An expression that creates a visualization. */
expression: String | MethodPointer; expression: String | MethodPointer;
/** A list of arguments to pass to the visualization expression. */ /** A list of arguments to pass to the visualization expression. */
@ -1815,11 +1815,11 @@ destroying the context.
- [`executionContext/push`](#executioncontextpush) - [`executionContext/push`](#executioncontextpush)
- [`executionContext/pop`](#executioncontextpop) - [`executionContext/pop`](#executioncontextpop)
- [`executionContext/executeExpression`](#executioncontextexecuteexpression) - [`executionContext/executeExpression`](#executioncontextexecuteexpression)
- [`executionContext/attachVisualisation`](#executioncontextattachvisualisation) - [`executionContext/attachVisualization`](#executioncontextattachvisualization)
- [`executionContext/modifyVisualisation`](#executioncontextmodifyvisualisation) - [`executionContext/modifyVisualization`](#executioncontextmodifyvisualization)
- [`executionContext/detachVisualisation`](#executioncontextdetachvisualisation) - [`executionContext/detachVisualization`](#executioncontextdetachvisualization)
- [`executionContext/visualisationUpdate`](#executioncontextvisualisationupdate) - [`executionContext/visualizationUpdate`](#executioncontextvisualizationupdate)
- [`executionContext/visualisationEvaluationFailed`](#executioncontextvisualisationevaluationfailed) - [`executionContext/visualizationEvaluationFailed`](#executioncontextvisualizationevaluationfailed)
#### Disables #### Disables
@ -3893,8 +3893,8 @@ None
This message allows the client to execute an arbitrary expression on a given This message allows the client to execute an arbitrary expression on a given
node. It behaves like oneshot node. It behaves like oneshot
[`executionContext/attachVisualisation`](#executioncontextattachvisualisation) [`executionContext/attachVisualization`](#executioncontextattachvisualization)
visualisation request, meaning that the visualisation expression will be visualization request, meaning that the visualization expression will be
executed only once. executed only once.
- **Type:** Request - **Type:** Request
@ -3906,9 +3906,9 @@ executed only once.
```typescript ```typescript
interface ExecuteExpressionRequest { interface ExecuteExpressionRequest {
visualisationId: UUID; visualizationId: UUID;
expressionId: UUID; expressionId: UUID;
visualisationConfig: VisualisationConfiguration; visualizationConfig: VisualizationConfiguration;
} }
``` ```
@ -3925,14 +3925,14 @@ null;
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found - [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
by provided id. by provided id.
- [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with - [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with
the visualisation cannot be found. the visualization cannot be found.
- [`VisualisationExpressionError`](#visualisationexpressionerror) to signal that - [`VisualizationExpressionError`](#visualizationexpressionerror) to signal that
the expression specified in the `VisualisationConfiguration` cannot be the expression specified in the `VisualizationConfiguration` cannot be
evaluated. evaluated.
### `executionContext/attachVisualisation` ### `executionContext/attachVisualization`
This message allows the client to attach a visualisation, potentially This message allows the client to attach a visualization, potentially
preprocessed by some arbitrary Enso code, to a given node in the program. preprocessed by some arbitrary Enso code, to a given node in the program.
- **Type:** Request - **Type:** Request
@ -3943,10 +3943,10 @@ preprocessed by some arbitrary Enso code, to a given node in the program.
#### Parameters #### Parameters
```typescript ```typescript
interface AttachVisualisationRequest { interface AttachVisualizationRequest {
visualisationId: UUID; visualizationId: UUID;
expressionId: UUID; expressionId: UUID;
visualisationConfig: VisualisationConfiguration; visualizationConfig: VisualizationConfiguration;
} }
``` ```
@ -3963,14 +3963,14 @@ null;
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found - [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
by provided id. by provided id.
- [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with - [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with
the visualisation cannot be found. the visualization cannot be found.
- [`VisualisationExpressionError`](#visualisationexpressionerror) to signal that - [`VisualizationExpressionError`](#visualizationexpressionerror) to signal that
the expression specified in the `VisualisationConfiguration` cannot be the expression specified in the `VisualizationConfiguration` cannot be
evaluated. evaluated.
### `executionContext/detachVisualisation` ### `executionContext/detachVisualization`
This message allows a client to detach a visualisation from the executing code. This message allows a client to detach a visualization from the executing code.
- **Type:** Request - **Type:** Request
- **Direction:** Client -> Server - **Direction:** Client -> Server
@ -3980,9 +3980,9 @@ This message allows a client to detach a visualisation from the executing code.
#### Parameters #### Parameters
```typescript ```typescript
interface DetachVisualisationRequest { interface DetachVisualizationRequest {
executionContextId: UUID; executionContextId: UUID;
visualisationId: UUID; visualizationId: UUID;
expressionId: UUID; expressionId: UUID;
} }
``` ```
@ -3999,13 +3999,13 @@ null;
`executionContext/canModify` capability for this context. `executionContext/canModify` capability for this context.
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found - [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
by provided id. by provided id.
- [`VisualisationNotFoundError`](#visualisationnotfounderror) when a - [`VisualizationNotFoundError`](#visualizationnotfounderror) when a
visualisation can not be found. visualization can not be found.
### `executionContext/modifyVisualisation` ### `executionContext/modifyVisualization`
This message allows a client to modify the configuration for an existing This message allows a client to modify the configuration for an existing
visualisation. visualization.
A successful response means that the new visualization configuration has been A successful response means that the new visualization configuration has been
applied. In case of an error response, the visualization state does not change. applied. In case of an error response, the visualization state does not change.
@ -4018,9 +4018,9 @@ applied. In case of an error response, the visualization state does not change.
#### Parameters #### Parameters
```typescript ```typescript
interface ModifyVisualisationRequest { interface ModifyVisualizationRequest {
visualisationId: UUID; visualizationId: UUID;
visualisationConfig: VisualisationConfiguration; visualizationConfig: VisualizationConfiguration;
} }
``` ```
@ -4037,16 +4037,16 @@ null;
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found - [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
by provided id. by provided id.
- [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with - [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with
the visualisation cannot be found. the visualization cannot be found.
- [`VisualisationExpressionError`](#visualisationexpressionerror) to signal that - [`VisualizationExpressionError`](#visualizationexpressionerror) to signal that
the expression specified in the `VisualisationConfiguration` cannot be the expression specified in the `VisualizationConfiguration` cannot be
evaluated. evaluated.
- [`VisualisationNotFoundError`](#visualisationnotfounderror) when a - [`VisualizationNotFoundError`](#visualizationnotfounderror) when a
visualisation can not be found. visualization can not be found.
### `executionContext/visualisationUpdate` ### `executionContext/visualizationUpdate`
This message is responsible for providing a visualisation data update to the This message is responsible for providing a visualization data update to the
client. client.
- **Type:** Notification - **Type:** Notification
@ -4054,7 +4054,7 @@ client.
- **Connection:** Data - **Connection:** Data
- **Visibility:** Public - **Visibility:** Public
The `visualisationData` component of the table definition _must_ be The `visualizationData` component of the table definition _must_ be
pre-serialized before being inserted into this message. As far as this level of pre-serialized before being inserted into this message. As far as this level of
transport is concerned, it is just a binary blob. transport is concerned, it is just a binary blob.
@ -4063,11 +4063,11 @@ transport is concerned, it is just a binary blob.
```idl ```idl
namespace org.enso.languageserver.protocol.binary; namespace org.enso.languageserver.protocol.binary;
//A visualisation context identifying a concrete visualisation. //A visualization context identifying a concrete visualization.
table VisualisationContext { table VisualizationContext {
//A visualisation identifier. //A visualization identifier.
visualisationId: EnsoUUID (required); visualizationId: EnsoUUID (required);
//A context identifier. //A context identifier.
contextId: EnsoUUID (required); contextId: EnsoUUID (required);
@ -4077,27 +4077,27 @@ table VisualisationContext {
} }
//An event signaling visualisation update. //An event signaling visualization update.
table VisualisationUpdate { table VisualizationUpdate {
//A visualisation context identifying a concrete visualisation. //A visualization context identifying a concrete visualization.
visualisationContext: VisualisationContext (required); visualizationContext: VisualizationContext (required);
//A visualisation data. //A visualization data.
data: [ubyte] (required); data: [ubyte] (required);
} }
root_type VisualisationUpdate; root_type VisualizationUpdate;
``` ```
#### Errors #### Errors
N/A N/A
### `executionContext/visualisationEvaluationFailed` ### `executionContext/visualizationEvaluationFailed`
Signals that an evaluation of a visualisation expression on the computed value Signals that an evaluation of a visualization expression on the computed value
has failed. has failed.
- **Type:** Notification - **Type:** Notification
@ -4108,16 +4108,16 @@ has failed.
#### Parameters #### Parameters
```typescript ```typescript
interface VisualisationEvaluationFailed { interface VisualizationEvaluationFailed {
/** /**
* An execution context identifier. * An execution context identifier.
*/ */
contextId: ContextId; contextId: ContextId;
/** /**
* A visualisation identifier. * A visualization identifier.
*/ */
visualisationId: UUID; visualizationId: UUID;
/** /**
* An identifier of a visualised expression. * An identifier of a visualised expression.
@ -5404,27 +5404,27 @@ It signals that the given module cannot be found.
} }
``` ```
### `VisualisationNotFoundError` ### `VisualizationNotFoundError`
It signals that the visualisation cannot be found. It signals that the visualization cannot be found.
```typescript ```typescript
"error" : { "error" : {
"code" : 2006, "code" : 2006,
"message" : "Visualisation not found" "message" : "Visualization not found"
} }
``` ```
### `VisualisationExpressionError` ### `VisualizationExpressionError`
It signals that the expression specified in the `VisualisationConfiguration` It signals that the expression specified in the `VisualizationConfiguration`
cannot be evaluated. The error contains an optional `data` field of type cannot be evaluated. The error contains an optional `data` field of type
[`Diagnostic`](#diagnostic) providing error details. [`Diagnostic`](#diagnostic) providing error details.
```typescript ```typescript
"error" : { "error" : {
"code" : 2007, "code" : 2007,
"message" : "Evaluation of the visualisation expression failed [i is not defined]" "message" : "Evaluation of the visualization expression failed [i is not defined]"
"payload" : { "payload" : {
"kind" : "Error", "kind" : "Error",
"message" : "i is not defined", "message" : "i is not defined",

View File

@ -348,20 +348,20 @@ evicted, which is costly.
### Lazy Visualization Support ### Lazy Visualization Support
Currently, IDE visualisations are evaluated eagerly on their candidate data. Currently, IDE visualizations are evaluated eagerly on their candidate data.
This is a nightmare when working with huge amounts of data (e.g. tables with This is a nightmare when working with huge amounts of data (e.g. tables with
millions of rows), and can easily lock up both the runtime and IDE. The current millions of rows), and can easily lock up both the runtime and IDE. The current
solution artificially limits the amount of data sent to the IDE. solution artificially limits the amount of data sent to the IDE.
In the future, we want to support the ability to cache inside visualisation code In the future, we want to support the ability to cache inside visualization code
such that the preprocessor doesn't have to be recomputed every time the IDE such that the preprocessor doesn't have to be recomputed every time the IDE
changes the parameters. This will enable the ability to view the full data in changes the parameters. This will enable the ability to view the full data in
the IDE without having to send it all at once, or recompute potentially costly the IDE without having to send it all at once, or recompute potentially costly
preprocessors. preprocessors.
- Implement caching support for the visualisation expression processing. - Implement caching support for the visualization expression processing.
- This cache should, much like the IDE's introspection cache, track and save the - This cache should, much like the IDE's introspection cache, track and save the
values of all top-level bindings in the visualisation preprocessor. values of all top-level bindings in the visualization preprocessor.
## Parser ## Parser

View File

@ -19,10 +19,10 @@ import org.enso.languageserver.protocol.binary.factory.{
ErrorFactory, ErrorFactory,
OutboundMessageFactory, OutboundMessageFactory,
SuccessReplyFactory, SuccessReplyFactory,
VisualisationUpdateFactory VisualizationUpdateFactory
} }
import org.enso.languageserver.requesthandler.file._ import org.enso.languageserver.requesthandler.file._
import org.enso.languageserver.runtime.ContextRegistryProtocol.VisualisationUpdate import org.enso.languageserver.runtime.ContextRegistryProtocol.VisualizationUpdate
import org.enso.languageserver.session.BinarySession 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
@ -113,8 +113,8 @@ class BinaryConnectionController(
) )
} }
case update: VisualisationUpdate => case update: VisualizationUpdate =>
val updatePacket = convertVisualisationUpdateToOutPacket(update) val updatePacket = convertVisualizationUpdateToOutPacket(update)
outboundChannel ! updatePacket outboundChannel ! updatePacket
} }
@ -157,15 +157,15 @@ class BinaryConnectionController(
ErrorFactory.createServiceError() ErrorFactory.createServiceError()
} }
private def convertVisualisationUpdateToOutPacket( private def convertVisualizationUpdateToOutPacket(
update: VisualisationUpdate update: VisualizationUpdate
): ByteBuffer = { ): ByteBuffer = {
implicit val builder: FlatBufferBuilder = new FlatBufferBuilder(1024) implicit val builder: FlatBufferBuilder = new FlatBufferBuilder(1024)
val event = VisualisationUpdateFactory.create(update) val event = VisualizationUpdateFactory.create(update)
val msg = OutboundMessageFactory.create( val msg = OutboundMessageFactory.create(
UUID.randomUUID(), UUID.randomUUID(),
None, None,
OutboundPayload.VISUALISATION_UPDATE, OutboundPayload.VISUALIZATION_UPDATE,
event event
) )

View File

@ -2,62 +2,62 @@ package org.enso.languageserver.protocol.binary.factory
import com.google.flatbuffers.FlatBufferBuilder import com.google.flatbuffers.FlatBufferBuilder
import org.enso.languageserver.protocol.binary.{ import org.enso.languageserver.protocol.binary.{
VisualisationContext => BinaryVisualisationContext, VisualizationContext => BinaryVisualizationContext,
VisualisationUpdate => BinaryVisualisationUpdate VisualizationUpdate => BinaryVisualizationUpdate
} }
import org.enso.languageserver.runtime.ContextRegistryProtocol.{ import org.enso.languageserver.runtime.ContextRegistryProtocol.{
VisualisationContext, VisualizationContext,
VisualisationUpdate VisualizationUpdate
} }
object VisualisationUpdateFactory { object VisualizationUpdateFactory {
/** Creates a [[VisualisationUpdate]] inside a [[FlatBufferBuilder]]. /** Creates a [[VisualizationUpdate]] inside a [[FlatBufferBuilder]].
* *
* @param update a visualisation update * @param update a visualization update
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of
* complex objects * complex objects
* @return an offset pointing to the FlatBuffer representation of the * @return an offset pointing to the FlatBuffer representation of the
* created object * created object
*/ */
def create(update: VisualisationUpdate)(implicit def create(update: VisualizationUpdate)(implicit
builder: FlatBufferBuilder builder: FlatBufferBuilder
): Int = { ): Int = {
val ctx = createVisualisationCtx(update.visualisationContext) val ctx = createVisualizationCtx(update.visualizationContext)
val data = val data =
BinaryVisualisationUpdate.createDataVector(builder, update.data) BinaryVisualizationUpdate.createDataVector(builder, update.data)
BinaryVisualisationUpdate.createVisualisationUpdate( BinaryVisualizationUpdate.createVisualizationUpdate(
builder, builder,
ctx, ctx,
data data
) )
} }
/** Creates a [[VisualisationContext]] inside a [[FlatBufferBuilder]]. /** Creates a [[VisualizationContext]] inside a [[FlatBufferBuilder]].
* *
* @param ctx a VisualisationContext * @param ctx a VisualizationContext
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of
* complex objects * complex objects
* @return an offset pointing to the FlatBuffer representation of the * @return an offset pointing to the FlatBuffer representation of the
* created object * created object
*/ */
def createVisualisationCtx(ctx: VisualisationContext)(implicit def createVisualizationCtx(ctx: VisualizationContext)(implicit
builder: FlatBufferBuilder builder: FlatBufferBuilder
): Int = { ): Int = {
BinaryVisualisationContext.startVisualisationContext(builder) BinaryVisualizationContext.startVisualizationContext(builder)
BinaryVisualisationContext.addContextId( BinaryVisualizationContext.addContextId(
builder, builder,
EnsoUuidFactory.create(ctx.contextId) EnsoUuidFactory.create(ctx.contextId)
) )
BinaryVisualisationContext.addExpressionId( BinaryVisualizationContext.addExpressionId(
builder, builder,
EnsoUuidFactory.create(ctx.expressionId) EnsoUuidFactory.create(ctx.expressionId)
) )
BinaryVisualisationContext.addVisualisationId( BinaryVisualizationContext.addVisualizationId(
builder, builder,
EnsoUuidFactory.create(ctx.visualisationId) EnsoUuidFactory.create(ctx.visualizationId)
) )
BinaryVisualisationContext.endVisualisationContext(builder) BinaryVisualizationContext.endVisualizationContext(builder)
} }
} }

View File

@ -42,20 +42,20 @@ import org.enso.languageserver.requesthandler.monitoring.{
} }
import org.enso.languageserver.requesthandler.refactoring.RenameProjectHandler import org.enso.languageserver.requesthandler.refactoring.RenameProjectHandler
import org.enso.languageserver.requesthandler.text._ import org.enso.languageserver.requesthandler.text._
import org.enso.languageserver.requesthandler.visualisation.{ import org.enso.languageserver.requesthandler.visualization.{
AttachVisualisationHandler, AttachVisualizationHandler,
DetachVisualisationHandler, DetachVisualizationHandler,
ExecuteExpressionHandler, ExecuteExpressionHandler,
ModifyVisualisationHandler ModifyVisualizationHandler
} }
import org.enso.languageserver.requesthandler.workspace.ProjectInfoHandler import org.enso.languageserver.requesthandler.workspace.ProjectInfoHandler
import org.enso.languageserver.runtime.ContextRegistryProtocol import org.enso.languageserver.runtime.ContextRegistryProtocol
import org.enso.languageserver.runtime.ExecutionApi._ import org.enso.languageserver.runtime.ExecutionApi._
import org.enso.languageserver.runtime.VisualisationApi.{ import org.enso.languageserver.runtime.VisualizationApi.{
AttachVisualisation, AttachVisualization,
DetachVisualisation, DetachVisualization,
ExecuteExpression, ExecuteExpression,
ModifyVisualisation ModifyVisualization
} }
import org.enso.languageserver.search.SearchApi._ import org.enso.languageserver.search.SearchApi._
import org.enso.languageserver.search.{SearchApi, SearchProtocol} import org.enso.languageserver.search.{SearchApi, SearchProtocol}
@ -348,18 +348,18 @@ class JsonConnectionController(
ExecutionContextExecutionStatus.Params(contextId, diagnostics) ExecutionContextExecutionStatus.Params(contextId, diagnostics)
) )
case ContextRegistryProtocol.VisualisationEvaluationFailed( case ContextRegistryProtocol.VisualizationEvaluationFailed(
contextId, contextId,
visualisationId, visualizationId,
expressionId, expressionId,
message, message,
diagnostic diagnostic
) => ) =>
webActor ! Notification( webActor ! Notification(
VisualisationEvaluationFailed, VisualizationEvaluationFailed,
VisualisationEvaluationFailed.Params( VisualizationEvaluationFailed.Params(
contextId, contextId,
visualisationId, visualizationId,
expressionId, expressionId,
message, message,
diagnostic diagnostic
@ -508,11 +508,11 @@ class JsonConnectionController(
.props(requestTimeout, suggestionsHandler), .props(requestTimeout, suggestionsHandler),
ExecuteExpression -> ExecuteExpressionHandler ExecuteExpression -> ExecuteExpressionHandler
.props(rpcSession.clientId, requestTimeout, contextRegistry), .props(rpcSession.clientId, requestTimeout, contextRegistry),
AttachVisualisation -> AttachVisualisationHandler AttachVisualization -> AttachVisualizationHandler
.props(rpcSession.clientId, requestTimeout, contextRegistry), .props(rpcSession.clientId, requestTimeout, contextRegistry),
DetachVisualisation -> DetachVisualisationHandler DetachVisualization -> DetachVisualizationHandler
.props(rpcSession.clientId, requestTimeout, contextRegistry), .props(rpcSession.clientId, requestTimeout, contextRegistry),
ModifyVisualisation -> ModifyVisualisationHandler ModifyVisualization -> ModifyVisualizationHandler
.props(rpcSession.clientId, requestTimeout, contextRegistry), .props(rpcSession.clientId, requestTimeout, contextRegistry),
RedirectStandardOutput -> RedirectStdOutHandler RedirectStandardOutput -> RedirectStdOutHandler
.props(stdOutController, rpcSession.clientId), .props(stdOutController, rpcSession.clientId),

View File

@ -20,7 +20,7 @@ import org.enso.languageserver.monitoring.MonitoringApi.{InitialPing, Ping}
import org.enso.languageserver.refactoring.RefactoringApi.RenameProject import org.enso.languageserver.refactoring.RefactoringApi.RenameProject
import org.enso.languageserver.runtime.ExecutionApi._ import org.enso.languageserver.runtime.ExecutionApi._
import org.enso.languageserver.search.SearchApi._ import org.enso.languageserver.search.SearchApi._
import org.enso.languageserver.runtime.VisualisationApi._ import org.enso.languageserver.runtime.VisualizationApi._
import org.enso.languageserver.session.SessionApi.InitProtocolConnection import org.enso.languageserver.session.SessionApi.InitProtocolConnection
import org.enso.languageserver.text.TextApi._ import org.enso.languageserver.text.TextApi._
import org.enso.languageserver.libraries.LibraryApi._ import org.enso.languageserver.libraries.LibraryApi._
@ -73,9 +73,9 @@ object JsonRpc {
.registerRequest(ExecutionContextInterrupt) .registerRequest(ExecutionContextInterrupt)
.registerRequest(ExecutionContextGetComponentGroups) .registerRequest(ExecutionContextGetComponentGroups)
.registerRequest(ExecuteExpression) .registerRequest(ExecuteExpression)
.registerRequest(AttachVisualisation) .registerRequest(AttachVisualization)
.registerRequest(DetachVisualisation) .registerRequest(DetachVisualization)
.registerRequest(ModifyVisualisation) .registerRequest(ModifyVisualization)
.registerRequest(GetSuggestionsDatabase) .registerRequest(GetSuggestionsDatabase)
.registerRequest(GetSuggestionsDatabaseVersion) .registerRequest(GetSuggestionsDatabaseVersion)
.registerRequest(InvalidateSuggestionsDatabase) .registerRequest(InvalidateSuggestionsDatabase)
@ -115,5 +115,5 @@ object JsonRpc {
.registerNotification(StandardErrorAppended) .registerNotification(StandardErrorAppended)
.registerNotification(WaitingForStandardInput) .registerNotification(WaitingForStandardInput)
.registerNotification(SuggestionsDatabaseUpdates) .registerNotification(SuggestionsDatabaseUpdates)
.registerNotification(VisualisationEvaluationFailed) .registerNotification(VisualizationEvaluationFailed)
} }

View File

@ -1,11 +1,11 @@
package org.enso.languageserver.requesthandler.visualisation package org.enso.languageserver.requesthandler.visualization
import akka.actor.{Actor, ActorRef, Cancellable, Props} import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._ import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.VisualisationApi.AttachVisualisation import org.enso.languageserver.runtime.VisualizationApi.AttachVisualization
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
ContextRegistryProtocol, ContextRegistryProtocol,
RuntimeFailureMapper RuntimeFailureMapper
@ -14,13 +14,13 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** A request handler for `executionContext/attachVisualisation` commands. /** A request handler for `executionContext/attachVisualization` commands.
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
*/ */
class AttachVisualisationHandler( class AttachVisualizationHandler(
clientId: ClientId, clientId: ClientId,
timeout: FiniteDuration, timeout: FiniteDuration,
contextRegistry: ActorRef contextRegistry: ActorRef
@ -33,12 +33,12 @@ class AttachVisualisationHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { private def requestStage: Receive = {
case Request(AttachVisualisation, id, params: AttachVisualisation.Params) => case Request(AttachVisualization, id, params: AttachVisualization.Params) =>
contextRegistry ! ContextRegistryProtocol.AttachVisualisation( contextRegistry ! ContextRegistryProtocol.AttachVisualization(
clientId, clientId,
params.visualisationId, params.visualizationId,
params.expressionId, params.expressionId,
params.visualisationConfig params.visualizationConfig
) )
val cancellable = val cancellable =
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
@ -55,8 +55,8 @@ class AttachVisualisationHandler(
replyTo ! ResponseError(Some(id), Errors.RequestTimeout) replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self) context.stop(self)
case ContextRegistryProtocol.VisualisationAttached => case ContextRegistryProtocol.VisualizationAttached =>
replyTo ! ResponseResult(AttachVisualisation, id, Unused) replyTo ! ResponseResult(AttachVisualization, id, Unused)
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)
@ -68,9 +68,9 @@ class AttachVisualisationHandler(
} }
object AttachVisualisationHandler { object AttachVisualizationHandler {
/** Creates configuration object used to create a [[AttachVisualisationHandler]]. /** Creates configuration object used to create a [[AttachVisualizationHandler]].
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
@ -81,6 +81,6 @@ object AttachVisualisationHandler {
timeout: FiniteDuration, timeout: FiniteDuration,
runtime: ActorRef runtime: ActorRef
): Props = ): Props =
Props(new AttachVisualisationHandler(clientId, timeout, runtime)) Props(new AttachVisualizationHandler(clientId, timeout, runtime))
} }

View File

@ -1,11 +1,11 @@
package org.enso.languageserver.requesthandler.visualisation package org.enso.languageserver.requesthandler.visualization
import akka.actor.{Actor, ActorRef, Cancellable, Props} import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._ import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.VisualisationApi.DetachVisualisation import org.enso.languageserver.runtime.VisualizationApi.DetachVisualization
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
ContextRegistryProtocol, ContextRegistryProtocol,
RuntimeFailureMapper RuntimeFailureMapper
@ -14,13 +14,13 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** A request handler for `executionContext/detachVisualisation` commands. /** A request handler for `executionContext/detachVisualization` commands.
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
*/ */
class DetachVisualisationHandler( class DetachVisualizationHandler(
clientId: ClientId, clientId: ClientId,
timeout: FiniteDuration, timeout: FiniteDuration,
contextRegistry: ActorRef contextRegistry: ActorRef
@ -33,11 +33,11 @@ class DetachVisualisationHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { private def requestStage: Receive = {
case Request(DetachVisualisation, id, params: DetachVisualisation.Params) => case Request(DetachVisualization, id, params: DetachVisualization.Params) =>
contextRegistry ! ContextRegistryProtocol.DetachVisualisation( contextRegistry ! ContextRegistryProtocol.DetachVisualization(
clientId, clientId,
params.contextId, params.contextId,
params.visualisationId, params.visualizationId,
params.expressionId params.expressionId
) )
val cancellable = val cancellable =
@ -55,8 +55,8 @@ class DetachVisualisationHandler(
replyTo ! ResponseError(Some(id), Errors.RequestTimeout) replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self) context.stop(self)
case ContextRegistryProtocol.VisualisationDetached => case ContextRegistryProtocol.VisualizationDetached =>
replyTo ! ResponseResult(DetachVisualisation, id, Unused) replyTo ! ResponseResult(DetachVisualization, id, Unused)
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)
@ -68,9 +68,9 @@ class DetachVisualisationHandler(
} }
object DetachVisualisationHandler { object DetachVisualizationHandler {
/** Creates configuration object used to create a [[DetachVisualisationHandler]]. /** Creates configuration object used to create a [[DetachVisualizationHandler]].
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
@ -81,6 +81,6 @@ object DetachVisualisationHandler {
timeout: FiniteDuration, timeout: FiniteDuration,
runtime: ActorRef runtime: ActorRef
): Props = ): Props =
Props(new DetachVisualisationHandler(clientId, timeout, runtime)) Props(new DetachVisualizationHandler(clientId, timeout, runtime))
} }

View File

@ -1,11 +1,11 @@
package org.enso.languageserver.requesthandler.visualisation package org.enso.languageserver.requesthandler.visualization
import akka.actor.{Actor, ActorRef, Cancellable, Props} import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._ import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.VisualisationApi.ExecuteExpression import org.enso.languageserver.runtime.VisualizationApi.ExecuteExpression
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
ContextRegistryProtocol, ContextRegistryProtocol,
RuntimeFailureMapper RuntimeFailureMapper
@ -40,9 +40,9 @@ class ExecuteExpressionHandler(
) => ) =>
contextRegistry ! ContextRegistryProtocol.ExecuteExpression( contextRegistry ! ContextRegistryProtocol.ExecuteExpression(
clientId, clientId,
params.visualisationId, params.visualizationId,
params.expressionId, params.expressionId,
params.visualisationConfig params.visualizationConfig
) )
val cancellable = val cancellable =
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
@ -59,7 +59,7 @@ class ExecuteExpressionHandler(
replyTo ! ResponseError(Some(id), Errors.RequestTimeout) replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self) context.stop(self)
case ContextRegistryProtocol.VisualisationAttached => case ContextRegistryProtocol.VisualizationAttached =>
replyTo ! ResponseResult(ExecuteExpression, id, Unused) replyTo ! ResponseResult(ExecuteExpression, id, Unused)
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)

View File

@ -1,11 +1,11 @@
package org.enso.languageserver.requesthandler.visualisation package org.enso.languageserver.requesthandler.visualization
import akka.actor.{Actor, ActorRef, Cancellable, Props} import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._ import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.VisualisationApi.ModifyVisualisation import org.enso.languageserver.runtime.VisualizationApi.ModifyVisualization
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
ContextRegistryProtocol, ContextRegistryProtocol,
RuntimeFailureMapper RuntimeFailureMapper
@ -14,13 +14,13 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** A request handler for `executionContext/modifyVisualisation` commands. /** A request handler for `executionContext/modifyVisualization` commands.
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
*/ */
class ModifyVisualisationHandler( class ModifyVisualizationHandler(
clientId: ClientId, clientId: ClientId,
timeout: FiniteDuration, timeout: FiniteDuration,
contextRegistry: ActorRef contextRegistry: ActorRef
@ -33,11 +33,11 @@ class ModifyVisualisationHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { private def requestStage: Receive = {
case Request(ModifyVisualisation, id, params: ModifyVisualisation.Params) => case Request(ModifyVisualization, id, params: ModifyVisualization.Params) =>
contextRegistry ! ContextRegistryProtocol.ModifyVisualisation( contextRegistry ! ContextRegistryProtocol.ModifyVisualization(
clientId, clientId,
params.visualisationId, params.visualizationId,
params.visualisationConfig params.visualizationConfig
) )
val cancellable = val cancellable =
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
@ -54,8 +54,8 @@ class ModifyVisualisationHandler(
replyTo ! ResponseError(Some(id), Errors.RequestTimeout) replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self) context.stop(self)
case ContextRegistryProtocol.VisualisationModified => case ContextRegistryProtocol.VisualizationModified =>
replyTo ! ResponseResult(ModifyVisualisation, id, Unused) replyTo ! ResponseResult(ModifyVisualization, id, Unused)
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)
@ -67,9 +67,9 @@ class ModifyVisualisationHandler(
} }
object ModifyVisualisationHandler { object ModifyVisualizationHandler {
/** Creates configuration object used to create a [[ModifyVisualisationHandler]]. /** Creates configuration object used to create a [[ModifyVisualizationHandler]].
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
@ -80,6 +80,6 @@ object ModifyVisualisationHandler {
timeout: FiniteDuration, timeout: FiniteDuration,
runtime: ActorRef runtime: ActorRef
): Props = ): Props =
Props(new ModifyVisualisationHandler(clientId, timeout, runtime)) Props(new ModifyVisualizationHandler(clientId, timeout, runtime))
} }

View File

@ -5,10 +5,10 @@ import akka.pattern.pipe
import cats.implicits._ import cats.implicits._
import com.typesafe.scalalogging.LazyLogging import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.runtime.ContextRegistryProtocol.{ import org.enso.languageserver.runtime.ContextRegistryProtocol.{
DetachVisualisation, DetachVisualization,
RegisterOneshotVisualisation, RegisterOneshotVisualization,
VisualisationContext, VisualizationContext,
VisualisationUpdate VisualizationUpdate
} }
import org.enso.languageserver.runtime.ExecutionApi.ContextId import org.enso.languageserver.runtime.ExecutionApi.ContextId
import org.enso.languageserver.session.JsonSession import org.enso.languageserver.session.JsonSession
@ -60,49 +60,49 @@ final class ContextEventsListener(
override def receive: Receive = withState(Set(), Vector()) override def receive: Receive = withState(Set(), Vector())
private def withState( private def withState(
oneshotVisualisations: Set[Api.VisualisationContext], oneshotVisualizations: Set[Api.VisualizationContext],
expressionUpdates: Vector[Api.ExpressionUpdate] expressionUpdates: Vector[Api.ExpressionUpdate]
): Receive = { ): Receive = {
case RegisterOneshotVisualisation( case RegisterOneshotVisualization(
contextId, contextId,
visualisationId, visualizationId,
expressionId expressionId
) => ) =>
val visualisationContext = val visualizationContext =
Api.VisualisationContext( Api.VisualizationContext(
visualisationId, visualizationId,
contextId, contextId,
expressionId expressionId
) )
context.become( context.become(
withState( withState(
oneshotVisualisations + visualisationContext, oneshotVisualizations + visualizationContext,
expressionUpdates expressionUpdates
) )
) )
case Api.VisualisationUpdate(ctx, data) if ctx.contextId == contextId => case Api.VisualizationUpdate(ctx, data) if ctx.contextId == contextId =>
val payload = val payload =
VisualisationUpdate( VisualizationUpdate(
VisualisationContext( VisualizationContext(
ctx.visualisationId, ctx.visualizationId,
ctx.contextId, ctx.contextId,
ctx.expressionId ctx.expressionId
), ),
data data
) )
sessionRouter ! DeliverToBinaryController(rpcSession.clientId, payload) sessionRouter ! DeliverToBinaryController(rpcSession.clientId, payload)
if (oneshotVisualisations.contains(ctx)) { if (oneshotVisualizations.contains(ctx)) {
context.parent ! DetachVisualisation( context.parent ! DetachVisualization(
rpcSession.clientId, rpcSession.clientId,
contextId, contextId,
ctx.visualisationId, ctx.visualizationId,
ctx.expressionId ctx.expressionId
) )
context.become( context.become(
withState( withState(
oneshotVisualisations - ctx, oneshotVisualizations - ctx,
expressionUpdates expressionUpdates
) )
) )
@ -110,7 +110,7 @@ final class ContextEventsListener(
case Api.ExpressionUpdates(`contextId`, apiUpdates) => case Api.ExpressionUpdates(`contextId`, apiUpdates) =>
context.become( context.become(
withState(oneshotVisualisations, expressionUpdates :++ apiUpdates) withState(oneshotVisualizations, expressionUpdates :++ apiUpdates)
) )
case Api.ExecutionFailed(`contextId`, error) => case Api.ExecutionFailed(`contextId`, error) =>
@ -144,9 +144,9 @@ final class ContextEventsListener(
message.pipeTo(sessionRouter) message.pipeTo(sessionRouter)
case Api.VisualisationEvaluationFailed( case Api.VisualizationEvaluationFailed(
`contextId`, `contextId`,
visualisationId, visualizationId,
expressionId, expressionId,
message, message,
diagnostic diagnostic
@ -156,9 +156,9 @@ final class ContextEventsListener(
.map(runtimeFailureMapper.toProtocolDiagnostic) .map(runtimeFailureMapper.toProtocolDiagnostic)
.sequence .sequence
payload = payload =
ContextRegistryProtocol.VisualisationEvaluationFailed( ContextRegistryProtocol.VisualizationEvaluationFailed(
contextId, contextId,
visualisationId, visualizationId,
expressionId, expressionId,
message, message,
diagnostic diagnostic
@ -169,7 +169,7 @@ final class ContextEventsListener(
case RunExpressionUpdates if expressionUpdates.nonEmpty => case RunExpressionUpdates if expressionUpdates.nonEmpty =>
runExpressionUpdates(expressionUpdates) runExpressionUpdates(expressionUpdates)
context.become(withState(oneshotVisualisations, Vector())) context.become(withState(oneshotVisualizations, Vector()))
case RunExpressionUpdates if expressionUpdates.isEmpty => case RunExpressionUpdates if expressionUpdates.isEmpty =>
} }

View File

@ -75,7 +75,7 @@ final class ContextRegistry(
context.system.eventStream context.system.eventStream
.subscribe(self, classOf[Api.ExpressionUpdates]) .subscribe(self, classOf[Api.ExpressionUpdates])
context.system.eventStream context.system.eventStream
.subscribe(self, classOf[Api.VisualisationUpdate]) .subscribe(self, classOf[Api.VisualizationUpdate])
context.system.eventStream context.system.eventStream
.subscribe(self, classOf[Api.ExecutionFailed]) .subscribe(self, classOf[Api.ExecutionFailed])
context.system.eventStream context.system.eventStream
@ -83,7 +83,7 @@ final class ContextRegistry(
context.system.eventStream context.system.eventStream
.subscribe(self, classOf[Api.ExecutionUpdate]) .subscribe(self, classOf[Api.ExecutionUpdate])
context.system.eventStream context.system.eventStream
.subscribe(self, classOf[Api.VisualisationEvaluationFailed]) .subscribe(self, classOf[Api.VisualizationEvaluationFailed])
} }
override def receive: Receive = override def receive: Receive =
@ -98,9 +98,9 @@ final class ContextRegistry(
case update: Api.ExpressionUpdates => case update: Api.ExpressionUpdates =>
store.getListener(update.contextId).foreach(_ ! update) store.getListener(update.contextId).foreach(_ ! update)
case update: Api.VisualisationUpdate => case update: Api.VisualizationUpdate =>
store store
.getListener(update.visualisationContext.contextId) .getListener(update.visualizationContext.contextId)
.foreach(_ ! update) .foreach(_ ! update)
case update: Api.ExecutionFailed => case update: Api.ExecutionFailed =>
@ -112,7 +112,7 @@ final class ContextRegistry(
case update: Api.ExecutionUpdate => case update: Api.ExecutionUpdate =>
store.getListener(update.contextId).foreach(_ ! update) store.getListener(update.contextId).foreach(_ ! update)
case update: Api.VisualisationEvaluationFailed => case update: Api.VisualizationEvaluationFailed =>
store.getListener(update.contextId).foreach(_ ! update) store.getListener(update.contextId).foreach(_ ! update)
case CreateContextRequest(client, contextIdOpt) => case CreateContextRequest(client, contextIdOpt) =>
@ -261,26 +261,26 @@ final class ContextRegistry(
sender() ! AccessDenied sender() ! AccessDenied
} }
case ExecuteExpression(clientId, visualisationId, expressionId, cfg) => case ExecuteExpression(clientId, visualizationId, expressionId, cfg) =>
val contextId = cfg.executionContextId val contextId = cfg.executionContextId
if (store.hasContext(clientId, contextId)) { if (store.hasContext(clientId, contextId)) {
store.getListener(contextId).foreach { listener => store.getListener(contextId).foreach { listener =>
listener ! RegisterOneshotVisualisation( listener ! RegisterOneshotVisualization(
contextId, contextId,
visualisationId, visualizationId,
expressionId expressionId
) )
} }
val handler = context.actorOf( val handler = context.actorOf(
AttachVisualisationHandler.props( AttachVisualizationHandler.props(
runtimeFailureMapper, runtimeFailureMapper,
timeout, timeout,
runtime runtime
) )
) )
handler.forward( handler.forward(
Api.AttachVisualisation( Api.AttachVisualization(
visualisationId, visualizationId,
expressionId, expressionId,
cfg.toApi cfg.toApi
) )
@ -289,18 +289,18 @@ final class ContextRegistry(
sender() ! AccessDenied sender() ! AccessDenied
} }
case AttachVisualisation(clientId, visualisationId, expressionId, cfg) => case AttachVisualization(clientId, visualizationId, expressionId, cfg) =>
if (store.hasContext(clientId, cfg.executionContextId)) { if (store.hasContext(clientId, cfg.executionContextId)) {
val handler = context.actorOf( val handler = context.actorOf(
AttachVisualisationHandler.props( AttachVisualizationHandler.props(
runtimeFailureMapper, runtimeFailureMapper,
timeout, timeout,
runtime runtime
) )
) )
handler.forward( handler.forward(
Api.AttachVisualisation( Api.AttachVisualization(
visualisationId, visualizationId,
expressionId, expressionId,
cfg.toApi cfg.toApi
) )
@ -309,31 +309,31 @@ final class ContextRegistry(
sender() ! AccessDenied sender() ! AccessDenied
} }
case DetachVisualisation( case DetachVisualization(
clientId, clientId,
contextId, contextId,
visualisationId, visualizationId,
expressionId expressionId
) => ) =>
if (store.hasContext(clientId, contextId)) { if (store.hasContext(clientId, contextId)) {
val handler = context.actorOf( val handler = context.actorOf(
DetachVisualisationHandler.props( DetachVisualizationHandler.props(
runtimeFailureMapper, runtimeFailureMapper,
timeout, timeout,
runtime runtime
) )
) )
handler.forward( handler.forward(
Api.DetachVisualisation(contextId, visualisationId, expressionId) Api.DetachVisualization(contextId, visualizationId, expressionId)
) )
} else { } else {
sender() ! AccessDenied sender() ! AccessDenied
} }
case ModifyVisualisation(clientId, visualisationId, cfg) => case ModifyVisualization(clientId, visualizationId, cfg) =>
if (store.hasContext(clientId, cfg.executionContextId)) { if (store.hasContext(clientId, cfg.executionContextId)) {
val handler = context.actorOf( val handler = context.actorOf(
ModifyVisualisationHandler.props( ModifyVisualizationHandler.props(
runtimeFailureMapper, runtimeFailureMapper,
timeout, timeout,
runtime runtime
@ -341,7 +341,7 @@ final class ContextRegistry(
) )
handler.forward( handler.forward(
Api.ModifyVisualisation(visualisationId, cfg.toApi) Api.ModifyVisualization(visualizationId, cfg.toApi)
) )
} else { } else {
sender() ! AccessDenied sender() ! AccessDenied

View File

@ -401,137 +401,137 @@ object ContextRegistryProtocol {
) )
/** Requests the language server to execute an expression provided in the /** Requests the language server to execute an expression provided in the
* `visualisationConfig` on an expression specified by `expressionId`. * `visualizationConfig` on an expression specified by `expressionId`.
* *
* @param clientId the requester id * @param clientId the requester id
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param expressionId an identifier of an expression which is visualised * @param expressionId an identifier of an expression which is visualised
* @param visualisationConfig a configuration object for properties of the * @param visualizationConfig a configuration object for properties of the
* visualisation * visualization
*/ */
case class ExecuteExpression( case class ExecuteExpression(
clientId: ClientId, clientId: ClientId,
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID, expressionId: UUID,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) extends ToLogString { ) extends ToLogString {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
"ExecuteExpression(" + "ExecuteExpression(" +
s"clientId=$clientId," + s"clientId=$clientId," +
s"visualisationId=$visualisationId," + s"visualizationId=$visualizationId," +
s"expressionId=$expressionId,visualisationConfig=" + s"expressionId=$expressionId,visualizationConfig=" +
visualisationConfig.toLogString(shouldMask) + visualizationConfig.toLogString(shouldMask) +
")" ")"
} }
/** Registers a oneshot visualisation that will be detached after the first /** Registers a oneshot visualization that will be detached after the first
* execution. * execution.
* *
* @param contextId execution context identifier * @param contextId execution context identifier
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param expressionId an identifier of an expression which is visualised * @param expressionId an identifier of an expression which is visualised
*/ */
case class RegisterOneshotVisualisation( case class RegisterOneshotVisualization(
contextId: ContextId, contextId: ContextId,
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID expressionId: UUID
) )
/** Requests the language server to attach a visualisation to the expression /** Requests the language server to attach a visualization to the expression
* specified by `expressionId`. * specified by `expressionId`.
* *
* @param clientId the requester id * @param clientId the requester id
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param expressionId an identifier of an expression which is visualised * @param expressionId an identifier of an expression which is visualised
* @param visualisationConfig a configuration object for properties of the * @param visualizationConfig a configuration object for properties of the
* visualisation * visualization
*/ */
case class AttachVisualisation( case class AttachVisualization(
clientId: ClientId, clientId: ClientId,
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID, expressionId: UUID,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) extends ToLogString { ) extends ToLogString {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
"AttachVisualisation(" + "AttachVisualization(" +
s"clientId=$clientId," + s"clientId=$clientId," +
s"visualisationId=$visualisationId," + s"visualizationId=$visualizationId," +
s"expressionId=$expressionId,visualisationConfig=" + s"expressionId=$expressionId,visualizationConfig=" +
visualisationConfig.toLogString(shouldMask) + visualizationConfig.toLogString(shouldMask) +
")" ")"
} }
/** Signals that attaching a visualisation has succeeded. */ /** Signals that attaching a visualization has succeeded. */
case object VisualisationAttached case object VisualizationAttached
/** Requests the language server to detach a visualisation from the expression /** Requests the language server to detach a visualization from the expression
* specified by `expressionId`. * specified by `expressionId`.
* *
* @param clientId the requester id * @param clientId the requester id
* @param contextId an execution context identifier * @param contextId an execution context identifier
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param expressionId an identifier of an expression which is visualised * @param expressionId an identifier of an expression which is visualised
*/ */
case class DetachVisualisation( case class DetachVisualization(
clientId: ClientId, clientId: ClientId,
contextId: UUID, contextId: UUID,
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID expressionId: UUID
) )
/** Signals that detaching a visualisation has succeeded. /** Signals that detaching a visualization has succeeded.
*/ */
case object VisualisationDetached case object VisualizationDetached
/** Requests the language server to modify a visualisation. /** Requests the language server to modify a visualization.
* *
* @param clientId the requester id * @param clientId the requester id
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param visualisationConfig a configuration object for properties of the * @param visualizationConfig a configuration object for properties of the
* visualisation * visualization
*/ */
case class ModifyVisualisation( case class ModifyVisualization(
clientId: ClientId, clientId: ClientId,
visualisationId: UUID, visualizationId: UUID,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) extends ToLogString { ) extends ToLogString {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
"ModifyVisualisation(" + "ModifyVisualization(" +
s"clientId=$clientId," + s"clientId=$clientId," +
s"visualisationId=$visualisationId,visualisationConfig=" + s"visualizationId=$visualizationId,visualizationConfig=" +
visualisationConfig.toLogString(shouldMask) + visualizationConfig.toLogString(shouldMask) +
")" ")"
} }
/** Signals that a visualisation modification has succeeded. /** Signals that a visualization modification has succeeded.
*/ */
case object VisualisationModified case object VisualizationModified
/** Represents a visualisation context. /** Represents a visualization context.
* *
* @param visualisationId a visualisation identifier * @param visualizationId a visualization identifier
* @param contextId a context identifier * @param contextId a context identifier
* @param expressionId an expression identifier * @param expressionId an expression identifier
*/ */
case class VisualisationContext( case class VisualizationContext(
visualisationId: UUID, visualizationId: UUID,
contextId: UUID, contextId: UUID,
expressionId: UUID expressionId: UUID
) )
/** An event signaling a visualisation update. /** An event signaling a visualization update.
* *
* @param visualisationContext a visualisation context * @param visualizationContext a visualization context
* @param data a visualisation data * @param data a visualization data
*/ */
case class VisualisationUpdate( case class VisualizationUpdate(
visualisationContext: VisualisationContext, visualizationContext: VisualizationContext,
data: Array[Byte] data: Array[Byte]
) )
@ -541,33 +541,33 @@ object ContextRegistryProtocol {
*/ */
case class ModuleNotFound(moduleName: String) extends Failure case class ModuleNotFound(moduleName: String) extends Failure
/** Signals that visualisation cannot be found. /** Signals that visualization cannot be found.
*/ */
case object VisualisationNotFound extends Failure case object VisualizationNotFound extends Failure
/** Signals that an expression specified in a [[AttachVisualisation]] or /** Signals that an expression specified in a [[AttachVisualization]] or
* a [[ModifyVisualisation]] cannot be evaluated. * a [[ModifyVisualization]] cannot be evaluated.
* *
* @param message the reason of the failure * @param message the reason of the failure
* @param diagnostic the detailed information about the failure * @param diagnostic the detailed information about the failure
*/ */
case class VisualisationExpressionFailed( case class VisualizationExpressionFailed(
message: String, message: String,
diagnostic: Option[ExecutionDiagnostic] diagnostic: Option[ExecutionDiagnostic]
) extends Failure ) extends Failure
/** Signals that an evaluation of a code responsible for generating /** Signals that an evaluation of a code responsible for generating
* visualisation data failed. * visualization data failed.
* *
* @param contextId a context identifier * @param contextId a context identifier
* @param visualisationId a visualisation identifier * @param visualizationId a visualization identifier
* @param expressionId an identifier of a visualised expression * @param expressionId an identifier of a visualised expression
* @param message the reason of the failure * @param message the reason of the failure
* @param diagnostic the detailed information about the error * @param diagnostic the detailed information about the error
*/ */
case class VisualisationEvaluationFailed( case class VisualizationEvaluationFailed(
contextId: UUID, contextId: UUID,
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID, expressionId: UUID,
message: String, message: String,
diagnostic: Option[ExecutionDiagnostic] diagnostic: Option[ExecutionDiagnostic]

View File

@ -18,7 +18,7 @@ object ExecutionApi {
type ContextId = UUID type ContextId = UUID
type ExpressionId = UUID type ExpressionId = UUID
type VisualisationId = UUID type VisualizationId = UUID
case object ExecutionContextCreate extends Method("executionContext/create") { case object ExecutionContextCreate extends Method("executionContext/create") {
@ -212,21 +212,21 @@ object ExecutionApi {
} }
} }
case object VisualisationEvaluationFailed case object VisualizationEvaluationFailed
extends Method("executionContext/visualisationEvaluationFailed") { extends Method("executionContext/visualizationEvaluationFailed") {
case class Params( case class Params(
contextId: ContextId, contextId: ContextId,
visualisationId: VisualisationId, visualizationId: VisualizationId,
expressionId: ExpressionId, expressionId: ExpressionId,
message: String, message: String,
diagnostic: Option[ExecutionDiagnostic] diagnostic: Option[ExecutionDiagnostic]
) )
implicit val hasParams implicit val hasParams
: HasParams.Aux[this.type, VisualisationEvaluationFailed.Params] = : HasParams.Aux[this.type, VisualizationEvaluationFailed.Params] =
new HasParams[this.type] { new HasParams[this.type] {
type Params = VisualisationEvaluationFailed.Params type Params = VisualizationEvaluationFailed.Params
} }
} }
@ -261,15 +261,15 @@ object ExecutionApi {
case class ModuleNotFoundError(moduleName: String) case class ModuleNotFoundError(moduleName: String)
extends Error(2005, s"Module not found [$moduleName]") extends Error(2005, s"Module not found [$moduleName]")
case object VisualisationNotFoundError case object VisualizationNotFoundError
extends Error(2006, s"Visualisation not found") extends Error(2006, s"Visualization not found")
case class VisualisationExpressionError( case class VisualizationExpressionError(
msg: String, msg: String,
diagnostic: Option[ContextRegistryProtocol.ExecutionDiagnostic] diagnostic: Option[ContextRegistryProtocol.ExecutionDiagnostic]
) extends Error( ) extends Error(
2007, 2007,
s"Evaluation of the visualisation expression failed [$msg]" s"Evaluation of the visualization expression failed [$msg]"
) { ) {
override def payload: Option[Json] = override def payload: Option[Json] =

View File

@ -37,14 +37,14 @@ final class RuntimeFailureMapper(contentRootManager: ContentRootManager) {
ContextRegistryProtocol.InvalidStackItemError(contextId) ContextRegistryProtocol.InvalidStackItemError(contextId)
case Api.ModuleNotFound(moduleName) => case Api.ModuleNotFound(moduleName) =>
ContextRegistryProtocol.ModuleNotFound(moduleName) ContextRegistryProtocol.ModuleNotFound(moduleName)
case Api.VisualisationExpressionFailed(message, result) => case Api.VisualizationExpressionFailed(message, result) =>
for (diagnostic <- result.map(toProtocolDiagnostic).sequence) for (diagnostic <- result.map(toProtocolDiagnostic).sequence)
yield ContextRegistryProtocol.VisualisationExpressionFailed( yield ContextRegistryProtocol.VisualizationExpressionFailed(
message, message,
diagnostic diagnostic
) )
case Api.VisualisationNotFound() => case Api.VisualizationNotFound() =>
ContextRegistryProtocol.VisualisationNotFound ContextRegistryProtocol.VisualizationNotFound
} }
} }
@ -160,11 +160,11 @@ object RuntimeFailureMapper {
EmptyStackError EmptyStackError
case ContextRegistryProtocol.InvalidStackItemError(_) => case ContextRegistryProtocol.InvalidStackItemError(_) =>
InvalidStackItemError InvalidStackItemError
case ContextRegistryProtocol.VisualisationNotFound => case ContextRegistryProtocol.VisualizationNotFound =>
VisualisationNotFoundError VisualizationNotFoundError
case ContextRegistryProtocol.ModuleNotFound(name) => case ContextRegistryProtocol.ModuleNotFound(name) =>
ModuleNotFoundError(name) ModuleNotFoundError(name)
case ContextRegistryProtocol.VisualisationExpressionFailed(msg, result) => case ContextRegistryProtocol.VisualizationExpressionFailed(msg, result) =>
VisualisationExpressionError(msg, result) VisualizationExpressionError(msg, result)
} }
} }

View File

@ -4,19 +4,19 @@ import java.util.UUID
import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused} import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused}
/** The visualisation JSON RPC API provided by the language server. /** The visualization JSON RPC API provided by the language server.
* *
* @see [[https://github.com/enso-org/enso/blob/develop/docs/language-server/README.md]] * @see [[https://github.com/enso-org/enso/blob/develop/docs/language-server/README.md]]
*/ */
object VisualisationApi { object VisualizationApi {
case object ExecuteExpression case object ExecuteExpression
extends Method("executionContext/executeExpression") { extends Method("executionContext/executeExpression") {
case class Params( case class Params(
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID, expressionId: UUID,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) )
implicit val hasParams: HasParams.Aux[this.type, ExecuteExpression.Params] = implicit val hasParams: HasParams.Aux[this.type, ExecuteExpression.Params] =
@ -29,19 +29,19 @@ object VisualisationApi {
} }
} }
case object AttachVisualisation case object AttachVisualization
extends Method("executionContext/attachVisualisation") { extends Method("executionContext/attachVisualization") {
case class Params( case class Params(
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID, expressionId: UUID,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) )
implicit implicit
val hasParams: HasParams.Aux[this.type, AttachVisualisation.Params] = val hasParams: HasParams.Aux[this.type, AttachVisualization.Params] =
new HasParams[this.type] { new HasParams[this.type] {
type Params = AttachVisualisation.Params type Params = AttachVisualization.Params
} }
implicit val hasResult: HasResult.Aux[this.type, Unused.type] = implicit val hasResult: HasResult.Aux[this.type, Unused.type] =
new HasResult[this.type] { new HasResult[this.type] {
@ -49,19 +49,19 @@ object VisualisationApi {
} }
} }
case object DetachVisualisation case object DetachVisualization
extends Method("executionContext/detachVisualisation") { extends Method("executionContext/detachVisualization") {
case class Params( case class Params(
contextId: UUID, contextId: UUID,
visualisationId: UUID, visualizationId: UUID,
expressionId: UUID expressionId: UUID
) )
implicit implicit
val hasParams: HasParams.Aux[this.type, DetachVisualisation.Params] = val hasParams: HasParams.Aux[this.type, DetachVisualization.Params] =
new HasParams[this.type] { new HasParams[this.type] {
type Params = DetachVisualisation.Params type Params = DetachVisualization.Params
} }
implicit val hasResult: HasResult.Aux[this.type, Unused.type] = implicit val hasResult: HasResult.Aux[this.type, Unused.type] =
new HasResult[this.type] { new HasResult[this.type] {
@ -69,18 +69,18 @@ object VisualisationApi {
} }
} }
case object ModifyVisualisation case object ModifyVisualization
extends Method("executionContext/modifyVisualisation") { extends Method("executionContext/modifyVisualization") {
case class Params( case class Params(
visualisationId: UUID, visualizationId: UUID,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) )
implicit implicit
val hasParams: HasParams.Aux[this.type, ModifyVisualisation.Params] = val hasParams: HasParams.Aux[this.type, ModifyVisualization.Params] =
new HasParams[this.type] { new HasParams[this.type] {
type Params = ModifyVisualisation.Params type Params = ModifyVisualization.Params
} }
implicit val hasResult: HasResult.Aux[this.type, Unused.type] = implicit val hasResult: HasResult.Aux[this.type, Unused.type] =
new HasResult[this.type] { new HasResult[this.type] {

View File

@ -8,69 +8,69 @@ import org.enso.polyglot.runtime.Runtime.Api
import java.util.UUID import java.util.UUID
/** A configuration object for properties of the visualisation. /** A configuration object for properties of the visualization.
* *
* @param executionContextId an execution context of the visualisation * @param executionContextId an execution context of the visualization
* @param expression an expression that creates a visualisation * @param expression an expression that creates a visualization
*/ */
case class VisualisationConfiguration( case class VisualizationConfiguration(
executionContextId: UUID, executionContextId: UUID,
expression: VisualisationExpression expression: VisualizationExpression
) extends ToLogString { ) extends ToLogString {
/** A qualified module name containing the expression. */ /** A qualified module name containing the expression. */
def visualisationModule: String = def visualizationModule: String =
expression.module expression.module
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
s"VisualisationConfiguration(" + s"VisualizationConfiguration(" +
s"executionContextId=$executionContextId," + s"executionContextId=$executionContextId," +
s"expression=${expression.toLogString(shouldMask)})" s"expression=${expression.toLogString(shouldMask)})"
/** Convert to corresponding [[Api]] message. */ /** Convert to corresponding [[Api]] message. */
def toApi: Api.VisualisationConfiguration = def toApi: Api.VisualizationConfiguration =
Api.VisualisationConfiguration( Api.VisualizationConfiguration(
executionContextId = executionContextId, executionContextId = executionContextId,
expression = expression.toApi expression = expression.toApi
) )
} }
object VisualisationConfiguration { object VisualizationConfiguration {
/** Create a visualisation configuration. /** Create a visualization configuration.
* *
* @param contextId an execution context of the visualisation * @param contextId an execution context of the visualization
* @param module a qualified module name containing the visualisation * @param module a qualified module name containing the visualization
* @param expression a visualisation expression * @param expression a visualization expression
* @return an instance of [[VisualisationConfiguration]] * @return an instance of [[VisualizationConfiguration]]
*/ */
def apply( def apply(
contextId: UUID, contextId: UUID,
module: String, module: String,
expression: String expression: String
): VisualisationConfiguration = ): VisualizationConfiguration =
new VisualisationConfiguration( new VisualizationConfiguration(
contextId, contextId,
VisualisationExpression.Text(module, expression) VisualizationExpression.Text(module, expression)
) )
/** Create a visualisation configuration. /** Create a visualization configuration.
* *
* @param contextId an execution context of the visualisation * @param contextId an execution context of the visualization
* @param expression a visualisation expression * @param expression a visualization expression
* @param positionalArgumentsExpressions the list of arguments that will * @param positionalArgumentsExpressions the list of arguments that will
* be passed to the visualisation expression * be passed to the visualization expression
* @return an instance of [[VisualisationConfiguration]] * @return an instance of [[VisualizationConfiguration]]
*/ */
def apply( def apply(
contextId: UUID, contextId: UUID,
expression: MethodPointer, expression: MethodPointer,
positionalArgumentsExpressions: Vector[String] positionalArgumentsExpressions: Vector[String]
): VisualisationConfiguration = ): VisualizationConfiguration =
new VisualisationConfiguration( new VisualizationConfiguration(
contextId, contextId,
VisualisationExpression.ModuleMethod( VisualizationExpression.ModuleMethod(
expression, expression,
positionalArgumentsExpressions positionalArgumentsExpressions
) )
@ -84,11 +84,11 @@ object VisualisationConfiguration {
val ExecutionContextId = "executionContextId" val ExecutionContextId = "executionContextId"
val VisualisationModule = "visualisationModule" val VisualizationModule = "visualizationModule"
} }
/** Json decoder that supports both old and new formats. */ /** Json decoder that supports both old and new formats. */
implicit val decoder: Decoder[VisualisationConfiguration] = implicit val decoder: Decoder[VisualizationConfiguration] =
Decoder.instance { cursor => Decoder.instance { cursor =>
cursor.downField(CodecField.Expression).as[String] match { cursor.downField(CodecField.Expression).as[String] match {
case Left(_) => case Left(_) =>
@ -102,7 +102,7 @@ object VisualisationConfiguration {
arguments <- cursor arguments <- cursor
.downField(CodecField.Arguments) .downField(CodecField.Arguments)
.as[Option[Vector[String]]] .as[Option[Vector[String]]]
} yield VisualisationConfiguration( } yield VisualizationConfiguration(
contextId, contextId,
expression, expression,
arguments.getOrElse(Vector()) arguments.getOrElse(Vector())
@ -113,28 +113,28 @@ object VisualisationConfiguration {
contextId <- cursor contextId <- cursor
.downField(CodecField.ExecutionContextId) .downField(CodecField.ExecutionContextId)
.as[UUID] .as[UUID]
visualisationModule <- cursor visualizationModule <- cursor
.downField(CodecField.VisualisationModule) .downField(CodecField.VisualizationModule)
.as[String] .as[String]
} yield VisualisationConfiguration( } yield VisualizationConfiguration(
contextId, contextId,
visualisationModule, visualizationModule,
expression expression
) )
} }
} }
} }
/** A visualisation expression. */ /** A visualization expression. */
sealed trait VisualisationExpression extends ToLogString { sealed trait VisualizationExpression extends ToLogString {
/** A qualified module name. */ /** A qualified module name. */
def module: String def module: String
/** Convert to corresponding [[Api]] message. */ /** Convert to corresponding [[Api]] message. */
def toApi: Api.VisualisationExpression def toApi: Api.VisualizationExpression
} }
object VisualisationExpression { object VisualizationExpression {
/** Visualization expression represented as a text. /** Visualization expression represented as a text.
* *
@ -142,11 +142,11 @@ object VisualisationExpression {
* @param expression an expression that creates a visualization * @param expression an expression that creates a visualization
*/ */
case class Text(module: String, expression: String) case class Text(module: String, expression: String)
extends VisualisationExpression { extends VisualizationExpression {
/** @inheritdoc */ /** @inheritdoc */
override def toApi: Api.VisualisationExpression = override def toApi: Api.VisualizationExpression =
Api.VisualisationExpression.Text(module, expression) Api.VisualizationExpression.Text(module, expression)
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
@ -165,14 +165,14 @@ object VisualisationExpression {
case class ModuleMethod( case class ModuleMethod(
methodPointer: MethodPointer, methodPointer: MethodPointer,
positionalArgumentsExpressions: Vector[String] positionalArgumentsExpressions: Vector[String]
) extends VisualisationExpression { ) extends VisualizationExpression {
/** @inheritdoc */ /** @inheritdoc */
override val module: String = methodPointer.module override val module: String = methodPointer.module
/** @inheritdoc */ /** @inheritdoc */
override def toApi: Api.VisualisationExpression = override def toApi: Api.VisualizationExpression =
Api.VisualisationExpression.ModuleMethod( Api.VisualizationExpression.ModuleMethod(
methodPointer.toApi, methodPointer.toApi,
positionalArgumentsExpressions positionalArgumentsExpressions
) )
@ -196,29 +196,29 @@ object VisualisationExpression {
val ModuleMethod = "ModuleMethod" val ModuleMethod = "ModuleMethod"
} }
implicit val encoder: Encoder[VisualisationExpression] = implicit val encoder: Encoder[VisualizationExpression] =
Encoder.instance[VisualisationExpression] { Encoder.instance[VisualizationExpression] {
case text: VisualisationExpression.Text => case text: VisualizationExpression.Text =>
Encoder[VisualisationExpression.Text] Encoder[VisualizationExpression.Text]
.apply(text) .apply(text)
.deepMerge(Json.obj(CodecField.Type -> PayloadType.Text.asJson)) .deepMerge(Json.obj(CodecField.Type -> PayloadType.Text.asJson))
case moduleMethod: VisualisationExpression.ModuleMethod => case moduleMethod: VisualizationExpression.ModuleMethod =>
Encoder[VisualisationExpression.ModuleMethod] Encoder[VisualizationExpression.ModuleMethod]
.apply(moduleMethod) .apply(moduleMethod)
.deepMerge( .deepMerge(
Json.obj(CodecField.Type -> PayloadType.ModuleMethod.asJson) Json.obj(CodecField.Type -> PayloadType.ModuleMethod.asJson)
) )
} }
implicit val decoder: Decoder[VisualisationExpression] = implicit val decoder: Decoder[VisualizationExpression] =
Decoder.instance { cursor => Decoder.instance { cursor =>
cursor.downField(CodecField.Type).as[String].flatMap { cursor.downField(CodecField.Type).as[String].flatMap {
case PayloadType.Text => case PayloadType.Text =>
Decoder[VisualisationExpression.Text].tryDecode(cursor) Decoder[VisualizationExpression.Text].tryDecode(cursor)
case PayloadType.ModuleMethod => case PayloadType.ModuleMethod =>
Decoder[VisualisationExpression.ModuleMethod].tryDecode(cursor) Decoder[VisualizationExpression.ModuleMethod].tryDecode(cursor)
} }
} }

View File

@ -14,13 +14,13 @@ import org.enso.polyglot.runtime.Runtime.Api
import java.util.UUID import java.util.UUID
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** A request handler for attach visualisation commands. /** A request handler for attach visualization commands.
* *
* @param runtimeFailureMapper mapper for runtime failures * @param runtimeFailureMapper mapper for runtime failures
* @param timeout request timeout * @param timeout request timeout
* @param runtime reference to the runtime connector * @param runtime reference to the runtime connector
*/ */
class AttachVisualisationHandler( class AttachVisualizationHandler(
runtimeFailureMapper: RuntimeFailureMapper, runtimeFailureMapper: RuntimeFailureMapper,
timeout: FiniteDuration, timeout: FiniteDuration,
runtime: ActorRef runtime: ActorRef
@ -32,7 +32,7 @@ class AttachVisualisationHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { case msg: Api.AttachVisualisation => private def requestStage: Receive = { case msg: Api.AttachVisualization =>
runtime ! Api.Request(UUID.randomUUID(), msg) runtime ! Api.Request(UUID.randomUUID(), msg)
val cancellable = val cancellable =
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
@ -47,8 +47,8 @@ class AttachVisualisationHandler(
replyTo ! RequestTimeout replyTo ! RequestTimeout
context.stop(self) context.stop(self)
case Api.Response(_, Api.VisualisationAttached()) => case Api.Response(_, Api.VisualizationAttached()) =>
replyTo ! ContextRegistryProtocol.VisualisationAttached replyTo ! ContextRegistryProtocol.VisualizationAttached
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)
@ -60,9 +60,9 @@ class AttachVisualisationHandler(
} }
object AttachVisualisationHandler { object AttachVisualizationHandler {
/** Creates configuration object used to create a [[AttachVisualisationHandler]]. /** Creates configuration object used to create a [[AttachVisualizationHandler]].
* *
* @param runtimeFailureMapper mapper for runtime failures * @param runtimeFailureMapper mapper for runtime failures
* @param timeout request timeout * @param timeout request timeout
@ -74,7 +74,7 @@ object AttachVisualisationHandler {
runtime: ActorRef runtime: ActorRef
): Props = ): Props =
Props( Props(
new AttachVisualisationHandler(runtimeFailureMapper, timeout, runtime) new AttachVisualizationHandler(runtimeFailureMapper, timeout, runtime)
) )
} }

View File

@ -14,13 +14,13 @@ import org.enso.polyglot.runtime.Runtime.Api
import java.util.UUID import java.util.UUID
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** A request handler for detach visualisation commands. /** A request handler for detach visualization commands.
* *
* @param runtimeFailureMapper mapper for runtime failures * @param runtimeFailureMapper mapper for runtime failures
* @param timeout request timeout * @param timeout request timeout
* @param runtime reference to the runtime connector * @param runtime reference to the runtime connector
*/ */
class DetachVisualisationHandler( class DetachVisualizationHandler(
runtimeFailureMapper: RuntimeFailureMapper, runtimeFailureMapper: RuntimeFailureMapper,
timeout: FiniteDuration, timeout: FiniteDuration,
runtime: ActorRef runtime: ActorRef
@ -32,7 +32,7 @@ class DetachVisualisationHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { case msg: Api.DetachVisualisation => private def requestStage: Receive = { case msg: Api.DetachVisualization =>
runtime ! Api.Request(UUID.randomUUID(), msg) runtime ! Api.Request(UUID.randomUUID(), msg)
val cancellable = val cancellable =
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
@ -47,8 +47,8 @@ class DetachVisualisationHandler(
replyTo ! RequestTimeout replyTo ! RequestTimeout
context.stop(self) context.stop(self)
case Api.Response(_, Api.VisualisationDetached()) => case Api.Response(_, Api.VisualizationDetached()) =>
replyTo ! ContextRegistryProtocol.VisualisationDetached replyTo ! ContextRegistryProtocol.VisualizationDetached
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)
@ -60,9 +60,9 @@ class DetachVisualisationHandler(
} }
object DetachVisualisationHandler { object DetachVisualizationHandler {
/** Creates configuration object used to create a [[DetachVisualisationHandler]]. /** Creates configuration object used to create a [[DetachVisualizationHandler]].
* *
* @param runtimeFailureMapper mapper for runtime failures * @param runtimeFailureMapper mapper for runtime failures
* @param timeout request timeout * @param timeout request timeout
@ -74,7 +74,7 @@ object DetachVisualisationHandler {
runtime: ActorRef runtime: ActorRef
): Props = ): Props =
Props( Props(
new DetachVisualisationHandler(runtimeFailureMapper, timeout, runtime) new DetachVisualizationHandler(runtimeFailureMapper, timeout, runtime)
) )
} }

View File

@ -14,13 +14,13 @@ import org.enso.polyglot.runtime.Runtime.Api
import java.util.UUID import java.util.UUID
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** A request handler for modify visualisation commands. /** A request handler for modify visualization commands.
* *
* @param runtimeFailureMapper mapper for runtime failures * @param runtimeFailureMapper mapper for runtime failures
* @param timeout request timeout * @param timeout request timeout
* @param runtime reference to the runtime connector * @param runtime reference to the runtime connector
*/ */
class ModifyVisualisationHandler( class ModifyVisualizationHandler(
runtimeFailureMapper: RuntimeFailureMapper, runtimeFailureMapper: RuntimeFailureMapper,
timeout: FiniteDuration, timeout: FiniteDuration,
runtime: ActorRef runtime: ActorRef
@ -32,7 +32,7 @@ class ModifyVisualisationHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { case msg: Api.ModifyVisualisation => private def requestStage: Receive = { case msg: Api.ModifyVisualization =>
runtime ! Api.Request(UUID.randomUUID(), msg) runtime ! Api.Request(UUID.randomUUID(), msg)
val cancellable = val cancellable =
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
@ -47,8 +47,8 @@ class ModifyVisualisationHandler(
replyTo ! RequestTimeout replyTo ! RequestTimeout
context.stop(self) context.stop(self)
case Api.Response(_, Api.VisualisationModified()) => case Api.Response(_, Api.VisualizationModified()) =>
replyTo ! ContextRegistryProtocol.VisualisationModified replyTo ! ContextRegistryProtocol.VisualizationModified
cancellable.cancel() cancellable.cancel()
context.stop(self) context.stop(self)
@ -60,9 +60,9 @@ class ModifyVisualisationHandler(
} }
object ModifyVisualisationHandler { object ModifyVisualizationHandler {
/** Creates configuration object used to create a [[ModifyVisualisationHandler]]. /** Creates configuration object used to create a [[ModifyVisualizationHandler]].
* *
* @param runtimeFailureMapper mapper for runtime failures * @param runtimeFailureMapper mapper for runtime failures
* @param timeout request timeout * @param timeout request timeout
@ -74,7 +74,7 @@ object ModifyVisualisationHandler {
runtime: ActorRef runtime: ActorRef
): Props = ): Props =
Props( Props(
new ModifyVisualisationHandler(runtimeFailureMapper, timeout, runtime) new ModifyVisualizationHandler(runtimeFailureMapper, timeout, runtime)
) )
} }

View File

@ -26,7 +26,7 @@ table InboundMessage {
union OutboundPayload { union OutboundPayload {
ERROR: Error, ERROR: Error,
SUCCESS: Success, SUCCESS: Success,
VISUALISATION_UPDATE: VisualisationUpdate, VISUALIZATION_UPDATE: VisualizationUpdate,
FILE_CONTENTS_REPLY: FileContentsReply, FILE_CONTENTS_REPLY: FileContentsReply,
WRITE_BYTES_REPLY: WriteBytesReply, WRITE_BYTES_REPLY: WriteBytesReply,
READ_BYTES_REPLY: ReadBytesReply, READ_BYTES_REPLY: ReadBytesReply,
@ -94,10 +94,10 @@ table InitSessionCommand {
root_type InitSessionCommand; root_type InitSessionCommand;
// A visualisation context identifying a concrete visualisation. // A visualization context identifying a concrete visualization.
table VisualisationContext { table VisualizationContext {
// A visualisation identifier. // A visualization identifier.
visualisationId: EnsoUUID (required); visualizationId: EnsoUUID (required);
// A context identifier. // A context identifier.
contextId: EnsoUUID (required); contextId: EnsoUUID (required);
@ -107,12 +107,12 @@ table VisualisationContext {
} }
// An event signaling visualisation update. // An event signaling visualization update.
table VisualisationUpdate { table VisualizationUpdate {
// A visualisation context identifying a concrete visualisation. // A visualization context identifying a concrete visualization.
visualisationContext: VisualisationContext (required); visualizationContext: VisualizationContext (required);
// A visualisation data. // A visualization data.
data: [ubyte] (required); data: [ubyte] (required);
} }

View File

@ -234,26 +234,26 @@ class ContextEventsListenerSpec
"register oneshot visualization" taggedAs Retry in withEventsListener { "register oneshot visualization" taggedAs Retry in withEventsListener {
(clientId, contextId, router, registry, listener) => (clientId, contextId, router, registry, listener) =>
val ctx = Api.VisualisationContext( val ctx = Api.VisualizationContext(
UUID.randomUUID(), UUID.randomUUID(),
contextId, contextId,
UUID.randomUUID() UUID.randomUUID()
) )
listener ! RegisterOneshotVisualisation( listener ! RegisterOneshotVisualization(
ctx.contextId, ctx.contextId,
ctx.visualisationId, ctx.visualizationId,
ctx.expressionId ctx.expressionId
) )
val data1 = Array[Byte](1, 2, 3) val data1 = Array[Byte](1, 2, 3)
listener ! Api.VisualisationUpdate(ctx, data1) listener ! Api.VisualizationUpdate(ctx, data1)
router.expectMsg( router.expectMsg(
DeliverToBinaryController( DeliverToBinaryController(
clientId, clientId,
VisualisationUpdate( VisualizationUpdate(
VisualisationContext( VisualizationContext(
ctx.visualisationId, ctx.visualizationId,
ctx.contextId, ctx.contextId,
ctx.expressionId ctx.expressionId
), ),
@ -262,22 +262,22 @@ class ContextEventsListenerSpec
) )
) )
registry.expectMsg( registry.expectMsg(
DetachVisualisation( DetachVisualization(
clientId, clientId,
ctx.contextId, ctx.contextId,
ctx.visualisationId, ctx.visualizationId,
ctx.expressionId ctx.expressionId
) )
) )
val data2 = Array[Byte](2, 3, 4) val data2 = Array[Byte](2, 3, 4)
listener ! Api.VisualisationUpdate(ctx, data2) listener ! Api.VisualizationUpdate(ctx, data2)
router.expectMsg( router.expectMsg(
DeliverToBinaryController( DeliverToBinaryController(
clientId, clientId,
VisualisationUpdate( VisualizationUpdate(
VisualisationContext( VisualizationContext(
ctx.visualisationId, ctx.visualizationId,
ctx.contextId, ctx.contextId,
ctx.expressionId ctx.expressionId
), ),
@ -290,20 +290,20 @@ class ContextEventsListenerSpec
"send visualization updates" taggedAs Retry in withEventsListener { "send visualization updates" taggedAs Retry in withEventsListener {
(clientId, contextId, router, registry, listener) => (clientId, contextId, router, registry, listener) =>
val ctx = Api.VisualisationContext( val ctx = Api.VisualizationContext(
UUID.randomUUID(), UUID.randomUUID(),
contextId, contextId,
UUID.randomUUID() UUID.randomUUID()
) )
val data1 = Array[Byte](1, 2, 3) val data1 = Array[Byte](1, 2, 3)
listener ! Api.VisualisationUpdate(ctx, data1) listener ! Api.VisualizationUpdate(ctx, data1)
router.expectMsg( router.expectMsg(
DeliverToBinaryController( DeliverToBinaryController(
clientId, clientId,
VisualisationUpdate( VisualizationUpdate(
VisualisationContext( VisualizationContext(
ctx.visualisationId, ctx.visualizationId,
ctx.contextId, ctx.contextId,
ctx.expressionId ctx.expressionId
), ),
@ -314,13 +314,13 @@ class ContextEventsListenerSpec
registry.expectNoMessage() registry.expectNoMessage()
val data2 = Array[Byte](2, 3, 4) val data2 = Array[Byte](2, 3, 4)
listener ! Api.VisualisationUpdate(ctx, data2) listener ! Api.VisualizationUpdate(ctx, data2)
router.expectMsg( router.expectMsg(
DeliverToBinaryController( DeliverToBinaryController(
clientId, clientId,
VisualisationUpdate( VisualizationUpdate(
VisualisationContext( VisualizationContext(
ctx.visualisationId, ctx.visualizationId,
ctx.contextId, ctx.contextId,
ctx.expressionId ctx.expressionId
), ),
@ -393,14 +393,14 @@ class ContextEventsListenerSpec
) )
} }
"send visualisation evaluation failed notification" taggedAs Retry in withEventsListener { "send visualization evaluation failed notification" taggedAs Retry in withEventsListener {
(clientId, contextId, router, _, listener) => (clientId, contextId, router, _, listener) =>
val message = "Test visualisation evaluation failed" val message = "Test visualization evaluation failed"
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
listener ! Api.VisualisationEvaluationFailed( listener ! Api.VisualizationEvaluationFailed(
contextId, contextId,
visualisationId, visualizationId,
expressionId, expressionId,
message, message,
None None
@ -409,9 +409,9 @@ class ContextEventsListenerSpec
router.expectMsg( router.expectMsg(
DeliverToJsonController( DeliverToJsonController(
clientId, clientId,
VisualisationEvaluationFailed( VisualizationEvaluationFailed(
contextId, contextId,
visualisationId, visualizationId,
expressionId, expressionId,
message, message,
None None

View File

@ -6,17 +6,17 @@ import java.util.UUID
import org.enso.languageserver.protocol.binary.{ import org.enso.languageserver.protocol.binary.{
OutboundMessage, OutboundMessage,
OutboundPayload, OutboundPayload,
VisualisationUpdate => BinaryVisualisationUpdate VisualizationUpdate => BinaryVisualizationUpdate
} }
import org.enso.languageserver.runtime.ContextRegistryProtocol.{ import org.enso.languageserver.runtime.ContextRegistryProtocol.{
VisualisationContext, VisualizationContext,
VisualisationUpdate VisualizationUpdate
} }
import org.enso.languageserver.util.binary.BinaryDecoder import org.enso.languageserver.util.binary.BinaryDecoder
import org.enso.testkit.FlakySpec import org.enso.testkit.FlakySpec
import org.scalatest.concurrent.Eventually import org.scalatest.concurrent.Eventually
class VisualisationProtocolTest class VisualizationProtocolTest
extends BaseBinaryServerTest extends BaseBinaryServerTest
with Eventually with Eventually
with FlakySpec { with FlakySpec {
@ -24,13 +24,13 @@ class VisualisationProtocolTest
implicit private val decoder: BinaryDecoder[OutboundMessage] = implicit private val decoder: BinaryDecoder[OutboundMessage] =
OutboundMessageDecoder OutboundMessageDecoder
"A visualisation binary protocol" must { "A visualization binary protocol" must {
"push visualisation updates when controller receives notification" taggedAs Flaky in { "push visualization updates when controller receives notification" taggedAs Flaky in {
//given //given
val client = newWsClient() val client = newWsClient()
val data = Array[Byte](1, 2, 3) val data = Array[Byte](1, 2, 3)
val ctx = VisualisationContext( val ctx = VisualizationContext(
UUID.randomUUID(), UUID.randomUUID(),
UUID.randomUUID(), UUID.randomUUID(),
UUID.randomUUID() UUID.randomUUID()
@ -38,38 +38,38 @@ class VisualisationProtocolTest
client.send(createSessionInitCmd()) client.send(createSessionInitCmd())
client.expectFrame() client.expectFrame()
//when //when
lastConnectionController ! VisualisationUpdate(ctx, data) lastConnectionController ! VisualizationUpdate(ctx, data)
val Right(msg) = client.receiveMessage[OutboundMessage]() val Right(msg) = client.receiveMessage[OutboundMessage]()
//then //then
msg.payloadType() shouldBe OutboundPayload.VISUALISATION_UPDATE msg.payloadType() shouldBe OutboundPayload.VISUALIZATION_UPDATE
val payload = msg val payload = msg
.payload(new BinaryVisualisationUpdate) .payload(new BinaryVisualizationUpdate)
.asInstanceOf[BinaryVisualisationUpdate] .asInstanceOf[BinaryVisualizationUpdate]
payload.dataAsByteBuffer().compareTo(ByteBuffer.wrap(data)) shouldBe 0 payload.dataAsByteBuffer().compareTo(ByteBuffer.wrap(data)) shouldBe 0
payload payload
.visualisationContext() .visualizationContext()
.contextId() .contextId()
.leastSigBits() shouldBe ctx.contextId.getLeastSignificantBits .leastSigBits() shouldBe ctx.contextId.getLeastSignificantBits
payload payload
.visualisationContext() .visualizationContext()
.contextId() .contextId()
.mostSigBits() shouldBe ctx.contextId.getMostSignificantBits .mostSigBits() shouldBe ctx.contextId.getMostSignificantBits
payload payload
.visualisationContext() .visualizationContext()
.expressionId() .expressionId()
.leastSigBits() shouldBe ctx.expressionId.getLeastSignificantBits .leastSigBits() shouldBe ctx.expressionId.getLeastSignificantBits
payload payload
.visualisationContext() .visualizationContext()
.expressionId() .expressionId()
.mostSigBits() shouldBe ctx.expressionId.getMostSignificantBits .mostSigBits() shouldBe ctx.expressionId.getMostSignificantBits
payload payload
.visualisationContext() .visualizationContext()
.visualisationId() .visualizationId()
.leastSigBits() shouldBe ctx.visualisationId.getLeastSignificantBits .leastSigBits() shouldBe ctx.visualizationId.getLeastSignificantBits
payload payload
.visualisationContext() .visualizationContext()
.visualisationId() .visualizationId()
.mostSigBits() shouldBe ctx.visualisationId.getMostSignificantBits .mostSigBits() shouldBe ctx.visualizationId.getMostSignificantBits
} }
} }

View File

@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json
import io.circe.literal._ import io.circe.literal._
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
TestComponentGroups, TestComponentGroups,
VisualisationConfiguration VisualizationConfiguration
} }
import org.enso.languageserver.websocket.json.{ import org.enso.languageserver.websocket.json.{
ExecutionContextJsonMessages => json ExecutionContextJsonMessages => json
@ -628,15 +628,15 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// attach visualisation // attach visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
client.send( client.send(
json.executionContextExecuteExpressionRequest( json.executionContextExecuteExpressionRequest(
2, 2,
visualisationId, visualizationId,
expressionId, expressionId,
config config
) )
@ -645,8 +645,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
_ _
) )
@ -657,7 +657,7 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.VisualisationAttached() Api.VisualizationAttached()
) )
client.expectJson(json.ok(2)) client.expectJson(json.ok(2))
} }
@ -680,15 +680,15 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// attach visualisation // attach visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
client.send( client.send(
json.executionContextExecuteExpressionRequest( json.executionContextExecuteExpressionRequest(
2, 2,
visualisationId, visualizationId,
expressionId, expressionId,
config config
) )
@ -697,8 +697,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
_ _
) )
@ -709,17 +709,17 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.ModuleNotFound(config.visualisationModule) Api.ModuleNotFound(config.visualizationModule)
) )
client.expectJson( client.expectJson(
json.executionContextModuleNotFound( json.executionContextModuleNotFound(
2, 2,
config.visualisationModule config.visualizationModule
) )
) )
} }
"successfully attach visualisation" in { "successfully attach visualization" in {
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
// create context // create context
@ -737,15 +737,15 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// attach visualisation // attach visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
client.send( client.send(
json.executionContextAttachVisualisationRequest( json.executionContextAttachVisualizationRequest(
2, 2,
visualisationId, visualizationId,
expressionId, expressionId,
config config
) )
@ -754,8 +754,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
_ _
) )
@ -766,12 +766,12 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.VisualisationAttached() Api.VisualizationAttached()
) )
client.expectJson(json.ok(2)) client.expectJson(json.ok(2))
} }
"return ModuleNotFound error when attaching visualisation" in { "return ModuleNotFound error when attaching visualization" in {
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
// create context // create context
@ -789,15 +789,15 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// attach visualisation // attach visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
client.send( client.send(
json.executionContextAttachVisualisationRequest( json.executionContextAttachVisualizationRequest(
2, 2,
visualisationId, visualizationId,
expressionId, expressionId,
config config
) )
@ -806,8 +806,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
_ _
) )
@ -818,17 +818,17 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.ModuleNotFound(config.visualisationModule) Api.ModuleNotFound(config.visualizationModule)
) )
client.expectJson( client.expectJson(
json.executionContextModuleNotFound( json.executionContextModuleNotFound(
2, 2,
config.visualisationModule config.visualizationModule
) )
) )
} }
"return VisualisationExpressionFailed error when attaching visualisation" in { "return VisualizationExpressionFailed error when attaching visualization" in {
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
// create context // create context
@ -846,16 +846,16 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// attach visualisation // attach visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
val expressionFailureMessage = "Method `to_json` could not be found." val expressionFailureMessage = "Method `to_json` could not be found."
client.send( client.send(
json.executionContextAttachVisualisationRequest( json.executionContextAttachVisualizationRequest(
2, 2,
visualisationId, visualizationId,
expressionId, expressionId,
config config
) )
@ -864,8 +864,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
_ _
) )
@ -876,17 +876,17 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.VisualisationExpressionFailed(expressionFailureMessage, None) Api.VisualizationExpressionFailed(expressionFailureMessage, None)
) )
client.expectJson( client.expectJson(
json.executionContextVisualisationExpressionFailed( json.executionContextVisualizationExpressionFailed(
2, 2,
expressionFailureMessage expressionFailureMessage
) )
) )
} }
"successfully detach visualisation" in { "successfully detach visualization" in {
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
// create context // create context
@ -904,14 +904,14 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// detach visualisation // detach visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
client.send( client.send(
json.executionContextDetachVisualisationRequest( json.executionContextDetachVisualizationRequest(
2, 2,
contextId, contextId,
visualisationId, visualizationId,
expressionId expressionId
) )
) )
@ -919,9 +919,9 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.DetachVisualisation( Api.DetachVisualization(
`contextId`, `contextId`,
`visualisationId`, `visualizationId`,
`expressionId` `expressionId`
) )
) => ) =>
@ -931,12 +931,12 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.VisualisationDetached() Api.VisualizationDetached()
) )
client.expectJson(json.ok(2)) client.expectJson(json.ok(2))
} }
"successfully modify visualisation" in { "successfully modify visualization" in {
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
// create context // create context
@ -954,14 +954,14 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// modify visualisation // modify visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
client.send( client.send(
json.executionContextModifyVisualisationRequest( json.executionContextModifyVisualizationRequest(
2, 2,
visualisationId, visualizationId,
config config
) )
) )
@ -969,8 +969,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.ModifyVisualisation( Api.ModifyVisualization(
`visualisationId`, `visualizationId`,
_ _
) )
) => ) =>
@ -980,12 +980,12 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.VisualisationModified() Api.VisualizationModified()
) )
client.expectJson(json.ok(2)) client.expectJson(json.ok(2))
} }
"return VisualisationNotFound error when modifying visualisation" in { "return VisualizationNotFound error when modifying visualization" in {
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
// create context // create context
@ -1003,14 +1003,14 @@ class ContextRegistryTest extends BaseServerTest {
) )
client.expectJson(json.executionContextCreateResponse(1, contextId)) client.expectJson(json.executionContextCreateResponse(1, contextId))
// modify visualisation // modify visualization
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val config = val config =
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text") VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
client.send( client.send(
json.executionContextModifyVisualisationRequest( json.executionContextModifyVisualizationRequest(
2, 2,
visualisationId, visualizationId,
config config
) )
) )
@ -1018,8 +1018,8 @@ class ContextRegistryTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.ModifyVisualisation( Api.ModifyVisualization(
`visualisationId`, `visualizationId`,
_ _
) )
) => ) =>
@ -1029,9 +1029,9 @@ class ContextRegistryTest extends BaseServerTest {
} }
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId2, requestId2,
Api.VisualisationNotFound() Api.VisualizationNotFound()
) )
client.expectJson(json.executionContextVisualisationNotFound(2)) client.expectJson(json.executionContextVisualizationNotFound(2))
} }
"get component groups" in { "get component groups" in {

View File

@ -3,8 +3,8 @@ 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._
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
VisualisationConfiguration, VisualizationConfiguration,
VisualisationExpression VisualizationExpression
} }
object ExecutionContextJsonMessages { object ExecutionContextJsonMessages {
@ -109,36 +109,36 @@ object ExecutionContextJsonMessages {
def executionContextExecuteExpressionRequest( def executionContextExecuteExpressionRequest(
reqId: Int, reqId: Int,
visualisationId: Api.VisualisationId, visualizationId: Api.VisualizationId,
expressionId: Api.ExpressionId, expressionId: Api.ExpressionId,
configuration: VisualisationConfiguration configuration: VisualizationConfiguration
) = ) =
configuration.expression match { configuration.expression match {
case VisualisationExpression.Text(module, expression) => case VisualizationExpression.Text(module, expression) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/executeExpression", "method": "executionContext/executeExpression",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId, "expressionId": $expressionId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"visualisationModule": $module, "visualizationModule": $module,
"expression": $expression "expression": $expression
} }
} }
} }
""" """
case VisualisationExpression.ModuleMethod(methodPointer, Vector()) => case VisualizationExpression.ModuleMethod(methodPointer, Vector()) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/executeExpression", "method": "executionContext/executeExpression",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId, "expressionId": $expressionId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"expression": { "expression": {
"module": ${methodPointer.module}, "module": ${methodPointer.module},
@ -149,15 +149,15 @@ object ExecutionContextJsonMessages {
} }
} }
""" """
case VisualisationExpression.ModuleMethod(methodPointer, arguments) => case VisualizationExpression.ModuleMethod(methodPointer, arguments) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/executeExpression", "method": "executionContext/executeExpression",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId, "expressionId": $expressionId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"expression": { "expression": {
"module": ${methodPointer.module}, "module": ${methodPointer.module},
@ -171,38 +171,38 @@ object ExecutionContextJsonMessages {
""" """
} }
def executionContextAttachVisualisationRequest( def executionContextAttachVisualizationRequest(
reqId: Int, reqId: Int,
visualisationId: Api.VisualisationId, visualizationId: Api.VisualizationId,
expressionId: Api.ExpressionId, expressionId: Api.ExpressionId,
configuration: VisualisationConfiguration configuration: VisualizationConfiguration
) = { ) = {
configuration.expression match { configuration.expression match {
case VisualisationExpression.Text(module, expression) => case VisualizationExpression.Text(module, expression) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/attachVisualisation", "method": "executionContext/attachVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId, "expressionId": $expressionId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"visualisationModule": $module, "visualizationModule": $module,
"expression": $expression "expression": $expression
} }
} }
} }
""" """
case VisualisationExpression.ModuleMethod(methodPointer, Vector()) => case VisualizationExpression.ModuleMethod(methodPointer, Vector()) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/attachVisualisation", "method": "executionContext/attachVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId, "expressionId": $expressionId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"expression": { "expression": {
"module": ${methodPointer.module}, "module": ${methodPointer.module},
@ -213,15 +213,15 @@ object ExecutionContextJsonMessages {
} }
} }
""" """
case VisualisationExpression.ModuleMethod(methodPointer, arguments) => case VisualizationExpression.ModuleMethod(methodPointer, arguments) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/attachVisualisation", "method": "executionContext/attachVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId, "expressionId": $expressionId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"expression": { "expression": {
"module": ${methodPointer.module}, "module": ${methodPointer.module},
@ -253,23 +253,23 @@ object ExecutionContextJsonMessages {
""" """
} }
def executionContextVisualisationNotFound(reqId: Int) = def executionContextVisualizationNotFound(reqId: Int) =
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"id": $reqId, "id": $reqId,
"error": { "error": {
"code": 2006, "code": 2006,
"message": "Visualisation not found" "message": "Visualization not found"
} }
} }
""" """
def executionContextVisualisationExpressionFailed( def executionContextVisualizationExpressionFailed(
reqId: Int, reqId: Int,
message: String message: String
) = { ) = {
val errorMessage = val errorMessage =
s"Evaluation of the visualisation expression failed [$message]" s"Evaluation of the visualization expression failed [$message]"
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"id": $reqId, "id": $reqId,
@ -281,53 +281,53 @@ object ExecutionContextJsonMessages {
""" """
} }
def executionContextDetachVisualisationRequest( def executionContextDetachVisualizationRequest(
reqId: Int, reqId: Int,
contextId: Api.ContextId, contextId: Api.ContextId,
visualisationId: Api.VisualisationId, visualizationId: Api.VisualizationId,
expressionId: Api.ExpressionId expressionId: Api.ExpressionId
) = ) =
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/detachVisualisation", "method": "executionContext/detachVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"contextId": $contextId, "contextId": $contextId,
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"expressionId": $expressionId "expressionId": $expressionId
} }
} }
""" """
def executionContextModifyVisualisationRequest( def executionContextModifyVisualizationRequest(
reqId: Int, reqId: Int,
visualisationId: Api.VisualisationId, visualizationId: Api.VisualizationId,
configuration: VisualisationConfiguration configuration: VisualizationConfiguration
) = { ) = {
configuration.expression match { configuration.expression match {
case VisualisationExpression.Text(module, expression) => case VisualizationExpression.Text(module, expression) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/modifyVisualisation", "method": "executionContext/modifyVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"visualisationModule": $module, "visualizationModule": $module,
"expression": $expression "expression": $expression
} }
} }
} }
""" """
case VisualisationExpression.ModuleMethod(methodPointer, Vector()) => case VisualizationExpression.ModuleMethod(methodPointer, Vector()) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/modifyVisualisation", "method": "executionContext/modifyVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"expression": { "expression": {
"module": ${methodPointer.module}, "module": ${methodPointer.module},
@ -338,14 +338,14 @@ object ExecutionContextJsonMessages {
} }
} }
""" """
case VisualisationExpression.ModuleMethod(methodPointer, arguments) => case VisualizationExpression.ModuleMethod(methodPointer, arguments) =>
json""" json"""
{ "jsonrpc": "2.0", { "jsonrpc": "2.0",
"method": "executionContext/modifyVisualisation", "method": "executionContext/modifyVisualization",
"id": $reqId, "id": $reqId,
"params": { "params": {
"visualisationId": $visualisationId, "visualizationId": $visualizationId,
"visualisationConfig": { "visualizationConfig": {
"executionContextId": ${configuration.executionContextId}, "executionContextId": ${configuration.executionContextId},
"expression": { "expression": {
"module": ${methodPointer.module}, "module": ${methodPointer.module},

View File

@ -3,29 +3,29 @@ import java.util.UUID
import io.circe.literal._ import io.circe.literal._
import org.enso.languageserver.runtime.{ import org.enso.languageserver.runtime.{
MethodPointer, MethodPointer,
VisualisationConfiguration VisualizationConfiguration
} }
import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api
import org.enso.text.editing.model import org.enso.text.editing.model
class VisualisationOperationsTest extends BaseServerTest { class VisualizationOperationsTest extends BaseServerTest {
"executionContext/attachVisualisation" must { "executionContext/attachVisualization" must {
"return an empty response when the operation succeeds" in { "return an empty response when the operation succeeds" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y") VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
client.send( client.send(
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest( ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
1, 1,
visualisationId, visualizationId,
expressionId, expressionId,
visualisationConfig visualizationConfig
) )
) )
@ -33,15 +33,15 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
config config
) )
) => ) =>
config.expression shouldBe visualisationConfig.expression.toApi config.expression shouldBe visualizationConfig.expression.toApi
config.visualisationModule shouldBe visualisationConfig.visualisationModule config.visualizationModule shouldBe visualizationConfig.visualizationModule
config.executionContextId shouldBe visualisationConfig.executionContextId config.executionContextId shouldBe visualizationConfig.executionContextId
requestId requestId
case msg => case msg =>
@ -50,36 +50,36 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.VisualisationAttached() Api.VisualizationAttached()
) )
client.expectJson(ExecutionContextJsonMessages.ok(1)) client.expectJson(ExecutionContextJsonMessages.ok(1))
} }
"allow attaching method pointer without arguments as a visualisation expression" in { "allow attaching method pointer without arguments as a visualization expression" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
val visualisationModule = "Foo.Bar" val visualizationModule = "Foo.Bar"
val visualisationMethod = "baz" val visualizationMethod = "baz"
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration( VisualizationConfiguration(
contextId, contextId,
MethodPointer( MethodPointer(
visualisationModule, visualizationModule,
visualisationModule, visualizationModule,
visualisationMethod visualizationMethod
), ),
Vector() Vector()
) )
client.send( client.send(
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest( ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
1, 1,
visualisationId, visualizationId,
expressionId, expressionId,
visualisationConfig visualizationConfig
) )
) )
@ -87,15 +87,15 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
config config
) )
) => ) =>
config.expression shouldBe visualisationConfig.expression.toApi config.expression shouldBe visualizationConfig.expression.toApi
config.visualisationModule shouldBe visualisationConfig.visualisationModule config.visualizationModule shouldBe visualizationConfig.visualizationModule
config.executionContextId shouldBe visualisationConfig.executionContextId config.executionContextId shouldBe visualizationConfig.executionContextId
requestId requestId
case msg => case msg =>
@ -104,36 +104,36 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.VisualisationAttached() Api.VisualizationAttached()
) )
client.expectJson(ExecutionContextJsonMessages.ok(1)) client.expectJson(ExecutionContextJsonMessages.ok(1))
} }
"allow attaching method pointer with arguments as a visualisation expression" in { "allow attaching method pointer with arguments as a visualization expression" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
val visualisationModule = "Foo.Bar" val visualizationModule = "Foo.Bar"
val visualisationMethod = "baz" val visualizationMethod = "baz"
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration( VisualizationConfiguration(
contextId, contextId,
MethodPointer( MethodPointer(
visualisationModule, visualizationModule,
visualisationModule, visualizationModule,
visualisationMethod visualizationMethod
), ),
Vector("1", "2", "3") Vector("1", "2", "3")
) )
client.send( client.send(
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest( ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
1, 1,
visualisationId, visualizationId,
expressionId, expressionId,
visualisationConfig visualizationConfig
) )
) )
@ -141,15 +141,15 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
config config
) )
) => ) =>
config.expression shouldBe visualisationConfig.expression.toApi config.expression shouldBe visualizationConfig.expression.toApi
config.visualisationModule shouldBe visualisationConfig.visualisationModule config.visualizationModule shouldBe visualizationConfig.visualizationModule
config.executionContextId shouldBe visualisationConfig.executionContextId config.executionContextId shouldBe visualizationConfig.executionContextId
requestId requestId
case msg => case msg =>
@ -158,24 +158,24 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.VisualisationAttached() Api.VisualizationAttached()
) )
client.expectJson(ExecutionContextJsonMessages.ok(1)) client.expectJson(ExecutionContextJsonMessages.ok(1))
} }
"reply with AccessDenied when context doesn't belong to client" in { "reply with AccessDenied when context doesn't belong to client" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val contextId = UUID.randomUUID() val contextId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y") VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
client.send( client.send(
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest( ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
1, 1,
visualisationId, visualizationId,
expressionId, expressionId,
visualisationConfig visualizationConfig
) )
) )
client.expectJson(json""" client.expectJson(json"""
@ -189,20 +189,20 @@ class VisualisationOperationsTest extends BaseServerTest {
""") """)
} }
"reply with ModuleNotFound error when attaching a visualisation" in { "reply with ModuleNotFound error when attaching a visualization" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration(contextId, "Foo.Bar", "_") VisualizationConfiguration(contextId, "Foo.Bar", "_")
client.send( client.send(
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest( ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
1, 1,
visualisationId, visualizationId,
expressionId, expressionId,
visualisationConfig visualizationConfig
) )
) )
@ -210,15 +210,15 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
config config
) )
) => ) =>
config.expression shouldBe visualisationConfig.expression.toApi config.expression shouldBe visualizationConfig.expression.toApi
config.visualisationModule shouldBe visualisationConfig.visualisationModule config.visualizationModule shouldBe visualizationConfig.visualizationModule
config.executionContextId shouldBe visualisationConfig.executionContextId config.executionContextId shouldBe visualizationConfig.executionContextId
requestId requestId
case msg => case msg =>
@ -227,31 +227,31 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.ModuleNotFound(visualisationConfig.visualisationModule) Api.ModuleNotFound(visualizationConfig.visualizationModule)
) )
client.expectJson( client.expectJson(
ExecutionContextJsonMessages.executionContextModuleNotFound( ExecutionContextJsonMessages.executionContextModuleNotFound(
1, 1,
visualisationConfig.visualisationModule visualizationConfig.visualizationModule
) )
) )
} }
"reply with VisualisationExpressionFailed error when attaching a visualisation" in { "reply with VisualizationExpressionFailed error when attaching a visualization" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration(contextId, "Foo.Bar", "_") VisualizationConfiguration(contextId, "Foo.Bar", "_")
val expressionFailureMessage = "Method `to_json` could not be found." val expressionFailureMessage = "Method `to_json` could not be found."
client.send( client.send(
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest( ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
1, 1,
visualisationId, visualizationId,
expressionId, expressionId,
visualisationConfig visualizationConfig
) )
) )
@ -259,15 +259,15 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.AttachVisualisation( Api.AttachVisualization(
`visualisationId`, `visualizationId`,
`expressionId`, `expressionId`,
config config
) )
) => ) =>
config.expression shouldBe visualisationConfig.expression.toApi config.expression shouldBe visualizationConfig.expression.toApi
config.visualisationModule shouldBe visualisationConfig.visualisationModule config.visualizationModule shouldBe visualizationConfig.visualizationModule
config.executionContextId shouldBe visualisationConfig.executionContextId config.executionContextId shouldBe visualizationConfig.executionContextId
requestId requestId
case msg => case msg =>
@ -276,7 +276,7 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.VisualisationExpressionFailed( Api.VisualizationExpressionFailed(
expressionFailureMessage, expressionFailureMessage,
Some( Some(
Api.ExecutionResult.Diagnostic.error( Api.ExecutionResult.Diagnostic.error(
@ -290,7 +290,7 @@ class VisualisationOperationsTest extends BaseServerTest {
) )
) )
val errorMessage = val errorMessage =
s"Evaluation of the visualisation expression failed [$expressionFailureMessage]" s"Evaluation of the visualization expression failed [$expressionFailureMessage]"
client.expectJson( client.expectJson(
json""" json"""
{ "jsonrpc" : "2.0", { "jsonrpc" : "2.0",
@ -323,18 +323,18 @@ class VisualisationOperationsTest extends BaseServerTest {
} }
"executionContext/detachVisualisation" must { "executionContext/detachVisualization" must {
"return an empty response when the operation succeeds" in { "return an empty response when the operation succeeds" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
client.send( client.send(
ExecutionContextJsonMessages.executionContextDetachVisualisationRequest( ExecutionContextJsonMessages.executionContextDetachVisualizationRequest(
1, 1,
contextId, contextId,
visualisationId, visualizationId,
expressionId expressionId
) )
) )
@ -342,9 +342,9 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.DetachVisualisation( Api.DetachVisualization(
`contextId`, `contextId`,
`visualisationId`, `visualizationId`,
`expressionId` `expressionId`
) )
) => ) =>
@ -356,21 +356,21 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.VisualisationDetached() Api.VisualizationDetached()
) )
client.expectJson(ExecutionContextJsonMessages.ok(1)) client.expectJson(ExecutionContextJsonMessages.ok(1))
} }
"reply with AccessDenied when context doesn't belong to client" in { "reply with AccessDenied when context doesn't belong to client" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val expressionId = UUID.randomUUID() val expressionId = UUID.randomUUID()
val contextId = UUID.randomUUID() val contextId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
client.send( client.send(
ExecutionContextJsonMessages.executionContextDetachVisualisationRequest( ExecutionContextJsonMessages.executionContextDetachVisualizationRequest(
1, 1,
contextId, contextId,
visualisationId, visualizationId,
expressionId expressionId
) )
) )
@ -387,19 +387,19 @@ class VisualisationOperationsTest extends BaseServerTest {
} }
"executionContext/modifyVisualisation" must { "executionContext/modifyVisualization" must {
"return an empty response when the operation succeeds" in { "return an empty response when the operation succeeds" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val contextId = createExecutionContext(client) val contextId = createExecutionContext(client)
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y") VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
client.send( client.send(
ExecutionContextJsonMessages.executionContextModifyVisualisationRequest( ExecutionContextJsonMessages.executionContextModifyVisualizationRequest(
1, 1,
visualisationId, visualizationId,
visualisationConfig visualizationConfig
) )
) )
@ -407,11 +407,11 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.receiveN(1).head match { runtimeConnectorProbe.receiveN(1).head match {
case Api.Request( case Api.Request(
requestId, requestId,
Api.ModifyVisualisation(`visualisationId`, config) Api.ModifyVisualization(`visualizationId`, config)
) => ) =>
config.expression shouldBe visualisationConfig.expression.toApi config.expression shouldBe visualizationConfig.expression.toApi
config.visualisationModule shouldBe visualisationConfig.visualisationModule config.visualizationModule shouldBe visualizationConfig.visualizationModule
config.executionContextId shouldBe visualisationConfig.executionContextId config.executionContextId shouldBe visualizationConfig.executionContextId
requestId requestId
case msg => case msg =>
@ -420,23 +420,23 @@ class VisualisationOperationsTest extends BaseServerTest {
runtimeConnectorProbe.lastSender ! Api.Response( runtimeConnectorProbe.lastSender ! Api.Response(
requestId, requestId,
Api.VisualisationModified() Api.VisualizationModified()
) )
client.expectJson(ExecutionContextJsonMessages.ok(1)) client.expectJson(ExecutionContextJsonMessages.ok(1))
} }
"reply with AccessDenied when context doesn't belong to client" in { "reply with AccessDenied when context doesn't belong to client" in {
val visualisationId = UUID.randomUUID() val visualizationId = UUID.randomUUID()
val contextId = UUID.randomUUID() val contextId = UUID.randomUUID()
val client = getInitialisedWsClient() val client = getInitialisedWsClient()
val visualisationConfig = val visualizationConfig =
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y") VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
client.send( client.send(
ExecutionContextJsonMessages.executionContextModifyVisualisationRequest( ExecutionContextJsonMessages.executionContextModifyVisualizationRequest(
1, 1,
visualisationId, visualizationId,
visualisationConfig visualizationConfig
) )
) )
client.expectJson(json""" client.expectJson(json"""

View File

@ -204,7 +204,7 @@ object LauncherApplication {
.optionalParameter[Int]( .optionalParameter[Int](
"data-port", "data-port",
"PORT", "PORT",
"Data port for visualisation protocol. Defaults to 8081." "Data port for visualization protocol. Defaults to 8081."
) )
.withDefault(8081) .withDefault(8081)
val additionalArgs = Opts.additionalArguments() val additionalArgs = Opts.additionalArguments()

View File

@ -109,32 +109,32 @@ object Runtime {
name = "closeFileNotification" name = "closeFileNotification"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationUpdate], value = classOf[Api.VisualizationUpdate],
name = "visualisationUpdate" name = "visualizationUpdate"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.AttachVisualisation], value = classOf[Api.AttachVisualization],
name = "attachVisualisation" name = "attachVisualization"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationAttached], value = classOf[Api.VisualizationAttached],
name = "visualisationAttached" name = "visualizationAttached"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.DetachVisualisation], value = classOf[Api.DetachVisualization],
name = "detachVisualisation" name = "detachVisualization"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationDetached], value = classOf[Api.VisualizationDetached],
name = "visualisationDetached" name = "visualizationDetached"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.ModifyVisualisation], value = classOf[Api.ModifyVisualization],
name = "modifyVisualisation" name = "modifyVisualization"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationModified], value = classOf[Api.VisualizationModified],
name = "visualisationModified" name = "visualizationModified"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.ExpressionUpdates], value = classOf[Api.ExpressionUpdates],
@ -173,16 +173,16 @@ object Runtime {
name = "executionSuccessful" name = "executionSuccessful"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationExpressionFailed], value = classOf[Api.VisualizationExpressionFailed],
name = "visualisationExpressionFailed" name = "visualizationExpressionFailed"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationEvaluationFailed], value = classOf[Api.VisualizationEvaluationFailed],
name = "visualisationEvaluationFailed" name = "visualizationEvaluationFailed"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.VisualisationNotFound], value = classOf[Api.VisualizationNotFound],
name = "visualisationNotFound" name = "visualizationNotFound"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[Api.InvalidStackItemError], value = classOf[Api.InvalidStackItemError],
@ -301,7 +301,7 @@ object Runtime {
type ContextId = UUID type ContextId = UUID
type ExpressionId = UUID type ExpressionId = UUID
type RequestId = UUID type RequestId = UUID
type VisualisationId = UUID type VisualizationId = UUID
/** Indicates error response. /** Indicates error response.
*/ */
@ -541,14 +541,14 @@ object Runtime {
updates: Set[ExpressionUpdate] updates: Set[ExpressionUpdate]
) extends ApiNotification ) extends ApiNotification
/** Represents a visualisation context. /** Represents a visualization context.
* *
* @param visualisationId a visualisation identifier * @param visualizationId a visualization identifier
* @param contextId a context identifier * @param contextId a context identifier
* @param expressionId an expression identifier * @param expressionId an expression identifier
*/ */
case class VisualisationContext( case class VisualizationContext(
visualisationId: VisualisationId, visualizationId: VisualizationId,
contextId: ContextId, contextId: ContextId,
expressionId: ExpressionId expressionId: ExpressionId
) )
@ -558,19 +558,19 @@ object Runtime {
@JsonSubTypes( @JsonSubTypes(
Array( Array(
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[VisualisationExpression.Text], value = classOf[VisualizationExpression.Text],
name = "visualisationExpressionText" name = "visualizationExpressionText"
), ),
new JsonSubTypes.Type( new JsonSubTypes.Type(
value = classOf[VisualisationExpression.ModuleMethod], value = classOf[VisualizationExpression.ModuleMethod],
name = "visualisationExpressionModuleMethod" name = "visualizationExpressionModuleMethod"
) )
) )
) )
sealed trait VisualisationExpression extends ToLogString { sealed trait VisualizationExpression extends ToLogString {
def module: String def module: String
} }
object VisualisationExpression { object VisualizationExpression {
/** Visualization expression represented as a text. /** Visualization expression represented as a text.
* *
@ -578,7 +578,7 @@ object Runtime {
* @param expression an expression that creates a visualization * @param expression an expression that creates a visualization
*/ */
case class Text(module: String, expression: String) case class Text(module: String, expression: String)
extends VisualisationExpression { extends VisualizationExpression {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
@ -597,7 +597,7 @@ object Runtime {
case class ModuleMethod( case class ModuleMethod(
methodPointer: MethodPointer, methodPointer: MethodPointer,
positionalArgumentsExpressions: Vector[String] positionalArgumentsExpressions: Vector[String]
) extends VisualisationExpression { ) extends VisualizationExpression {
/** @inheritdoc */ /** @inheritdoc */
override val module: String = methodPointer.module override val module: String = methodPointer.module
@ -611,23 +611,23 @@ object Runtime {
} }
} }
/** A configuration object for properties of the visualisation. /** A configuration object for properties of the visualization.
* *
* @param executionContextId an execution context of the visualisation * @param executionContextId an execution context of the visualization
* @param expression the expression that creates a visualisation * @param expression the expression that creates a visualization
*/ */
case class VisualisationConfiguration( case class VisualizationConfiguration(
executionContextId: ContextId, executionContextId: ContextId,
expression: VisualisationExpression expression: VisualizationExpression
) extends ToLogString { ) extends ToLogString {
/** A qualified module name containing the expression. */ /** A qualified module name containing the expression. */
def visualisationModule: String = def visualizationModule: String =
expression.module expression.module
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
s"VisualisationConfiguration(" + s"VisualizationConfiguration(" +
s"executionContextId=$executionContextId," + s"executionContextId=$executionContextId," +
s"expression=${expression.toLogString(shouldMask)})" s"expression=${expression.toLogString(shouldMask)})"
} }
@ -1108,20 +1108,20 @@ object Runtime {
")" ")"
} }
/** An event signaling a visualisation update. /** An event signaling a visualization update.
* *
* @param visualisationContext a visualisation context * @param visualizationContext a visualization context
* @param data a visualisation data * @param data a visualization data
*/ */
final case class VisualisationUpdate( final case class VisualizationUpdate(
visualisationContext: VisualisationContext, visualizationContext: VisualizationContext,
data: Array[Byte] data: Array[Byte]
) extends ApiNotification ) extends ApiNotification
with ToLogString { with ToLogString {
override def toLogString(shouldMask: Boolean): String = { override def toLogString(shouldMask: Boolean): String = {
"VisualisationUpdate(" + "VisualizationUpdate(" +
s"visualisationContext=$visualisationContext,data=" + s"visualizationContext=$visualizationContext,data=" +
(if (shouldMask) STUB else data.toString()) + (if (shouldMask) STUB else data.toString()) +
")" ")"
} }
@ -1320,13 +1320,13 @@ object Runtime {
final case class ExecutionComplete(contextId: ContextId) final case class ExecutionComplete(contextId: ContextId)
extends ApiNotification extends ApiNotification
/** Signals that an expression specified in a [[AttachVisualisation]] or /** Signals that an expression specified in a [[AttachVisualization]] or
* a [[ModifyVisualisation]] cannot be evaluated. * a [[ModifyVisualization]] cannot be evaluated.
* *
* @param message the reason of the failure * @param message the reason of the failure
* @param failure the detailed information about the failure * @param failure the detailed information about the failure
*/ */
final case class VisualisationExpressionFailed( final case class VisualizationExpressionFailed(
message: String, message: String,
failure: Option[ExecutionResult.Diagnostic] failure: Option[ExecutionResult.Diagnostic]
) extends Error ) extends Error
@ -1334,24 +1334,24 @@ object Runtime {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
"VisualisationExpressionFailed(" + "VisualizationExpressionFailed(" +
s"message=${MaskedString(message).toLogString(shouldMask)}," + s"message=${MaskedString(message).toLogString(shouldMask)}," +
s"failure=${failure.map(_.toLogString(shouldMask))}" + s"failure=${failure.map(_.toLogString(shouldMask))}" +
")" ")"
} }
/** Signals that an evaluation of a code responsible for generating /** Signals that an evaluation of a code responsible for generating
* visualisation data failed. * visualization data failed.
* *
* @param contextId the context's id. * @param contextId the context's id.
* @param visualisationId the visualisation identifier * @param visualizationId the visualization identifier
* @param expressionId the identifier of a visualised expression * @param expressionId the identifier of a visualised expression
* @param message the reason of the failure * @param message the reason of the failure
* @param diagnostic the detailed information about the failure * @param diagnostic the detailed information about the failure
*/ */
final case class VisualisationEvaluationFailed( final case class VisualizationEvaluationFailed(
contextId: ContextId, contextId: ContextId,
visualisationId: VisualisationId, visualizationId: VisualizationId,
expressionId: ExpressionId, expressionId: ExpressionId,
message: String, message: String,
diagnostic: Option[ExecutionResult.Diagnostic] diagnostic: Option[ExecutionResult.Diagnostic]
@ -1360,17 +1360,17 @@ object Runtime {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
"VisualisationEvaluationFailed(" + "VisualizationEvaluationFailed(" +
s"contextId=$contextId," + s"contextId=$contextId," +
s"visualisationId=$visualisationId," + s"visualizationId=$visualizationId," +
s"expressionId=$expressionId," + s"expressionId=$expressionId," +
s"message=${MaskedString(message).toLogString(shouldMask)}," + s"message=${MaskedString(message).toLogString(shouldMask)}," +
s"diagnostic=${diagnostic.map(_.toLogString(shouldMask))}" + s"diagnostic=${diagnostic.map(_.toLogString(shouldMask))}" +
")" ")"
} }
/** Signals that visualisation cannot be found. */ /** Signals that visualization cannot be found. */
final case class VisualisationNotFound() extends Error final case class VisualizationNotFound() extends Error
/** An error response signifying that stack is empty. /** An error response signifying that stack is empty.
* *
@ -1472,74 +1472,74 @@ object Runtime {
final case class InitializedNotification() extends ApiResponse final case class InitializedNotification() extends ApiResponse
/** A request sent from the client to the runtime server, to create a new /** A request sent from the client to the runtime server, to create a new
* visualisation for an expression identified by `expressionId`. * visualization for an expression identified by `expressionId`.
* *
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param expressionId an identifier of an expression which is visualised * @param expressionId an identifier of an expression which is visualised
* @param visualisationConfig a configuration object for properties of the * @param visualizationConfig a configuration object for properties of the
* visualisation * visualization
*/ */
final case class AttachVisualisation( final case class AttachVisualization(
visualisationId: VisualisationId, visualizationId: VisualizationId,
expressionId: ExpressionId, expressionId: ExpressionId,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) extends ApiRequest ) extends ApiRequest
with ToLogString { with ToLogString {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
s"AttachVisualisation(" + s"AttachVisualization(" +
s"visualisationId=$visualisationId," + s"visualizationId=$visualizationId," +
s"expressionId=$expressionId,visualisationConfig=" + s"expressionId=$expressionId,visualizationConfig=" +
visualisationConfig.toLogString(shouldMask) + visualizationConfig.toLogString(shouldMask) +
")" ")"
} }
/** Signals that attaching a visualisation has succeeded. /** Signals that attaching a visualization has succeeded.
*/ */
final case class VisualisationAttached() extends ApiResponse final case class VisualizationAttached() extends ApiResponse
/** A request sent from the client to the runtime server, to detach a /** A request sent from the client to the runtime server, to detach a
* visualisation from an expression identified by `expressionId`. * visualization from an expression identified by `expressionId`.
* *
* @param contextId an execution context identifier * @param contextId an execution context identifier
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param expressionId an identifier of an expression which is visualised * @param expressionId an identifier of an expression which is visualised
*/ */
final case class DetachVisualisation( final case class DetachVisualization(
contextId: ContextId, contextId: ContextId,
visualisationId: VisualisationId, visualizationId: VisualizationId,
expressionId: ExpressionId expressionId: ExpressionId
) extends ApiRequest ) extends ApiRequest
/** Signals that detaching a visualisation has succeeded. /** Signals that detaching a visualization has succeeded.
*/ */
final case class VisualisationDetached() extends ApiResponse final case class VisualizationDetached() extends ApiResponse
/** A request sent from the client to the runtime server, to modify a /** A request sent from the client to the runtime server, to modify a
* visualisation identified by `visualisationId`. * visualization identified by `visualizationId`.
* *
* @param visualisationId an identifier of a visualisation * @param visualizationId an identifier of a visualization
* @param visualisationConfig a configuration object for properties of the * @param visualizationConfig a configuration object for properties of the
* visualisation * visualization
*/ */
final case class ModifyVisualisation( final case class ModifyVisualization(
visualisationId: VisualisationId, visualizationId: VisualizationId,
visualisationConfig: VisualisationConfiguration visualizationConfig: VisualizationConfiguration
) extends ToLogString ) extends ToLogString
with ApiRequest { with ApiRequest {
/** @inheritdoc */ /** @inheritdoc */
override def toLogString(shouldMask: Boolean): String = override def toLogString(shouldMask: Boolean): String =
"ModifyVisualisation(" + "ModifyVisualization(" +
s"visualisationId=$visualisationId,visualisationConfig=" + s"visualizationId=$visualizationId,visualizationConfig=" +
visualisationConfig.toLogString(shouldMask) + visualizationConfig.toLogString(shouldMask) +
")" ")"
} }
/** Signals that a visualisation modification has succeeded. /** Signals that a visualization modification has succeeded.
*/ */
final case class VisualisationModified() extends ApiResponse final case class VisualizationModified() extends ApiResponse
/** A request to shut down the runtime server. /** A request to shut down the runtime server.
*/ */

View File

@ -213,7 +213,7 @@ object Main {
.hasArg(true) .hasArg(true)
.numberOfArgs(1) .numberOfArgs(1)
.argName("data-port") .argName("data-port")
.desc("Data port for visualisation protocol") .desc("Data port for visualization protocol")
.build() .build()
val uuidOption = CliOption.builder val uuidOption = CliOption.builder
.hasArg(true) .hasArg(true)

View File

@ -35,13 +35,13 @@ import java.util.UUID;
* method pointers are tracked separately from the expressions state because they have * method pointers are tracked separately from the expressions state because they have
* different invalidation rules. E.g., they should always be re-sent when the execution item * different invalidation rules. E.g., they should always be re-sent when the execution item
* is popped from the stack. * is popped from the stack.
* <li>Visualisations state. Tracks the state of visualisation updates. * <li>Visualizations state. Tracks the state of visualization updates.
* </ul> * </ul>
*/ */
public class UpdatesSynchronizationState { public class UpdatesSynchronizationState {
private final Set<UUID> expressionsState = new HashSet<>(); private final Set<UUID> expressionsState = new HashSet<>();
private final Set<UUID> visualisationsState = new HashSet<>(); private final Set<UUID> visualizationsState = new HashSet<>();
private final Set<UUID> methodPointersState = new HashSet<>(); private final Set<UUID> methodPointersState = new HashSet<>();
@Override @Override
@ -49,8 +49,8 @@ public class UpdatesSynchronizationState {
return "UpdatesSynchronizationState{" return "UpdatesSynchronizationState{"
+ "expressionsState=" + "expressionsState="
+ expressionsState + expressionsState
+ ", visualisationsState=" + ", visualizationsState="
+ visualisationsState + visualizationsState
+ ", methodPointersState=" + ", methodPointersState="
+ methodPointersState + methodPointersState
+ '}'; + '}';
@ -64,7 +64,7 @@ public class UpdatesSynchronizationState {
public void invalidate(UUID key) { public void invalidate(UUID key) {
synchronized (this) { synchronized (this) {
expressionsState.remove(key); expressionsState.remove(key);
visualisationsState.remove(key); visualizationsState.remove(key);
methodPointersState.remove(key); methodPointersState.remove(key);
} }
} }
@ -106,40 +106,40 @@ public class UpdatesSynchronizationState {
} }
} }
/* Visualisations */ /* Visualizations */
/** /**
* Checks if the given visualisation update is synchronized. * Checks if the given visualization update is synchronized.
* *
* @param key the expression id. * @param key the expression id.
* @return {@code true} if the visualisation update is synchronized. * @return {@code true} if the visualization update is synchronized.
*/ */
public boolean isVisualisationSync(UUID key) { public boolean isVisualizationSync(UUID key) {
synchronized (visualisationsState) { synchronized (visualizationsState) {
return visualisationsState.contains(key); return visualizationsState.contains(key);
} }
} }
/** /**
* Marks the given visualisation update as unsynchronized. * Marks the given visualization update as unsynchronized.
* *
* @param key the expression id. * @param key the expression id.
*/ */
@CompilerDirectives.TruffleBoundary @CompilerDirectives.TruffleBoundary
public void setVisualisationUnsync(UUID key) { public void setVisualizationUnsync(UUID key) {
synchronized (visualisationsState) { synchronized (visualizationsState) {
visualisationsState.remove(key); visualizationsState.remove(key);
} }
} }
/** /**
* Marks the given visualisation update as synchronized. * Marks the given visualization update as synchronized.
* *
* @param key the expression id. * @param key the expression id.
*/ */
public void setVisualisationSync(UUID key) { public void setVisualizationSync(UUID key) {
synchronized (visualisationsState) { synchronized (visualizationsState) {
visualisationsState.add(key); visualizationsState.add(key);
} }
} }

View File

@ -125,36 +125,36 @@ object CacheInvalidation {
): Unit = ): Unit =
instructions.foreach(run(stack, _)) instructions.foreach(run(stack, _))
/** Run a sequence of invalidation instructions on all visualisations. /** Run a sequence of invalidation instructions on all visualizations.
* *
* @param visualisations the list of available visualisations * @param visualizations the list of available visualizations
* @param instructions the list of cache invalidation instructions * @param instructions the list of cache invalidation instructions
*/ */
def runAllVisualisations( def runAllVisualizations(
visualisations: Iterable[Visualisation], visualizations: Iterable[Visualization],
instructions: Iterable[CacheInvalidation] instructions: Iterable[CacheInvalidation]
): Unit = ): Unit =
instructions.foreach { instruction => instructions.foreach { instruction =>
runVisualisations( runVisualizations(
visualisations, visualizations,
instruction.command, instruction.command,
instruction.indexes instruction.indexes
) )
} }
/** Run cache invalidation of a multiple visualisations /** Run cache invalidation of a multiple visualizations
* *
* @param visualisations visualisations cache should be invalidated * @param visualizations visualizations cache should be invalidated
* @param command the invalidation instruction * @param command the invalidation instruction
* @param indexes the list of indexes to invalidate * @param indexes the list of indexes to invalidate
*/ */
def runVisualisations( def runVisualizations(
visualisations: Iterable[Visualisation], visualizations: Iterable[Visualization],
command: Command, command: Command,
indexes: Set[IndexSelector] = Set() indexes: Set[IndexSelector] = Set()
): Unit = ): Unit =
visualisations.foreach { visualisation => visualizations.foreach { visualization =>
run(visualisation.cache, command, indexes) run(visualization.cache, command, indexes)
} }
/** Run a cache invalidation instruction on an execution stack. /** Run a cache invalidation instruction on an execution stack.

View File

@ -5,7 +5,7 @@ import org.enso.polyglot.runtime.Runtime.Api.{
ContextId, ContextId,
ExpressionId, ExpressionId,
StackItem, StackItem,
VisualisationId VisualizationId
} }
import scala.collection.mutable import scala.collection.mutable
@ -102,104 +102,104 @@ class ExecutionContextManager {
contexts.contains(contextId) contexts.contains(contextId)
} }
/** Upserts a visualisation for the specified context. /** Upserts a visualization for the specified context.
* *
* @param contextId the identifier of the execution context * @param contextId the identifier of the execution context
* @param visualisation the visualisation to upsert * @param visualization the visualization to upsert
*/ */
def upsertVisualisation( def upsertVisualization(
contextId: ContextId, contextId: ContextId,
visualisation: Visualisation visualization: Visualization
): Unit = ): Unit =
synchronized { synchronized {
val state = contexts(contextId) val state = contexts(contextId)
state.visualisations.upsert(visualisation) state.visualizations.upsert(visualization)
} }
/** Get visualizations of all execution contexts. */ /** Get visualizations of all execution contexts. */
def getAllVisualisations: Iterable[Visualisation] = def getAllVisualizations: Iterable[Visualization] =
synchronized { synchronized {
contexts.values.flatMap(_.visualisations.getAll) contexts.values.flatMap(_.visualizations.getAll)
} }
/** Get visualisations defined in the module. /** Get visualizations defined in the module.
* *
* @param module the qualified module name * @param module the qualified module name
* @return the list of matching visualisations * @return the list of matching visualizations
*/ */
def getVisualisations(module: QualifiedName): Iterable[Visualisation] = def getVisualizations(module: QualifiedName): Iterable[Visualization] =
synchronized { synchronized {
contexts.values.flatMap(_.visualisations.findByModule(module)) contexts.values.flatMap(_.visualizations.findByModule(module))
} }
/** Returns a visualisation with the provided id. /** Returns a visualization with the provided id.
* *
* @param contextId the identifier of the execution context * @param contextId the identifier of the execution context
* @param visualisationId the identifier of visualisation * @param visualizationId the identifier of visualization
* @return an option with visualisation * @return an option with visualization
*/ */
def getVisualisationById( def getVisualizationById(
contextId: ContextId, contextId: ContextId,
visualisationId: VisualisationId visualizationId: VisualizationId
): Option[Visualisation] = ): Option[Visualization] =
synchronized { synchronized {
for { for {
state <- contexts.get(contextId) state <- contexts.get(contextId)
visualisation <- state.visualisations.getById(visualisationId) visualization <- state.visualizations.getById(visualizationId)
} yield visualisation } yield visualization
} }
/** Finds all visualisations attached to an expression. /** Finds all visualizations attached to an expression.
* *
* @param contextId the identifier of the execution context * @param contextId the identifier of the execution context
* @param expressionId the unique identifier of the expression * @param expressionId the unique identifier of the expression
* @return a list of matching visualisation * @return a list of matching visualization
*/ */
def findVisualisationForExpression( def findVisualizationForExpression(
contextId: ContextId, contextId: ContextId,
expressionId: ExpressionId expressionId: ExpressionId
): List[Visualisation] = ): List[Visualization] =
synchronized { synchronized {
for { for {
state <- contexts.get(contextId).toList state <- contexts.get(contextId).toList
visualisation <- state.visualisations.find(expressionId) visualization <- state.visualizations.find(expressionId)
} yield visualisation } yield visualization
} }
/** Get all visualisations invalidated by the provided list of expressions. /** Get all visualizations invalidated by the provided list of expressions.
* *
* @param module the module containing the visualisations * @param module the module containing the visualizations
* @param invalidatedExpressions the list of invalidated expressions * @param invalidatedExpressions the list of invalidated expressions
* @return a list of matching visualisation * @return a list of matching visualization
*/ */
def getInvalidatedVisualisations( def getInvalidatedVisualizations(
module: QualifiedName, module: QualifiedName,
invalidatedExpressions: Set[ExpressionId] invalidatedExpressions: Set[ExpressionId]
): Iterable[Visualisation] = { ): Iterable[Visualization] = {
for { for {
state <- contexts.values state <- contexts.values
visualisation <- state.visualisations.findByModule(module) visualization <- state.visualizations.findByModule(module)
if visualisation.visualisationExpressionId.exists( if visualization.visualizationExpressionId.exists(
invalidatedExpressions.contains invalidatedExpressions.contains
) )
} yield visualisation } yield visualization
} }
/** Removes a visualisation from the holder. /** Removes a visualization from the holder.
* *
* @param contextId the identifier of the execution context * @param contextId the identifier of the execution context
* @param visualisationId the visualisation identifier * @param visualizationId the visualization identifier
* @param expressionId the id of expression that the visualisation is * @param expressionId the id of expression that the visualization is
* attached to * attached to
*/ */
def removeVisualisation( def removeVisualization(
contextId: ContextId, contextId: ContextId,
expressionId: ExpressionId, expressionId: ExpressionId,
visualisationId: VisualisationId visualizationId: VisualizationId
): Unit = ): Unit =
synchronized { synchronized {
val state = contexts(contextId) val state = contexts(contextId)
state.visualisations.remove(visualisationId, expressionId) state.visualizations.remove(visualizationId, expressionId)
} }
} }

View File

@ -7,12 +7,12 @@ import scala.collection.mutable
/** Represents a state of an execution context. /** Represents a state of an execution context.
* *
* @param stack the current call stack for the execution context * @param stack the current call stack for the execution context
* @param visualisations the holder of all visualisations attached to the * @param visualizations the holder of all visualizations attached to the
* execution context * execution context
*/ */
case class ExecutionContextState( case class ExecutionContextState(
stack: mutable.Stack[InstrumentFrame], stack: mutable.Stack[InstrumentFrame],
visualisations: VisualisationHolder visualizations: VisualizationHolder
) )
object ExecutionContextState { object ExecutionContextState {
@ -20,7 +20,7 @@ object ExecutionContextState {
/** Returns empty state. /** Returns empty state.
*/ */
def empty: ExecutionContextState = def empty: ExecutionContextState =
ExecutionContextState(mutable.Stack.empty, VisualisationHolder.empty) ExecutionContextState(mutable.Stack.empty, VisualizationHolder.empty)
} }
/** Stack frame of the context. /** Stack frame of the context.

View File

@ -1,74 +0,0 @@
package org.enso.interpreter.instrument
import org.enso.pkg.QualifiedName
import org.enso.polyglot.runtime.Runtime.Api.{ExpressionId, VisualisationId}
import scala.collection.mutable
/** A mutable holder of all visualisations attached to an execution context.
*/
class VisualisationHolder() {
private val visualisationMap: mutable.Map[ExpressionId, List[Visualisation]] =
mutable.Map.empty.withDefaultValue(List.empty)
/** Upserts a visualisation.
*
* @param visualisation the visualisation to upsert
*/
def upsert(visualisation: Visualisation): Unit = {
val visualisations = visualisationMap(visualisation.expressionId)
val rest = visualisations.filterNot(_.id == visualisation.id)
visualisationMap.update(visualisation.expressionId, visualisation :: rest)
}
/** Removes a visualisation from the holder.
*
* @param visualisationId the visualisation identifier
* @param expressionId the id of expression that the visualisation is
* attached to
*/
def remove(
visualisationId: VisualisationId,
expressionId: ExpressionId
): Unit = {
val visualisations = visualisationMap(expressionId)
val rest = visualisations.filterNot(_.id == visualisationId)
visualisationMap.update(expressionId, rest)
}
/** Finds all visualisations attached to an expression.
*
* @param expressionId the unique identifier of the expression
* @return a list of matching visualisation
*/
def find(expressionId: ExpressionId): List[Visualisation] =
visualisationMap(expressionId)
/** Finds all visualisations in a given module.
*
* @param module the qualified module name
* @return a list of matching visualisation
*/
def findByModule(module: QualifiedName): Iterable[Visualisation] =
visualisationMap.values.flatten.filter(_.module.getName == module)
/** Returns a visualisation with the provided id.
*
* @param visualisationId the identifier of visualisation
* @return an option with visualisation
*/
def getById(visualisationId: VisualisationId): Option[Visualisation] =
visualisationMap.values.flatten.find(_.id == visualisationId)
/** @return all available visualisations. */
def getAll: Iterable[Visualisation] =
visualisationMap.values.flatten
}
object VisualisationHolder {
/** Returns an empty visualisation holder. */
def empty = new VisualisationHolder()
}

View File

@ -3,24 +3,24 @@ package org.enso.interpreter.instrument
import org.enso.interpreter.runtime.Module import org.enso.interpreter.runtime.Module
import org.enso.polyglot.runtime.Runtime.Api.{ import org.enso.polyglot.runtime.Runtime.Api.{
ExpressionId, ExpressionId,
VisualisationConfiguration, VisualizationConfiguration,
VisualisationId VisualizationId
} }
/** An object containing visualisation data. /** An object containing visualization data.
* *
* @param id the unique identifier of visualisation * @param id the unique identifier of visualization
* @param expressionId the identifier of expression that the visualisation is * @param expressionId the identifier of expression that the visualization is
* attached to * attached to
* @param callback the callable expression used to generate visualisation data * @param callback the callable expression used to generate visualization data
*/ */
case class Visualisation( case class Visualization(
id: VisualisationId, id: VisualizationId,
expressionId: ExpressionId, expressionId: ExpressionId,
cache: RuntimeCache, cache: RuntimeCache,
module: Module, module: Module,
config: VisualisationConfiguration, config: VisualizationConfiguration,
visualisationExpressionId: Option[ExpressionId], visualizationExpressionId: Option[ExpressionId],
callback: AnyRef, callback: AnyRef,
arguments: Vector[AnyRef] arguments: Vector[AnyRef]
) )

View File

@ -0,0 +1,74 @@
package org.enso.interpreter.instrument
import org.enso.pkg.QualifiedName
import org.enso.polyglot.runtime.Runtime.Api.{ExpressionId, VisualizationId}
import scala.collection.mutable
/** A mutable holder of all visualizations attached to an execution context.
*/
class VisualizationHolder() {
private val visualizationMap: mutable.Map[ExpressionId, List[Visualization]] =
mutable.Map.empty.withDefaultValue(List.empty)
/** Upserts a visualization.
*
* @param visualization the visualization to upsert
*/
def upsert(visualization: Visualization): Unit = {
val visualizations = visualizationMap(visualization.expressionId)
val rest = visualizations.filterNot(_.id == visualization.id)
visualizationMap.update(visualization.expressionId, visualization :: rest)
}
/** Removes a visualization from the holder.
*
* @param visualizationId the visualization identifier
* @param expressionId the id of expression that the visualization is
* attached to
*/
def remove(
visualizationId: VisualizationId,
expressionId: ExpressionId
): Unit = {
val visualizations = visualizationMap(expressionId)
val rest = visualizations.filterNot(_.id == visualizationId)
visualizationMap.update(expressionId, rest)
}
/** Finds all visualizations attached to an expression.
*
* @param expressionId the unique identifier of the expression
* @return a list of matching visualization
*/
def find(expressionId: ExpressionId): List[Visualization] =
visualizationMap(expressionId)
/** Finds all visualizations in a given module.
*
* @param module the qualified module name
* @return a list of matching visualization
*/
def findByModule(module: QualifiedName): Iterable[Visualization] =
visualizationMap.values.flatten.filter(_.module.getName == module)
/** Returns a visualization with the provided id.
*
* @param visualizationId the identifier of visualization
* @return an option with visualization
*/
def getById(visualizationId: VisualizationId): Option[Visualization] =
visualizationMap.values.flatten.find(_.id == visualizationId)
/** @return all available visualizations. */
def getAll: Iterable[Visualization] =
visualizationMap.values.flatten
}
object VisualizationHolder {
/** Returns an empty visualization holder. */
def empty = new VisualizationHolder()
}

View File

@ -1,20 +1,20 @@
package org.enso.interpreter.instrument.command package org.enso.interpreter.instrument.command
import org.enso.interpreter.instrument.execution.RuntimeContext import org.enso.interpreter.instrument.execution.RuntimeContext
import org.enso.interpreter.instrument.job.{ExecuteJob, UpsertVisualisationJob} import org.enso.interpreter.instrument.job.{ExecuteJob, UpsertVisualizationJob}
import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api
import java.util.logging.Level import java.util.logging.Level
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
/** A command that attaches a visualisation to an expression. /** A command that attaches a visualization to an expression.
* *
* @param maybeRequestId an option with request id * @param maybeRequestId an option with request id
* @param request a request for a service * @param request a request for a service
*/ */
class AttachVisualisationCmd( class AttachVisualizationCmd(
maybeRequestId: Option[Api.RequestId], maybeRequestId: Option[Api.RequestId],
request: Api.AttachVisualisation request: Api.AttachVisualization
) extends AsynchronousCommand(maybeRequestId) { ) extends AsynchronousCommand(maybeRequestId) {
/** @inheritdoc */ /** @inheritdoc */
@ -23,11 +23,11 @@ class AttachVisualisationCmd(
ec: ExecutionContext ec: ExecutionContext
): Future[Unit] = { ): Future[Unit] = {
val logger = ctx.executionService.getLogger val logger = ctx.executionService.getLogger
val contextId = request.visualisationConfig.executionContextId val contextId = request.visualizationConfig.executionContextId
val lockTimestamp = ctx.locking.acquireContextLock(contextId) val lockTimestamp = ctx.locking.acquireContextLock(contextId)
try { try {
if (doesContextExist) { if (doesContextExist) {
attachVisualisation() attachVisualization()
} else { } else {
replyWithContextNotExistError() replyWithContextNotExistError()
} }
@ -35,31 +35,31 @@ class AttachVisualisationCmd(
ctx.locking.releaseContextLock(contextId) ctx.locking.releaseContextLock(contextId)
logger.log( logger.log(
Level.FINEST, Level.FINEST,
s"Kept context lock [AttachVisualisationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds" s"Kept context lock [AttachVisualizationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
) )
} }
} }
private def doesContextExist(implicit ctx: RuntimeContext): Boolean = { private def doesContextExist(implicit ctx: RuntimeContext): Boolean = {
ctx.contextManager.contains( ctx.contextManager.contains(
request.visualisationConfig.executionContextId request.visualizationConfig.executionContextId
) )
} }
private def attachVisualisation()(implicit private def attachVisualization()(implicit
ctx: RuntimeContext, ctx: RuntimeContext,
ec: ExecutionContext ec: ExecutionContext
): Future[Unit] = { ): Future[Unit] = {
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response(maybeRequestId, Api.VisualisationAttached()) Api.Response(maybeRequestId, Api.VisualizationAttached())
) )
val maybeFutureExecutable = val maybeFutureExecutable =
ctx.jobProcessor.run( ctx.jobProcessor.run(
new UpsertVisualisationJob( new UpsertVisualizationJob(
maybeRequestId, maybeRequestId,
request.visualisationId, request.visualizationId,
request.expressionId, request.expressionId,
request.visualisationConfig request.visualizationConfig
) )
) )
@ -75,13 +75,13 @@ class AttachVisualisationCmd(
): Future[Unit] = { ): Future[Unit] = {
Future { Future {
reply( reply(
Api.ContextNotExistError(request.visualisationConfig.executionContextId) Api.ContextNotExistError(request.visualizationConfig.executionContextId)
) )
} }
} }
override def toString: String = { override def toString: String = {
"AttachVisualizationCmd(visualizationId: " + request.visualisationId + ",expressionId=" + request.expressionId + ")" "AttachVisualizationCmd(visualizationId: " + request.visualizationId + ",expressionId=" + request.expressionId + ")"
} }
} }

View File

@ -34,14 +34,14 @@ object CommandFactory {
case _: Api.GetComponentGroupsRequest => case _: Api.GetComponentGroupsRequest =>
new GetComponentGroupsCmd(request.requestId) new GetComponentGroupsCmd(request.requestId)
case payload: Api.AttachVisualisation => case payload: Api.AttachVisualization =>
new AttachVisualisationCmd(request.requestId, payload) new AttachVisualizationCmd(request.requestId, payload)
case payload: Api.DetachVisualisation => case payload: Api.DetachVisualization =>
new DetachVisualisationCmd(request.requestId, payload) new DetachVisualizationCmd(request.requestId, payload)
case payload: Api.ModifyVisualisation => case payload: Api.ModifyVisualization =>
new ModifyVisualisationCmd(request.requestId, payload) new ModifyVisualizationCmd(request.requestId, payload)
case payload: Api.RenameProject => case payload: Api.RenameProject =>
new RenameProjectCmd(request.requestId, payload) new RenameProjectCmd(request.requestId, payload)

View File

@ -1,21 +1,21 @@
package org.enso.interpreter.instrument.command package org.enso.interpreter.instrument.command
import org.enso.interpreter.instrument.execution.RuntimeContext import org.enso.interpreter.instrument.execution.RuntimeContext
import org.enso.interpreter.instrument.job.DetachVisualisationJob import org.enso.interpreter.instrument.job.DetachVisualizationJob
import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api
import org.enso.polyglot.runtime.Runtime.Api.RequestId import org.enso.polyglot.runtime.Runtime.Api.RequestId
import java.util.logging.Level import java.util.logging.Level
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
/** A command that detaches a visualisation from the expression. /** A command that detaches a visualization from the expression.
* *
* @param maybeRequestId an option with request id * @param maybeRequestId an option with request id
* @param request a request for a service * @param request a request for a service
*/ */
class DetachVisualisationCmd( class DetachVisualizationCmd(
maybeRequestId: Option[RequestId], maybeRequestId: Option[RequestId],
request: Api.DetachVisualisation request: Api.DetachVisualization
) extends AsynchronousCommand(maybeRequestId) { ) extends AsynchronousCommand(maybeRequestId) {
/** @inheritdoc */ /** @inheritdoc */
@ -35,7 +35,7 @@ class DetachVisualisationCmd(
ctx.locking.releaseContextLock(request.contextId) ctx.locking.releaseContextLock(request.contextId)
logger.log( logger.log(
Level.FINEST, Level.FINEST,
s"Kept context lock [DetachVisualisationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds" s"Kept context lock [DetachVisualizationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
) )
} }
} }
@ -48,11 +48,11 @@ class DetachVisualisationCmd(
ctx: RuntimeContext ctx: RuntimeContext
): Future[Unit] = { ): Future[Unit] = {
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response(maybeRequestId, Api.VisualisationDetached()) Api.Response(maybeRequestId, Api.VisualizationDetached())
) )
ctx.jobProcessor.run( ctx.jobProcessor.run(
new DetachVisualisationJob( new DetachVisualizationJob(
request.visualisationId, request.visualizationId,
request.expressionId, request.expressionId,
request.contextId request.contextId
) )

View File

@ -5,7 +5,7 @@ import org.enso.interpreter.instrument.job.{
EnsureCompiledJob, EnsureCompiledJob,
ExecuteJob, ExecuteJob,
Job, Job,
UpsertVisualisationJob UpsertVisualizationJob
} }
import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api
import org.enso.polyglot.runtime.Runtime.Api.ExpressionId import org.enso.polyglot.runtime.Runtime.Api.ExpressionId
@ -13,14 +13,14 @@ import org.enso.polyglot.runtime.Runtime.Api.ExpressionId
import java.util.logging.Level import java.util.logging.Level
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
/** A command that modifies a visualisation. /** A command that modifies a visualization.
* *
* @param maybeRequestId an option with request id * @param maybeRequestId an option with request id
* @param request a request for a service * @param request a request for a service
*/ */
class ModifyVisualisationCmd( class ModifyVisualizationCmd(
maybeRequestId: Option[Api.RequestId], maybeRequestId: Option[Api.RequestId],
request: Api.ModifyVisualisation request: Api.ModifyVisualization
) extends AsynchronousCommand(maybeRequestId) { ) extends AsynchronousCommand(maybeRequestId) {
/** @inheritdoc */ /** @inheritdoc */
@ -29,11 +29,11 @@ class ModifyVisualisationCmd(
ec: ExecutionContext ec: ExecutionContext
): Future[Unit] = { ): Future[Unit] = {
val logger = ctx.executionService.getLogger val logger = ctx.executionService.getLogger
val contextId = request.visualisationConfig.executionContextId val contextId = request.visualizationConfig.executionContextId
val lockTimestamp = ctx.locking.acquireContextLock(contextId) val lockTimestamp = ctx.locking.acquireContextLock(contextId)
try { try {
if (doesContextExist) { if (doesContextExist) {
modifyVisualisation() modifyVisualization()
} else { } else {
replyWithContextNotExistError() replyWithContextNotExistError()
} }
@ -41,47 +41,47 @@ class ModifyVisualisationCmd(
ctx.locking.releaseContextLock(contextId) ctx.locking.releaseContextLock(contextId)
logger.log( logger.log(
Level.FINEST, Level.FINEST,
s"Kept context lock [UpsertVisualisationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds" s"Kept context lock [UpsertVisualizationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
) )
} }
} }
private def modifyVisualisation()(implicit private def modifyVisualization()(implicit
ctx: RuntimeContext, ctx: RuntimeContext,
ec: ExecutionContext ec: ExecutionContext
): Future[Unit] = { ): Future[Unit] = {
val existingVisualisation = ctx.contextManager.getVisualisationById( val existingVisualization = ctx.contextManager.getVisualizationById(
request.visualisationConfig.executionContextId, request.visualizationConfig.executionContextId,
request.visualisationId request.visualizationId
) )
val visualisationPresent: Option[ExpressionId] = val visualizationPresent: Option[ExpressionId] =
existingVisualisation.map(_.expressionId).orElse { existingVisualization.map(_.expressionId).orElse {
val jobFilter: PartialFunction[Job[_], Option[ExpressionId]] = { val jobFilter: PartialFunction[Job[_], Option[ExpressionId]] = {
case upsert: UpsertVisualisationJob case upsert: UpsertVisualizationJob
if upsert.getVisualizationId() == request.visualisationId => if upsert.getVisualizationId() == request.visualizationId =>
Some(upsert.key) Some(upsert.key)
} }
ctx.jobControlPlane.jobInProgress(jobFilter) ctx.jobControlPlane.jobInProgress(jobFilter)
} }
visualisationPresent match { visualizationPresent match {
case None => case None =>
Future { Future {
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response(maybeRequestId, Api.VisualisationNotFound()) Api.Response(maybeRequestId, Api.VisualizationNotFound())
) )
} }
case Some(expressionId) => case Some(expressionId) =>
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response(maybeRequestId, Api.VisualisationModified()) Api.Response(maybeRequestId, Api.VisualizationModified())
) )
val maybeFutureExecutable = val maybeFutureExecutable =
ctx.jobProcessor.run( ctx.jobProcessor.run(
new UpsertVisualisationJob( new UpsertVisualizationJob(
maybeRequestId, maybeRequestId,
request.visualisationId, request.visualizationId,
expressionId, expressionId,
request.visualisationConfig request.visualizationConfig
) )
) )
maybeFutureExecutable flatMap { maybeFutureExecutable flatMap {
@ -101,7 +101,7 @@ class ModifyVisualisationCmd(
private def doesContextExist(implicit ctx: RuntimeContext): Boolean = { private def doesContextExist(implicit ctx: RuntimeContext): Boolean = {
ctx.contextManager.contains( ctx.contextManager.contains(
request.visualisationConfig.executionContextId request.visualizationConfig.executionContextId
) )
} }
@ -111,13 +111,13 @@ class ModifyVisualisationCmd(
): Future[Unit] = { ): Future[Unit] = {
Future { Future {
reply( reply(
Api.ContextNotExistError(request.visualisationConfig.executionContextId) Api.ContextNotExistError(request.visualizationConfig.executionContextId)
) )
} }
} }
override def toString: String = { override def toString: String = {
"ModifyVisualisationCmd(visualizationId: " + request.visualisationId + ")" "ModifyVisualizationCmd(visualizationId: " + request.visualizationId + ")"
} }
} }

View File

@ -4,19 +4,19 @@ import org.enso.interpreter.instrument.execution.RuntimeContext
import org.enso.polyglot.runtime.Runtime.Api.{ import org.enso.polyglot.runtime.Runtime.Api.{
ContextId, ContextId,
ExpressionId, ExpressionId,
VisualisationId VisualizationId
} }
import java.util.logging.Level import java.util.logging.Level
/** A job that detaches a visualisation. /** A job that detaches a visualization.
* *
* @param visualisationId an identifier of visualisation * @param visualizationId an identifier of visualization
* @param expressionId an identifier of expression * @param expressionId an identifier of expression
* @param contextId an execution context id * @param contextId an execution context id
*/ */
class DetachVisualisationJob( class DetachVisualizationJob(
visualisationId: VisualisationId, visualizationId: VisualizationId,
expressionId: ExpressionId, expressionId: ExpressionId,
contextId: ContextId contextId: ContextId
) extends UniqueJob[Unit](expressionId, List(contextId), false) { ) extends UniqueJob[Unit](expressionId, List(contextId), false) {
@ -26,16 +26,16 @@ class DetachVisualisationJob(
val logger = ctx.executionService.getLogger val logger = ctx.executionService.getLogger
val lockTimestamp = ctx.locking.acquireContextLock(contextId) val lockTimestamp = ctx.locking.acquireContextLock(contextId)
try { try {
ctx.contextManager.removeVisualisation( ctx.contextManager.removeVisualization(
contextId, contextId,
expressionId, expressionId,
visualisationId visualizationId
) )
} finally { } finally {
ctx.locking.releaseContextLock(contextId) ctx.locking.releaseContextLock(contextId)
logger.log( logger.log(
Level.FINEST, Level.FINEST,
s"Kept context lock [DetachVisualisationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds" s"Kept context lock [DetachVisualizationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
) )
} }
} }

View File

@ -17,7 +17,7 @@ import org.enso.interpreter.instrument.execution.{
import org.enso.interpreter.instrument.{ import org.enso.interpreter.instrument.{
CacheInvalidation, CacheInvalidation,
InstrumentFrame, InstrumentFrame,
Visualisation Visualization
} }
import org.enso.interpreter.runtime.Module import org.enso.interpreter.runtime.Module
import org.enso.interpreter.service.error.ModuleNotFoundForFileException import org.enso.interpreter.service.error.ModuleNotFoundForFileException
@ -359,23 +359,23 @@ final class EnsureCompiledJob(protected val files: Iterable[File])
CacheInvalidation.runAll(stack, invalidationCommands) CacheInvalidation.runAll(stack, invalidationCommands)
} }
} }
CacheInvalidation.runAllVisualisations( CacheInvalidation.runAllVisualizations(
ctx.contextManager.getVisualisations(module.getName), ctx.contextManager.getVisualizations(module.getName),
invalidationCommands invalidationCommands
) )
val invalidatedVisualisations = val invalidatedVisualizations =
ctx.contextManager.getInvalidatedVisualisations( ctx.contextManager.getInvalidatedVisualizations(
module.getName, module.getName,
changeset.invalidated changeset.invalidated
) )
invalidatedVisualisations.foreach { visualisation => invalidatedVisualizations.foreach { visualization =>
UpsertVisualisationJob.upsertVisualisation(visualisation) UpsertVisualizationJob.upsertVisualization(visualization)
} }
if (invalidatedVisualisations.nonEmpty) { if (invalidatedVisualizations.nonEmpty) {
ctx.executionService.getLogger.log( ctx.executionService.getLogger.log(
Level.FINEST, Level.FINEST,
s"Invalidated visualisations [${invalidatedVisualisations.map(_.id)}]" s"Invalidated visualizations [${invalidatedVisualizations.map(_.id)}]"
) )
} }
@ -450,10 +450,10 @@ final class EnsureCompiledJob(protected val files: Iterable[File])
) )
} }
} }
val visualisations = ctx.contextManager.getAllVisualisations val visualizations = ctx.contextManager.getAllVisualizations
visualisations.flatMap(getCacheMetadata).foreach { metadata => visualizations.flatMap(getCacheMetadata).foreach { metadata =>
CacheInvalidation.runVisualisations( CacheInvalidation.runVisualizations(
visualisations, visualizations,
CacheInvalidation.Command.SetMetadata(metadata) CacheInvalidation.Command.SetMetadata(metadata)
) )
} }
@ -476,9 +476,9 @@ final class EnsureCompiledJob(protected val files: Iterable[File])
} }
private def getCacheMetadata( private def getCacheMetadata(
visualisation: Visualisation visualization: Visualization
): Option[CachePreferenceAnalysis.Metadata] = { ): Option[CachePreferenceAnalysis.Metadata] = {
val module = visualisation.module val module = visualization.module
module.getIr.getMetadata(CachePreferenceAnalysis) module.getIr.getMetadata(CachePreferenceAnalysis)
} }

View File

@ -64,7 +64,7 @@ object ProgramExecutionSupport {
if (callStack.isEmpty) { if (callStack.isEmpty) {
logger.log(Level.FINEST, s"ON_CACHED_VALUE ${value.getExpressionId}") logger.log(Level.FINEST, s"ON_CACHED_VALUE ${value.getExpressionId}")
sendExpressionUpdate(contextId, executionFrame.syncState, value) sendExpressionUpdate(contextId, executionFrame.syncState, value)
sendVisualisationUpdates(contextId, executionFrame.syncState, value) sendVisualizationUpdates(contextId, executionFrame.syncState, value)
} }
} }
@ -72,7 +72,7 @@ object ProgramExecutionSupport {
if (callStack.isEmpty) { if (callStack.isEmpty) {
logger.log(Level.FINEST, s"ON_COMPUTED ${value.getExpressionId}") logger.log(Level.FINEST, s"ON_COMPUTED ${value.getExpressionId}")
sendExpressionUpdate(contextId, executionFrame.syncState, value) sendExpressionUpdate(contextId, executionFrame.syncState, value)
sendVisualisationUpdates(contextId, executionFrame.syncState, value) sendVisualizationUpdates(contextId, executionFrame.syncState, value)
} }
} }
@ -406,7 +406,7 @@ object ProgramExecutionSupport {
} }
} }
/** Find visualisations for the provided expression value, compute and send /** Find visualizations for the provided expression value, compute and send
* the updates. * the updates.
* *
* @param contextId the identifier of an execution context * @param contextId the identifier of an execution context
@ -414,22 +414,22 @@ object ProgramExecutionSupport {
* @param ctx the runtime context * @param ctx the runtime context
*/ */
@com.oracle.truffle.api.CompilerDirectives.TruffleBoundary @com.oracle.truffle.api.CompilerDirectives.TruffleBoundary
private def sendVisualisationUpdates( private def sendVisualizationUpdates(
contextId: ContextId, contextId: ContextId,
syncState: UpdatesSynchronizationState, syncState: UpdatesSynchronizationState,
value: ExpressionValue value: ExpressionValue
)(implicit ctx: RuntimeContext): Unit = { )(implicit ctx: RuntimeContext): Unit = {
if (!syncState.isVisualisationSync(value.getExpressionId)) { if (!syncState.isVisualizationSync(value.getExpressionId)) {
val visualisations = val visualizations =
ctx.contextManager.findVisualisationForExpression( ctx.contextManager.findVisualizationForExpression(
contextId, contextId,
value.getExpressionId value.getExpressionId
) )
visualisations.foreach { visualisation => visualizations.foreach { visualization =>
sendVisualisationUpdate( sendVisualizationUpdate(
contextId, contextId,
syncState, syncState,
visualisation, visualization,
value.getExpressionId, value.getExpressionId,
value.getValue value.getValue
) )
@ -437,41 +437,41 @@ object ProgramExecutionSupport {
} }
} }
/** Compute the visualisation of the expression value and send an update. /** Compute the visualization of the expression value and send an update.
* *
* @param contextId an identifier of an execution context * @param contextId an identifier of an execution context
* @param visualisation the visualisation data * @param visualization the visualization data
* @param expressionId the id of expression to visualise * @param expressionId the id of expression to visualise
* @param expressionValue the value of expression to visualise * @param expressionValue the value of expression to visualise
* @param ctx the runtime context * @param ctx the runtime context
*/ */
def sendVisualisationUpdate( def sendVisualizationUpdate(
contextId: ContextId, contextId: ContextId,
syncState: UpdatesSynchronizationState, syncState: UpdatesSynchronizationState,
visualisation: Visualisation, visualization: Visualization,
expressionId: UUID, expressionId: UUID,
expressionValue: AnyRef expressionValue: AnyRef
)(implicit ctx: RuntimeContext): Unit = { )(implicit ctx: RuntimeContext): Unit = {
val errorOrVisualisationData = val errorOrVisualizationData =
Either Either
.catchNonFatal { .catchNonFatal {
ctx.executionService.getLogger.log( ctx.executionService.getLogger.log(
Level.FINE, Level.FINE,
s"Executing visualisation ${visualisation.expressionId}" s"Executing visualization ${visualization.expressionId}"
) )
ctx.executionService.callFunctionWithInstrument( ctx.executionService.callFunctionWithInstrument(
visualisation.cache, visualization.cache,
visualisation.module, visualization.module,
visualisation.callback, visualization.callback,
expressionValue +: visualisation.arguments: _* expressionValue +: visualization.arguments: _*
) )
} }
.flatMap(visualizationResultToBytes) .flatMap(visualizationResultToBytes)
val result = errorOrVisualisationData match { val result = errorOrVisualizationData match {
case Left(_: ThreadInterruptedException) => case Left(_: ThreadInterruptedException) =>
ctx.executionService.getLogger.log( ctx.executionService.getLogger.log(
Level.FINE, Level.FINE,
s"Visualisation thread interrupted ${visualisation.expressionId}." s"Visualization thread interrupted ${visualization.expressionId}."
) )
Completion.Interrupted Completion.Interrupted
@ -480,13 +480,13 @@ object ProgramExecutionSupport {
Option(error.getMessage).getOrElse(error.getClass.getSimpleName) Option(error.getMessage).getOrElse(error.getClass.getSimpleName)
ctx.executionService.getLogger.log( ctx.executionService.getLogger.log(
Level.WARNING, Level.WARNING,
s"Visualisation evaluation failed: $message." s"Visualization evaluation failed: $message."
) )
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response( Api.Response(
Api.VisualisationEvaluationFailed( Api.VisualizationEvaluationFailed(
contextId, contextId,
visualisation.id, visualization.id,
expressionId, expressionId,
message, message,
getDiagnosticOutcome.lift(error) getDiagnosticOutcome.lift(error)
@ -498,13 +498,13 @@ object ProgramExecutionSupport {
case Right(data) => case Right(data) =>
ctx.executionService.getLogger.log( ctx.executionService.getLogger.log(
Level.FINEST, Level.FINEST,
s"Visualisation computed ${visualisation.expressionId}." s"Visualization computed ${visualization.expressionId}."
) )
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response( Api.Response(
Api.VisualisationUpdate( Api.VisualizationUpdate(
Api.VisualisationContext( Api.VisualizationContext(
visualisation.id, visualization.id,
contextId, contextId,
expressionId expressionId
), ),
@ -515,7 +515,7 @@ object ProgramExecutionSupport {
Completion.Done Completion.Done
} }
if (result != Completion.Interrupted) { if (result != Completion.Interrupted) {
syncState.setVisualisationSync(expressionId) syncState.setVisualizationSync(expressionId)
} }
} }
@ -527,9 +527,9 @@ object ProgramExecutionSupport {
*/ */
private def visualizationResultToBytes( private def visualizationResultToBytes(
value: AnyRef value: AnyRef
): Either[VisualisationException, Array[Byte]] = { ): Either[VisualizationException, Array[Byte]] = {
Option(VisualizationResult.visualizationResultToBytes(value)).toRight( Option(VisualizationResult.visualizationResultToBytes(value)).toRight(
new VisualisationException( new VisualizationException(
s"Cannot encode ${value.getClass} to byte array." s"Cannot encode ${value.getClass} to byte array."
) )
) )

View File

@ -8,7 +8,7 @@ import org.enso.compiler.pass.analyse.{
DataflowAnalysis DataflowAnalysis
} }
import org.enso.interpreter.instrument.execution.{Executable, RuntimeContext} import org.enso.interpreter.instrument.execution.{Executable, RuntimeContext}
import org.enso.interpreter.instrument.job.UpsertVisualisationJob.{ import org.enso.interpreter.instrument.job.UpsertVisualizationJob.{
EvaluationFailed, EvaluationFailed,
EvaluationResult, EvaluationResult,
ModuleNotFound ModuleNotFound
@ -17,7 +17,7 @@ import org.enso.interpreter.instrument.{
CacheInvalidation, CacheInvalidation,
InstrumentFrame, InstrumentFrame,
RuntimeCache, RuntimeCache,
Visualisation Visualization
} }
import org.enso.interpreter.runtime.Module import org.enso.interpreter.runtime.Module
import org.enso.interpreter.runtime.control.ThreadInterruptedException import org.enso.interpreter.runtime.control.ThreadInterruptedException
@ -27,29 +27,29 @@ import org.enso.polyglot.runtime.Runtime.Api
import java.util.logging.Level import java.util.logging.Level
/** A job that upserts a visualisation. /** A job that upserts a visualization.
* *
* @param requestId maybe a request id * @param requestId maybe a request id
* @param visualisationId an identifier of visualisation * @param visualizationId an identifier of visualization
* @param expressionId an identifier of expression * @param expressionId an identifier of expression
* @param config a visualisation config * @param config a visualization config
*/ */
class UpsertVisualisationJob( class UpsertVisualizationJob(
requestId: Option[Api.RequestId], requestId: Option[Api.RequestId],
visualisationId: Api.VisualisationId, visualizationId: Api.VisualizationId,
expressionId: Api.ExpressionId, expressionId: Api.ExpressionId,
config: Api.VisualisationConfiguration config: Api.VisualizationConfiguration
) extends UniqueJob[Option[Executable]]( ) extends UniqueJob[Option[Executable]](
expressionId, expressionId,
List(config.executionContextId), List(config.executionContextId),
false false
) { ) {
/** Return the id of the visualisation associated with this job /** Return the id of the visualization associated with this job
* *
* @return visualisation id * @return visualization id
*/ */
def getVisualizationId(): Api.VisualisationId = visualisationId def getVisualizationId(): Api.VisualizationId = visualizationId
/** @inheritdoc */ /** @inheritdoc */
override def run(implicit ctx: RuntimeContext): Option[Executable] = { override def run(implicit ctx: RuntimeContext): Option[Executable] = {
@ -58,7 +58,7 @@ class UpsertVisualisationJob(
ctx.locking.acquireContextLock(config.executionContextId) ctx.locking.acquireContextLock(config.executionContextId)
try { try {
val maybeCallable = val maybeCallable =
UpsertVisualisationJob.evaluateVisualisationExpression( UpsertVisualizationJob.evaluateVisualizationExpression(
config.expression config.expression
) )
@ -72,9 +72,9 @@ class UpsertVisualisationJob(
None None
case Right(EvaluationResult(module, callable, arguments)) => case Right(EvaluationResult(module, callable, arguments)) =>
val visualisation = val visualization =
UpsertVisualisationJob.updateVisualisation( UpsertVisualizationJob.updateVisualization(
visualisationId, visualizationId,
expressionId, expressionId,
module, module,
config, config,
@ -84,16 +84,16 @@ class UpsertVisualisationJob(
val stack = ctx.contextManager.getStack(config.executionContextId) val stack = ctx.contextManager.getStack(config.executionContextId)
val cachedValue = stack.headOption val cachedValue = stack.headOption
.flatMap(frame => Option(frame.cache.get(expressionId))) .flatMap(frame => Option(frame.cache.get(expressionId)))
UpsertVisualisationJob.requireVisualisationSynchronization( UpsertVisualizationJob.requireVisualizationSynchronization(
stack, stack,
expressionId expressionId
) )
cachedValue match { cachedValue match {
case Some(value) => case Some(value) =>
ProgramExecutionSupport.sendVisualisationUpdate( ProgramExecutionSupport.sendVisualizationUpdate(
config.executionContextId, config.executionContextId,
stack.headOption.get.syncState, stack.headOption.get.syncState,
visualisation, visualization,
expressionId, expressionId,
value value
) )
@ -106,7 +106,7 @@ class UpsertVisualisationJob(
ctx.locking.releaseContextLock(config.executionContextId) ctx.locking.releaseContextLock(config.executionContextId)
logger.log( logger.log(
Level.FINEST, Level.FINEST,
s"Kept context lock [UpsertVisualisationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds" s"Kept context lock [UpsertVisualizationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
) )
} }
} }
@ -118,7 +118,7 @@ class UpsertVisualisationJob(
ctx.endpoint.sendToClient( ctx.endpoint.sendToClient(
Api.Response( Api.Response(
requestId, requestId,
Api.VisualisationExpressionFailed(message, executionResult) Api.VisualizationExpressionFailed(message, executionResult)
) )
) )
} }
@ -130,7 +130,7 @@ class UpsertVisualisationJob(
} }
} }
object UpsertVisualisationJob { object UpsertVisualizationJob {
/** The number of times to retry the expression evaluation. */ /** The number of times to retry the expression evaluation. */
val MaxEvaluationRetryCount: Int = 5 val MaxEvaluationRetryCount: Int = 5
@ -168,32 +168,32 @@ object UpsertVisualisationJob {
arguments: Vector[AnyRef] arguments: Vector[AnyRef]
) )
/** Upsert the provided visualisation. /** Upsert the provided visualization.
* *
* @param visualisation the visualisation to update * @param visualization the visualization to update
* @param ctx the runtime context * @param ctx the runtime context
*/ */
def upsertVisualisation( def upsertVisualization(
visualisation: Visualisation visualization: Visualization
)(implicit ctx: RuntimeContext, logger: TruffleLogger): Unit = { )(implicit ctx: RuntimeContext, logger: TruffleLogger): Unit = {
val visualisationConfig = visualisation.config val visualizationConfig = visualization.config
val expressionId = visualisation.expressionId val expressionId = visualization.expressionId
val visualisationId = visualisation.id val visualizationId = visualization.id
val maybeCallable = val maybeCallable =
evaluateVisualisationExpression(visualisation.config.expression) evaluateVisualizationExpression(visualization.config.expression)
maybeCallable.foreach { result => maybeCallable.foreach { result =>
updateVisualisation( updateVisualization(
visualisationId, visualizationId,
expressionId, expressionId,
result.module, result.module,
visualisationConfig, visualizationConfig,
result.callback, result.callback,
result.arguments result.arguments
) )
val stack = val stack =
ctx.contextManager.getStack(visualisationConfig.executionContextId) ctx.contextManager.getStack(visualizationConfig.executionContextId)
requireVisualisationSynchronization(stack, expressionId) requireVisualizationSynchronization(stack, expressionId)
} }
} }
@ -213,17 +213,17 @@ object UpsertVisualisationJob {
else Left(ModuleNotFound(moduleName)) else Left(ModuleNotFound(moduleName))
} }
/** Evaluate the visualisation expression in a given module. /** Evaluate the visualization expression in a given module.
* *
* @param module the module where to evaluate the expression * @param module the module where to evaluate the expression
* @param expression the visualisation expression * @param expression the visualization expression
* @param retryCount the number of attempted retries * @param retryCount the number of attempted retries
* @param ctx the runtime context * @param ctx the runtime context
* @return either the evaluation result or an evaluation failure * @return either the evaluation result or an evaluation failure
*/ */
private def evaluateModuleExpression( private def evaluateModuleExpression(
module: Module, module: Module,
expression: Api.VisualisationExpression, expression: Api.VisualizationExpression,
retryCount: Int = 0 retryCount: Int = 0
)(implicit )(implicit
ctx: RuntimeContext ctx: RuntimeContext
@ -231,14 +231,14 @@ object UpsertVisualisationJob {
Either Either
.catchNonFatal { .catchNonFatal {
val (callback, arguments) = expression match { val (callback, arguments) = expression match {
case Api.VisualisationExpression.Text(_, expression) => case Api.VisualizationExpression.Text(_, expression) =>
val callback = ctx.executionService.evaluateExpression( val callback = ctx.executionService.evaluateExpression(
module, module,
expression expression
) )
val arguments = Vector() val arguments = Vector()
(callback, arguments) (callback, arguments)
case Api.VisualisationExpression.ModuleMethod( case Api.VisualizationExpression.ModuleMethod(
Api.MethodPointer(_, definedOnType, name), Api.MethodPointer(_, definedOnType, name),
argumentExpressions argumentExpressions
) => ) =>
@ -259,7 +259,7 @@ object UpsertVisualisationJob {
if retryCount < MaxEvaluationRetryCount => if retryCount < MaxEvaluationRetryCount =>
ctx.executionService.getLogger.log( ctx.executionService.getLogger.log(
Level.FINE, Level.FINE,
s"Evaluation of visualisation was interrupted. Retrying [${retryCount + 1}]." s"Evaluation of visualization was interrupted. Retrying [${retryCount + 1}]."
) )
evaluateModuleExpression(module, expression, retryCount + 1) evaluateModuleExpression(module, expression, retryCount + 1)
@ -295,14 +295,14 @@ object UpsertVisualisationJob {
) )
} }
/** Evaluate the visualisation expression. /** Evaluate the visualization expression.
* *
* @param expression the visualisation expression to evaluate * @param expression the visualization expression to evaluate
* @param ctx the runtime context * @param ctx the runtime context
* @return either the evaluation result or an evaluation error * @return either the evaluation result or an evaluation error
*/ */
private def evaluateVisualisationExpression( private def evaluateVisualizationExpression(
expression: Api.VisualisationExpression expression: Api.VisualizationExpression
)(implicit )(implicit
ctx: RuntimeContext ctx: RuntimeContext
): Either[EvaluationFailure, EvaluationResult] = { ): Either[EvaluationFailure, EvaluationResult] = {
@ -312,66 +312,66 @@ object UpsertVisualisationJob {
} yield expression } yield expression
} }
/** Update the visualisation state. /** Update the visualization state.
* *
* @param visualisationId the visualisation identifier * @param visualizationId the visualization identifier
* @param expressionId the expression to which the visualisation is applied * @param expressionId the expression to which the visualization is applied
* @param module the module containing the visualisation * @param module the module containing the visualization
* @param visualisationConfig the visualisation configuration * @param visualizationConfig the visualization configuration
* @param callback the visualisation callback function * @param callback the visualization callback function
* @param arguments the list of arugments that will be passed to the callback * @param arguments the list of arugments that will be passed to the callback
* @param ctx the runtime context * @param ctx the runtime context
* @return the re-evaluated visualisation * @return the re-evaluated visualization
*/ */
private def updateVisualisation( private def updateVisualization(
visualisationId: Api.VisualisationId, visualizationId: Api.VisualizationId,
expressionId: Api.ExpressionId, expressionId: Api.ExpressionId,
module: Module, module: Module,
visualisationConfig: Api.VisualisationConfiguration, visualizationConfig: Api.VisualizationConfiguration,
callback: AnyRef, callback: AnyRef,
arguments: Vector[AnyRef] arguments: Vector[AnyRef]
)(implicit ctx: RuntimeContext, logger: TruffleLogger): Visualisation = { )(implicit ctx: RuntimeContext, logger: TruffleLogger): Visualization = {
val visualisationExpressionId = val visualizationExpressionId =
findVisualisationExpressionId(module, visualisationConfig.expression) findVisualizationExpressionId(module, visualizationConfig.expression)
val visualisation = Visualisation( val visualization = Visualization(
visualisationId, visualizationId,
expressionId, expressionId,
new RuntimeCache(), new RuntimeCache(),
module, module,
visualisationConfig, visualizationConfig,
visualisationExpressionId, visualizationExpressionId,
callback, callback,
arguments arguments
) )
val writeLockTimestamp = ctx.locking.acquireWriteCompilationLock() val writeLockTimestamp = ctx.locking.acquireWriteCompilationLock()
try { try {
invalidateCaches(visualisation) invalidateCaches(visualization)
} finally { } finally {
ctx.locking.releaseWriteCompilationLock() ctx.locking.releaseWriteCompilationLock()
logger.log( logger.log(
Level.FINEST, Level.FINEST,
s"Kept write compilation lock [UpsertVisualisationJob] for ${System.currentTimeMillis() - writeLockTimestamp} milliseconds" s"Kept write compilation lock [UpsertVisualizationJob] for ${System.currentTimeMillis() - writeLockTimestamp} milliseconds"
) )
} }
ctx.contextManager.upsertVisualisation( ctx.contextManager.upsertVisualization(
visualisationConfig.executionContextId, visualizationConfig.executionContextId,
visualisation visualization
) )
visualisation visualization
} }
/** Find the expressionId of visualisation function. /** Find the expressionId of visualization function.
* *
* @param module the module environment * @param module the module environment
* @param visualisationExpression the visualisation expression * @param visualizationExpression the visualization expression
* @return the expression id of required visualisation function * @return the expression id of required visualization function
*/ */
private def findVisualisationExpressionId( private def findVisualizationExpressionId(
module: Module, module: Module,
visualisationExpression: Api.VisualisationExpression visualizationExpression: Api.VisualizationExpression
): Option[Api.ExpressionId] = ): Option[Api.ExpressionId] =
visualisationExpression match { visualizationExpression match {
case Api.VisualisationExpression.ModuleMethod(methodPointer, _) => case Api.VisualizationExpression.ModuleMethod(methodPointer, _) =>
module.getIr.bindings module.getIr.bindings
.collect { case method: IR.Module.Scope.Definition.Method => .collect { case method: IR.Module.Scope.Definition.Method =>
val methodReference = method.methodReference val methodReference = method.methodReference
@ -390,14 +390,14 @@ object UpsertVisualisationJob {
.flatten .flatten
.headOption .headOption
case _: Api.VisualisationExpression.Text => None case _: Api.VisualizationExpression.Text => None
} }
/** Update the caches. */ /** Update the caches. */
private def invalidateCaches( private def invalidateCaches(
visualisation: Visualisation visualization: Visualization
)(implicit ctx: RuntimeContext): Unit = { )(implicit ctx: RuntimeContext): Unit = {
setCacheWeights(visualisation) setCacheWeights(visualization)
val stacks = ctx.contextManager.getAllContexts.values val stacks = ctx.contextManager.getAllContexts.values
/* The invalidation of the first cached dependent node is required for /* The invalidation of the first cached dependent node is required for
* attaching the visualizations to sub-expressions. Consider the example * attaching the visualizations to sub-expressions. Consider the example
@ -412,8 +412,8 @@ object UpsertVisualisationJob {
* visualized expression is a sub-expression and invalidate the first parent * visualized expression is a sub-expression and invalidate the first parent
* expression accordingly. * expression accordingly.
*/ */
if (!stacks.exists(isExpressionCached(visualisation.expressionId, _))) { if (!stacks.exists(isExpressionCached(visualization.expressionId, _))) {
invalidateFirstDependent(visualisation.expressionId) invalidateFirstDependent(visualization.expressionId)
} }
} }
@ -432,15 +432,15 @@ object UpsertVisualisationJob {
} }
} }
/** Set the cache weights for the provided visualisation. /** Set the cache weights for the provided visualization.
* *
* @param visualisation the visualisation to update * @param visualization the visualization to update
*/ */
private def setCacheWeights(visualisation: Visualisation): Unit = { private def setCacheWeights(visualization: Visualization): Unit = {
visualisation.module.getIr.getMetadata(CachePreferenceAnalysis).foreach { visualization.module.getIr.getMetadata(CachePreferenceAnalysis).foreach {
metadata => metadata =>
CacheInvalidation.runVisualisations( CacheInvalidation.runVisualizations(
Seq(visualisation), Seq(visualization),
CacheInvalidation.Command.SetMetadata(metadata) CacheInvalidation.Command.SetMetadata(metadata)
) )
} }
@ -495,15 +495,15 @@ object UpsertVisualisationJob {
} }
} }
/** Require to send the visualisation update. /** Require to send the visualization update.
* *
* @param stack the execution stack * @param stack the execution stack
* @param expressionId the expression id to which the visualisation is applied * @param expressionId the expression id to which the visualization is applied
*/ */
private def requireVisualisationSynchronization( private def requireVisualizationSynchronization(
stack: Iterable[InstrumentFrame], stack: Iterable[InstrumentFrame],
expressionId: Api.ExpressionId expressionId: Api.ExpressionId
): Unit = ): Unit =
stack.foreach(_.syncState.setVisualisationUnsync(expressionId)) stack.foreach(_.syncState.setVisualizationUnsync(expressionId))
} }

View File

@ -264,7 +264,7 @@ public class IdExecutionInstrument extends TruffleInstrument implements IdExecut
new ExpressionValue( new ExpressionValue(
nodeId, result, resultType, cachedType, call, cachedCall, profilingInfo, false); nodeId, result, resultType, cachedType, call, cachedCall, profilingInfo, false);
syncState.setExpressionUnsync(nodeId); syncState.setExpressionUnsync(nodeId);
syncState.setVisualisationUnsync(nodeId); syncState.setVisualizationUnsync(nodeId);
// Panics are not cached because a panic can be fixed by changing seemingly unrelated code, // Panics are not cached because a panic can be fixed by changing seemingly unrelated code,
// like imports, and the invalidation mechanism can not always track those changes and // like imports, and the invalidation mechanism can not always track those changes and

View File

@ -1,14 +1,14 @@
package org.enso.interpreter.service.error; package org.enso.interpreter.service.error;
/** Thrown when the execution of the visualisation expression fails. */ /** Thrown when the execution of the visualization expression fails. */
public class VisualisationException extends RuntimeException implements ServiceException { public class VisualizationException extends RuntimeException implements ServiceException {
/** /**
* Create new instance of this error. * Create new instance of this error.
* *
* @param message the error message. * @param message the error message.
*/ */
public VisualisationException(String message) { public VisualizationException(String message) {
super(message); super(message);
} }
} }

View File

@ -220,10 +220,10 @@ impl display::Object for Model {
// ============================ // ============================
// === VisualisationChooser === // === VisualizationChooser ===
// ============================ // ============================
/// UI entity that shows a button that opens a list of visualisations that can be selected from. /// UI entity that shows a button that opens a list of visualizations that can be selected from.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Clone, CloneRef, Debug)] #[derive(Clone, CloneRef, Debug)]
pub struct DropDownMenu { pub struct DropDownMenu {

View File

@ -232,7 +232,7 @@ impl FlameGraph {
&self.marks &self.marks
} }
/// Add an additional activity block to the visualisation. /// Add an additional activity block to the visualization.
pub fn add_block<BlockType: IntoThemePath>( pub fn add_block<BlockType: IntoThemePath>(
&mut self, &mut self,
block: profiler_flame_graph::Block<BlockType>, block: profiler_flame_graph::Block<BlockType>,
@ -243,7 +243,7 @@ impl FlameGraph {
self.blocks.push(shape); self.blocks.push(shape);
} }
/// Add additional mark to the visualisation. /// Add additional mark to the visualization.
pub fn add_mark(&mut self, mark: profiler_flame_graph::Mark) { pub fn add_mark(&mut self, mark: profiler_flame_graph::Mark) {
let mark = align_mark(mark, self.origin_x); let mark = align_mark(mark, self.origin_x);
let shape = shape_from_mark(mark, &self.app); let shape = shape_from_mark(mark, &self.app);

View File

@ -206,9 +206,9 @@ impl display::Object for Model {
} }
} }
/// A visualisation of messages passed between different actors. /// A visualization of messages passed between different actors.
/// ///
/// This visualisation renders a horizontal line for each actor and shows an arrow for each message. /// This visualization renders a horizontal line for each actor and shows an arrow for each message.
/// The arrow will point from the sender of the message to the receive of the message. Hovering /// The arrow will point from the sender of the message to the receive of the message. Hovering
/// over a actor line will show the name of the actor as a tooltip, hovering over a message will /// over a actor line will show the name of the actor as a tooltip, hovering over a message will
/// show the name of the message as a tooltip. /// show the name of the message as a tooltip.

View File

@ -1,6 +1,6 @@
//! Demo scene showing a sample flame graph. Can be used to display a log file, if you have one. //! Demo scene showing a sample flame graph. Can be used to display a log file, if you have one.
//! To do so, set a query parameter in the url to contain `file=<name _of_log_file>` and it //! To do so, set a query parameter in the url to contain `file=<name _of_log_file>` and it
//! will be used for rendering the visualisation. Note that the log file needs to be located in //! will be used for rendering the visualization. Note that the log file needs to be located in
//! the assets subdirectory that is served by the webserver, i.e. `enso/dist/content` or //! the assets subdirectory that is served by the webserver, i.e. `enso/dist/content` or
//! `app/ide-desktop/lib/content/assets`. If no name is given a file named `profile.json` will //! `app/ide-desktop/lib/content/assets`. If no name is given a file named `profile.json` will
//! be loaded by default. If that file is not present, some dummy data will be displayed. //! be loaded by default. If that file is not present, some dummy data will be displayed.

View File

@ -12,7 +12,7 @@ spec =
type_name = Meta.get_qualified_type_name value . to_text type_name = Meta.get_qualified_type_name value . to_text
type_name . should_equal <| expected_text type_name . should_equal <| expected_text
Test.group "Type Names of Visualisation Defaults" <| Test.group "Type Names of Visualization Defaults" <|
""" IMPORTANT: When updating this, also update the default values in """ IMPORTANT: When updating this, also update the default values in
app/gui/view/graph-editor/src/builtin/visualization/java_script/table.js:18 as this app/gui/view/graph-editor/src/builtin/visualization/java_script/table.js:18 as this
verifies that the type names do not go out of sync. Should be removed once verifies that the type names do not go out of sync. Should be removed once

View File

@ -3,7 +3,7 @@ from Standard.Visualization import all
from Standard.Table import Table from Standard.Table import Table
import Standard.Examples import Standard.Examples
import Standard.Visualization.Table as Table_Visualisation import Standard.Visualization.Table as Table_Visualization
import Standard.Visualization.Preprocessor as Preprocessor import Standard.Visualization.Preprocessor as Preprocessor
from Standard.Test import Test from Standard.Test import Test
@ -28,10 +28,10 @@ long_table =
spec = Test.group "Lazy Table Visualization" <| spec = Test.group "Lazy Table Visualization" <|
Test.specify "Fold Map" <| Test.specify "Fold Map" <|
(Table_Visualisation.fold_map 0 (acc -> item -> [acc + item, acc + item]) [1,2,3]).should_equal [1,3,6] (Table_Visualization.fold_map 0 (acc -> item -> [acc + item, acc + item]) [1,2,3]).should_equal [1,3,6]
Test.specify "Should return correct update" <| Test.specify "Should return correct update" <|
update = Table_Visualisation.compute_table_update sample_table [0,0] [0,0] [3,2] 5 update = Table_Visualization.compute_table_update sample_table [0,0] [0,0] [3,2] 5
update.chunks.contains [[[0,0], [0,0]], "12345"] . should_be_true update.chunks.contains [[[0,0], [0,0]], "12345"] . should_be_true
update.chunks.contains [[[0,0], [1,0]], "6789"] . should_be_true update.chunks.contains [[[0,0], [1,0]], "6789"] . should_be_true
update.chunks.contains [[[0, 1], [0, 0]], "23456"] . should_be_true update.chunks.contains [[[0, 1], [0, 0]], "23456"] . should_be_true
@ -40,7 +40,7 @@ spec = Test.group "Lazy Table Visualization" <|
update.chunks.contains [[[1, 1], [0, 0]], "5"] . should_be_true update.chunks.contains [[[1, 1], [0, 0]], "5"] . should_be_true
Test.specify "Should return correct update" <| Test.specify "Should return correct update" <|
update = Table_Visualisation.compute_table_update sample_table [0,0] [1,0] [3,2] 5 update = Table_Visualization.compute_table_update sample_table [0,0] [1,0] [3,2] 5
## update.should_equal [] ## update.should_equal []
update.chunks.contains [[[0,0], [1,0]], "6789"] . should_be_true update.chunks.contains [[[0,0], [1,0]], "6789"] . should_be_true
update.chunks.contains [[[0, 1], [1, 0]], "789"] . should_be_true update.chunks.contains [[[0, 1], [1, 0]], "789"] . should_be_true
@ -51,44 +51,44 @@ spec = Test.group "Lazy Table Visualization" <|
Test.specify "Find end column helper should return correct column index" <| Test.specify "Find end column helper should return correct column index" <|
(Table_Visualisation.find_end_column sample_table 0 0 1).should_equal 0 (Table_Visualization.find_end_column sample_table 0 0 1).should_equal 0
(Table_Visualisation.find_end_column sample_table 0 2 1).should_equal 0 (Table_Visualization.find_end_column sample_table 0 2 1).should_equal 0
(Table_Visualisation.find_end_column sample_table 0 3 5).should_equal 2 (Table_Visualization.find_end_column sample_table 0 3 5).should_equal 2
(Table_Visualisation.find_end_column sample_table 1 4 5).should_equal 5 (Table_Visualization.find_end_column sample_table 1 4 5).should_equal 5
(Table_Visualisation.find_end_column sample_table 0 9999 5).should_equal 6 (Table_Visualization.find_end_column sample_table 0 9999 5).should_equal 6
Test.specify "Find end row helper should return correct row index" <| Test.specify "Find end row helper should return correct row index" <|
(Table_Visualisation.find_end_row sample_table 1 4).should_equal 2 (Table_Visualization.find_end_row sample_table 1 4).should_equal 2
(Table_Visualisation.find_end_row sample_table 0 0).should_equal 0 (Table_Visualization.find_end_row sample_table 0 0).should_equal 0
(Table_Visualisation.find_end_row sample_table 1 0).should_equal 1 (Table_Visualization.find_end_row sample_table 1 0).should_equal 1
(Table_Visualisation.find_end_row long_table 1 2).should_equal 3 (Table_Visualization.find_end_row long_table 1 2).should_equal 3
(Table_Visualisation.find_end_row long_table 1 1).should_equal 2 (Table_Visualization.find_end_row long_table 1 1).should_equal 2
(Table_Visualisation.find_end_row long_table 50 10).should_equal 60 (Table_Visualization.find_end_row long_table 50 10).should_equal 60
Test.specify "Get column width helper should return correct colum width" <| Test.specify "Get column width helper should return correct colum width" <|
(Table_Visualisation.get_column_width (sample_table.columns.at 0)).should_equal 9 (Table_Visualization.get_column_width (sample_table.columns.at 0)).should_equal 9
(Table_Visualisation.get_column_width (sample_table.columns.at 1)).should_equal 1 (Table_Visualization.get_column_width (sample_table.columns.at 1)).should_equal 1
(Table_Visualisation.get_column_width (sample_table.columns.at 3)).should_equal 2 (Table_Visualization.get_column_width (sample_table.columns.at 3)).should_equal 2
Test.specify "Get row height helper should return correct row height" <| Test.specify "Get row height helper should return correct row height" <|
(Table_Visualisation.get_row_height sample_table 0).should_equal 1 (Table_Visualization.get_row_height sample_table 0).should_equal 1
Test.specify "Get map_to_cumulative_sum helper should return correct result" <| Test.specify "Get map_to_cumulative_sum helper should return correct result" <|
(Table_Visualisation.map_to_cumulative_sum [1,2,3]).should_equal [1,3,6] (Table_Visualization.map_to_cumulative_sum [1,2,3]).should_equal [1,3,6]
(Table_Visualisation.map_to_cumulative_sum [1,1,1,1,1,1]).should_equal [1,2,3,4,5,6] (Table_Visualization.map_to_cumulative_sum [1,1,1,1,1,1]).should_equal [1,2,3,4,5,6]
Test.specify "Get find_first_over_cum_sum helper should return correct result" <| Test.specify "Get find_first_over_cum_sum helper should return correct result" <|
(Table_Visualisation.find_first_over_cum_sum [1,2,3] 2).should_equal 1 (Table_Visualization.find_first_over_cum_sum [1,2,3] 2).should_equal 1
(Table_Visualisation.find_first_over_cum_sum [1,1,1,1,1,1,1,1] 4).should_equal 4 (Table_Visualization.find_first_over_cum_sum [1,1,1,1,1,1,1,1] 4).should_equal 4
Test.specify "Get enumerate helper should return correct result" <| Test.specify "Get enumerate helper should return correct result" <|
(Table_Visualisation.enumerate ["A","B","C"]).should_equal [[0, "A"],[1,"B"],[2,"C"]] (Table_Visualization.enumerate ["A","B","C"]).should_equal [[0, "A"],[1,"B"],[2,"C"]]
Test.specify "get_chunks_for_row helper should return correct result" <| Test.specify "get_chunks_for_row helper should return correct result" <|
(Table_Visualisation.get_chunks_for_row sample_table 0 0 0 (1.up_to 4) 5 3).should_equal [[[1,0], "4"], [[2,0], "7"], [[3,0], "10"]] (Table_Visualization.get_chunks_for_row sample_table 0 0 0 (1.up_to 4) 5 3).should_equal [[[1,0], "4"], [[2,0], "7"], [[3,0], "10"]]
(Table_Visualisation.get_chunks_for_row sample_table 0 0 0 (0.up_to 4) 5 3).should_equal [[[0, 0], "12345"], [[0,1], "6789"], [[1,0], "4"]] (Table_Visualization.get_chunks_for_row sample_table 0 0 0 (0.up_to 4) 5 3).should_equal [[[0, 0], "12345"], [[0,1], "6789"], [[1,0], "4"]]
Test.specify "compute_vertical_indices helper should return correct result" <| Test.specify "compute_vertical_indices helper should return correct result" <|
(Table_Visualisation.compute_vertical_indices sample_table 0 2 0 2).should_equal [[0, 0], [1, 0]] (Table_Visualization.compute_vertical_indices sample_table 0 2 0 2).should_equal [[0, 0], [1, 0]]
(Table_Visualisation.compute_vertical_indices sample_table 0 2 1 2).should_equal [[1, 0], [2, 0]] (Table_Visualization.compute_vertical_indices sample_table 0 2 1 2).should_equal [[1, 0], [2, 0]]

View File

@ -3,5 +3,5 @@
[org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None,EditFileNotification [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None,EditFileNotification
[enso] Executing command: EditFileCmd... [enso] Executing command: EditFileCmd...
[enso] Job EnsureCompiledJob finished [enso] Job EnsureCompiledJob finished
[enso] Visualisation computed [enso] Visualization computed
[org.enso.languageserver.runtime.ContextRegistry] received handled VisualisationUpdate [org.enso.languageserver.runtime.ContextRegistry] received handled VisualizationUpdate

View File

@ -3,5 +3,5 @@
[org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None,SetExpressionValueNotification [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None,SetExpressionValueNotification
[enso] Executing command: SetExpressionValueCmd [enso] Executing command: SetExpressionValueCmd
[enso] Job EnsureCompiledJob finished [enso] Job EnsureCompiledJob finished
[enso] Visualisation computed [enso] Visualization computed
[org.enso.languageserver.runtime.ContextRegistry] received handled VisualisationUpdate [org.enso.languageserver.runtime.ContextRegistry] received handled VisualizationUpdate

View File

@ -57,8 +57,8 @@ avg [min..max] (of 100 records)
1ms [0..2] [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None 1ms [0..2] [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None
0ms [0..1] [enso] Executing command: EditFileCmd... 0ms [0..1] [enso] Executing command: EditFileCmd...
14ms [11..24] [enso] Job EnsureCompiledJob finished in 23 ms. 14ms [11..24] [enso] Job EnsureCompiledJob finished in 23 ms.
1ms [1..9] [enso] Visualisation computed 524dd815-b652-4bbe-b9f2-26b35d17993a. 1ms [1..9] [enso] Visualization computed 524dd815-b652-4bbe-b9f2-26b35d17993a.
0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualisation 0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualization
0ms [0..1] [main] wstest handled response [<binary>] 0ms [0..1] [main] wstest handled response [<binary>]
17ms [15..33] Total 17ms [15..33] Total
``` ```

View File

@ -4,4 +4,4 @@ t|{"jsonrpc":"2.0","id":3,"method":"text/openBuffer","params":{"path":{"rootId":
t|{"jsonrpc":"2.0","id":5,"method":"executionContext/create","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12"}} t|{"jsonrpc":"2.0","id":5,"method":"executionContext/create","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12"}}
t|{ "jsonrpc": "2.0", "method": "text/applyEdit", "id": 7, "params": { "edit": { "path": { "rootId": "6f7d58dd-8ee8-44cf-9ab7-9f0454033641", "segments": [ "src", "V.enso" ] }, "oldVersion": "6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7", "newVersion": "30651038cbc6feac5b3f8e056ef144a133afdfbb5b724ad74106f08f", "edits": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "text": "to_vis x = x.to_text" } ] } } } t|{ "jsonrpc": "2.0", "method": "text/applyEdit", "id": 7, "params": { "edit": { "path": { "rootId": "6f7d58dd-8ee8-44cf-9ab7-9f0454033641", "segments": [ "src", "V.enso" ] }, "oldVersion": "6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7", "newVersion": "30651038cbc6feac5b3f8e056ef144a133afdfbb5b724ad74106f08f", "edits": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "text": "to_vis x = x.to_text" } ] } } }
t|{"jsonrpc":"2.0","id":9,"method":"executionContext/push","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12","stackItem":{"methodPointer":{"definedOnType":"local.Unnamed.Main","module":"local.Unnamed.Main","name":"main"},"positionalArgumentsExpressions":[],"thisArgumentExpression":null,"type":"ExplicitCall"}}} t|{"jsonrpc":"2.0","id":9,"method":"executionContext/push","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12","stackItem":{"methodPointer":{"definedOnType":"local.Unnamed.Main","module":"local.Unnamed.Main","name":"main"},"positionalArgumentsExpressions":[],"thisArgumentExpression":null,"type":"ExplicitCall"}}}
b|{ "jsonrpc": "2.0", "method": "executionContext/attachVisualisation", "id": 13, "params": { "visualisationId": "a1cced79-1e4b-47f6-a85d-73f766325372", "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualisationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": { "module": "local.Unnamed.V", "definedOnType": "local.Unnamed.V", "name": "to_vis" } } } } b|{ "jsonrpc": "2.0", "method": "executionContext/attachVisualization", "id": 13, "params": { "visualizationId": "a1cced79-1e4b-47f6-a85d-73f766325372", "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualizationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": { "module": "local.Unnamed.V", "definedOnType": "local.Unnamed.V", "name": "to_vis" } } } }

View File

@ -63,8 +63,8 @@ avg [min..max] (of 150 records)
1ms [0..2] [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None 1ms [0..2] [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None
0ms [0..2] [enso] Executing command: SetExpressionValueCmd... 0ms [0..2] [enso] Executing command: SetExpressionValueCmd...
5ms [3..16] [enso] Job EnsureCompiledJob finished in 5 ms. 5ms [3..16] [enso] Job EnsureCompiledJob finished in 5 ms.
1ms [0..9] [enso] Visualisation computed 524dd815-b652-4bbe-b9f2-26b35d17993a. 1ms [0..9] [enso] Visualization computed 524dd815-b652-4bbe-b9f2-26b35d17993a.
0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualisation 0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualization
1ms [0..1] [main] wstest handled response [<binary>] 1ms [0..1] [main] wstest handled response [<binary>]
8ms [7..22] Total 8ms [7..22] Total
``` ```

View File

@ -2,4 +2,4 @@ t|{ "jsonrpc": "2.0", "method": "session/initProtocolConnection", "id": 0, "para
t|{"jsonrpc":"2.0","id":1,"method":"text/openFile","params":{"path":{"rootId":"6f7d58dd-8ee8-44cf-9ab7-9f0454033641","segments":["src","Main.enso"]}}} t|{"jsonrpc":"2.0","id":1,"method":"text/openFile","params":{"path":{"rootId":"6f7d58dd-8ee8-44cf-9ab7-9f0454033641","segments":["src","Main.enso"]}}}
t|{"jsonrpc":"2.0","id":3,"method":"executionContext/create","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12"}} t|{"jsonrpc":"2.0","id":3,"method":"executionContext/create","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12"}}
t|{"jsonrpc":"2.0","id":5,"method":"executionContext/push","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12","stackItem":{"methodPointer":{"definedOnType":"local.Unnamed.Main","module":"local.Unnamed.Main","name":"main"},"positionalArgumentsExpressions":[],"thisArgumentExpression":null,"type":"ExplicitCall"}}} t|{"jsonrpc":"2.0","id":5,"method":"executionContext/push","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12","stackItem":{"methodPointer":{"definedOnType":"local.Unnamed.Main","module":"local.Unnamed.Main","name":"main"},"positionalArgumentsExpressions":[],"thisArgumentExpression":null,"type":"ExplicitCall"}}}
b|{"jsonrpc": "2.0", "id": 7, "method": "executionContext/attachVisualisation", "params": { "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualisationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": "x -> x.to_text", "visualisationModule": "local.Unnamed.Main" }, "visualisationId": "a1cced79-1e4b-47f6-a85d-73f766325372" } } b|{"jsonrpc": "2.0", "id": 7, "method": "executionContext/attachVisualization", "params": { "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualizationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": "x -> x.to_text", "visualizationModule": "local.Unnamed.Main" }, "visualizationId": "a1cced79-1e4b-47f6-a85d-73f766325372" } }