Skip to content

Commit

Permalink
Merge branch 'develop' into wip/MichaelMauderer/Execution_Context_Dro…
Browse files Browse the repository at this point in the history
…pdown_Menu
  • Loading branch information
MichaelMauderer committed Apr 16, 2023
2 parents 9d38b2b + b42e910 commit 2781f0a
Show file tree
Hide file tree
Showing 232 changed files with 9,359 additions and 2,656 deletions.
12 changes: 12 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ Cargo.toml
# This section should be amended once the engine moves to /app/engine
/distribution/lib/ @jdunkerley @radeusgd
/std-bits/ @jdunkerley @radeusgd

# Cloud Dashboard & Authentication
/app/ide-desktop/dashboard @PabloBuchu @indiv0 @somebody1234
/app/ide-desktop/content @PabloBuchu @indiv0 @somebody1234
/app/ide-desktop/client @PabloBuchu @indiv0 @somebody1234
/app/ide-desktop/types @PabloBuchu @indiv0 @somebody1234
/app/ide-desktop/common @PabloBuchu @indiv0 @somebody1234

# Eslint configuration
/app/ide-desktop/esbuild-plugin-copy-directories @somebody1234
/app/ide-desktop/eslint.config.js @somebody1234
/app/ide-desktop/utils.ts @somebody1234
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,11 @@
- [Added support for Date/Time columns in the Postgres backend and added
`year`/`month`/`day` operations to Table columns.][6153]
- [`Text.split` can now take a vector of delimiters.][6156]
- [Add `has_warnings`, `remove_warnings` and `throw_on_warning` extension
methods.][6176]
- [Implemented `Table.union` for the Database backend.][6204]
- [Array & Vector have the same methods & behavior][6218]
- [Implemented `Table.split` and `Table.tokenize` for in-memory tables.][6233]

[debug-shortcuts]:
https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug
Expand Down Expand Up @@ -574,8 +578,11 @@
[6150]: https://github.com/enso-org/enso/pull/6150
[6153]: https://github.com/enso-org/enso/pull/6153
[6156]: https://github.com/enso-org/enso/pull/6156
[6176]: https://github.com/enso-org/enso/pull/6176
[6204]: https://github.com/enso-org/enso/pull/6204
[6077]: https://github.com/enso-org/enso/pull/6077
[6218]: https://github.com/enso-org/enso/pull/6218
[6233]: https://github.com/enso-org/enso/pull/6233

#### Enso Compiler

Expand Down Expand Up @@ -680,6 +687,7 @@
- [Ensure calls involving warnings remain instrumented][6067]
- [One can define lazy atom fields][6151]
- [Replace IOContexts with Execution Environment and generic Context][6171]
- [Vector.sort handles incomparable types][5998]

[3227]: https://github.com/enso-org/enso/pull/3227
[3248]: https://github.com/enso-org/enso/pull/3248
Expand Down Expand Up @@ -785,6 +793,7 @@
[6067]: https://github.com/enso-org/enso/pull/6067
[6151]: https://github.com/enso-org/enso/pull/6151
[6171]: https://github.com/enso-org/enso/pull/6171
[5998]: https://github.com/enso-org/enso/pull/5998

# Enso 2.0.0-alpha.18 (2021-10-12)

Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,8 @@ always trust the results you get.

If you want to start _using_ Enso, please see the download links in the
[getting started](#getting-started) section above. Alternatively, you can get
the IDE [here](https://github.com/enso-org/ide/releases) and the language itself
[here](https://github.com/enso-org/enso/releases). This section is intended for
people interested in contributing to the development of Enso.
the IDE [here](https://github.com/enso-org/enso/releases). This section is
intended for people interested in contributing to the development of Enso.

Enso is a community-driven open source project which is, and will always be,
open and free to use. Join us, help us to build it, and spread the word!
Expand Down
95 changes: 48 additions & 47 deletions app/gui/src/presenter/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use ide_view as view;
use ide_view::graph_editor::component::node as node_view;
use ide_view::graph_editor::component::visualization as visualization_view;
use ide_view::graph_editor::EdgeEndpoint;
use view::graph_editor::ExecutionEnvironment;
use view::graph_editor::WidgetUpdates;


Expand Down Expand Up @@ -82,13 +83,15 @@ pub fn default_node_position() -> Vector2 {

#[derive(Debug)]
struct Model {
project: model::Project,
controller: controller::ExecutedGraph,
view: view::graph_editor::GraphEditor,
state: Rc<State>,
_visualization: Visualization,
widget: controller::Widget,
_execution_stack: CallStack,
project: model::Project,
controller: controller::ExecutedGraph,
view: view::graph_editor::GraphEditor,
state: Rc<State>,
_visualization: Visualization,
widget: controller::Widget,
_execution_stack: CallStack,
// TODO(#5930): Move me once we synchronise the execution environment with the language server.
execution_environment: Rc<Cell<ExecutionEnvironment>>,
}

impl Model {
Expand All @@ -115,6 +118,7 @@ impl Model {
_visualization: visualization,
widget,
_execution_stack: execution_stack,
execution_environment: Default::default(),
}
}

Expand Down Expand Up @@ -166,16 +170,6 @@ impl Model {
);
}

/// TODO(#5930): Provide the state of the output context in the current environment.
fn output_context_enabled(&self) -> bool {
true
}

/// TODO(#5930): Provide the current execution environment of the project.
fn execution_environment(&self) -> &str {
"design"
}

/// Sets or clears a context switch expression for the specified node.
///
/// A context switch expression allows enabling or disabling the execution of a particular node
Expand All @@ -185,22 +179,21 @@ impl Model {
///
/// The behavior of this function can be summarized in the following table:
/// ```ignore
/// | Context Enabled | Active | Action |
/// |-----------------|-------------|--------------|
/// | Yes | Yes | Add Disable |
/// | Yes | No | Clear |
/// | No | Yes | Add Enable |
/// | No | No | Clear |
/// | Global Context Permission | Active | Action |
/// |---------------------------|-------------|--------------|
/// | Enabled | Yes | Add Disable |
/// | Enabled | No | Clear |
/// | Disabled | Yes | Add Enable |
/// | Disabled | No | Clear |
/// ```
/// TODO(#5929): Connect this function with buttons on nodes.
#[allow(dead_code)]
fn node_action_context_switch(&self, id: ViewNodeId, active: bool) {
let context = Context::Output;
let current_state = self.output_context_enabled();
let environment = self.execution_environment().into();
let environment = self.execution_environment.get();
let current_state = environment.output_context_enabled();
let switch = if current_state { ContextSwitch::Disable } else { ContextSwitch::Enable };
let expr = if active {
Some(ContextSwitchExpression { switch, context, environment })
let environment_name = environment.to_string().into();
Some(ContextSwitchExpression { switch, context, environment: environment_name })
} else {
None
};
Expand Down Expand Up @@ -500,6 +493,15 @@ impl Model {
}
}
}

fn toggle_execution_environment(&self) -> ExecutionEnvironment {
let new_environment = match self.execution_environment.get() {
ExecutionEnvironment::Live => ExecutionEnvironment::Design,
ExecutionEnvironment::Design => ExecutionEnvironment::Live,
};
self.execution_environment.set(new_environment);
new_environment
}
}


Expand Down Expand Up @@ -538,18 +540,14 @@ impl ExpressionUpdate {
self.freeze_updated.map(|freeze| (self.id, freeze))
}

/// An updated status of output context switch (`true` if output context is explicitly enabled
/// for the node, `false` otherwise). `None` if the status was not updated.
fn output_context(&self) -> Option<(ViewNodeId, bool)> {
/// An updated status of output context switch: `true` (or `false`) if the output context was
/// explicitly enabled (or disabled) for the node, `None` otherwise. The outer `Option` is
/// `None` if the status was not updated.
fn output_context(&self) -> Option<(ViewNodeId, Option<bool>)> {
self.context_switch_updated.as_ref().map(|context_switch_expr| {
use Context::*;
use ContextSwitch::*;
let enabled = match context_switch_expr {
Some(ContextSwitchExpression { switch: Enable, context: Output, .. }) => true,
Some(ContextSwitchExpression { switch: Disable, context: Output, .. }) => false,
None => false,
};
(self.id, enabled)
let switch =
context_switch_expr.as_ref().map(|expr| expr.switch == ContextSwitch::Enable);
(self.id, switch)
})
}
}
Expand Down Expand Up @@ -720,19 +718,22 @@ impl Graph {
}));


// === Execution Environment ===

// TODO(#5930): Delete me once we synchronise the execution environment with the
// language server.
view.set_execution_environment <+ view.toggle_execution_environment.map(
f_!(model.toggle_execution_environment()));


// === Refreshing Nodes ===

remove_node <= update_data.map(|update| update.remove_nodes());
expression_update <= update_data.map(|update| update.set_node_expressions());
update_node_expression <- expression_update.map(ExpressionUpdate::expression);
set_node_skip <- expression_update.filter_map(ExpressionUpdate::skip);
set_node_freeze <- expression_update.filter_map(ExpressionUpdate::freeze);
// TODO(#5930): Use project model to retrieve a current state of the output context.
output_context_enabled <- update_view.constant(true);
output_context_updated <- expression_update.filter_map(ExpressionUpdate::output_context);
_context_switch_highlighted <- output_context_updated.map2(&output_context_enabled,
|(node_id, enabled_for_node), enabled_globally| (*node_id, enabled_for_node != enabled_globally)
);
set_node_context_switch <- expression_update.filter_map(ExpressionUpdate::output_context);
set_node_position <= update_data.map(|update| update.set_node_positions());
set_node_visualization <= update_data.map(|update| update.set_node_visualizations());
enable_vis <- set_node_visualization.filter_map(|(id,path)| path.is_some().as_some(*id));
Expand All @@ -741,8 +742,7 @@ impl Graph {
view.set_node_expression <+ update_node_expression;
view.set_node_skip <+ set_node_skip;
view.set_node_freeze <+ set_node_freeze;
// TODO (#5929): Connect to the view when the API is ready.
// view.highlight_output_context_switch <+ context_switch_highlighted;
view.set_node_context_switch <+ set_node_context_switch;
view.set_node_position <+ set_node_position;
view.set_visualization <+ set_node_visualization;
view.enable_visualization <+ enable_vis;
Expand Down Expand Up @@ -789,6 +789,7 @@ impl Graph {
eval view.nodes_collapsed(((nodes, _)) model.nodes_collapsed(nodes));
eval view.enabled_visualization_path(((node_id, path)) model.node_visualization_changed(*node_id, path.clone()));
eval view.node_expression_span_set(((node_id, crumbs, expression)) model.node_expression_span_set(*node_id, crumbs, expression.clone_ref()));
eval view.node_action_context_switch(((node_id, active)) model.node_action_context_switch(*node_id, *active));
eval view.node_action_skip(((node_id, enabled)) model.node_action_skip(*node_id, *enabled));
eval view.node_action_freeze(((node_id, enabled)) model.node_action_freeze(*node_id, *enabled));
eval view.request_import((import_path) model.add_import_if_missing(import_path));
Expand Down
12 changes: 6 additions & 6 deletions app/gui/view/examples/icons/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ pub fn entry_point_icons() {
skip_icon.color_rgba.set(dark_green.into());
place_icon(&world, skip_icon, 20.0, y);

let disable_reevaluation_icon = action_bar::icon::disable_reevaluation::View::new();
disable_reevaluation_icon.color_rgba.set(dark_green.into());
place_icon(&world, disable_reevaluation_icon, 40.0, y);
let disable_output_context_icon = action_bar::icon::disable_output_context::View::new();
disable_output_context_icon.color_rgba.set(dark_green.into());
place_icon(&world, disable_output_context_icon, 40.0, y);

let enable_reevaluation_icon = action_bar::icon::enable_reevaluation::View::new();
enable_reevaluation_icon.color_rgba.set(dark_green.into());
place_icon(&world, enable_reevaluation_icon, 60.0, y);
let enable_output_context_icon = action_bar::icon::enable_output_context::View::new();
enable_output_context_icon.color_rgba.set(dark_green.into());
place_icon(&world, enable_output_context_icon, 60.0, y);
}

/// Create a grid with pixel squares to help development of icons.
Expand Down
11 changes: 10 additions & 1 deletion app/gui/view/graph-editor/src/component/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::component::visualization;
use crate::selection::BoundingBox;
use crate::tooltip;
use crate::view;
use crate::ExecutionEnvironment;
use crate::Type;
use crate::WidgetUpdates;

Expand Down Expand Up @@ -306,6 +307,9 @@ ensogl::define_endpoints_2! {
edit_expression (text::Range<text::Byte>, ImString),
set_skip_macro (bool),
set_freeze_macro (bool),
/// Set whether the output context is explicitly enabled: `Some(true/false)` for
/// enabled/disabled; `None` for no context switch expression.
set_context_switch (Option<bool>),
set_comment (Comment),
set_error (Option<Error>),
/// Set the expression USAGE type. This is not the definition type, which can be set with
Expand All @@ -326,7 +330,8 @@ ensogl::define_endpoints_2! {
set_profiling_max_global_duration (f32),
set_profiling_status (profiling::Status),
/// Indicate whether on hover the quick action icons should appear.
show_quick_action_bar_on_hover (bool)
show_quick_action_bar_on_hover (bool),
set_execution_environment (ExecutionEnvironment),
}
Output {
/// Press event. Emitted when user clicks on non-active part of the node, like its
Expand All @@ -342,6 +347,7 @@ ensogl::define_endpoints_2! {
/// and update the node with new expression tree using `set_expression`.
on_expression_modified (span_tree::Crumbs, ImString),
comment (Comment),
context_switch (bool),
skip (bool),
freeze (bool),
hover (bool),
Expand Down Expand Up @@ -801,13 +807,16 @@ impl Node {
// === Action Bar ===

let visualization_button_state = action_bar.action_visibility.clone_ref();
out.context_switch <+ action_bar.action_context_switch;
out.skip <+ action_bar.action_skip;
out.freeze <+ action_bar.action_freeze;
show_action_bar <- out.hover && input.show_quick_action_bar_on_hover;
eval show_action_bar ((t) action_bar.set_visibility(t));
eval input.show_quick_action_bar_on_hover((value) action_bar.show_on_hover(value));
action_bar.set_action_freeze_state <+ input.set_freeze_macro;
action_bar.set_action_skip_state <+ input.set_skip_macro;
action_bar.set_action_context_switch_state <+ input.set_context_switch;
action_bar.set_execution_environment <+ input.set_execution_environment;


// === View Mode ===
Expand Down
Loading

0 comments on commit 2781f0a

Please sign in to comment.