Skip to content

Commit

Permalink
Merge branch 'develop' into wip/procrat/json-viz-last-row-6196
Browse files Browse the repository at this point in the history
* develop: (34 commits)
  Continued Execution Context work and some little fixes (#6506)
  IDE's logging to a file (#6478)
  Fix application config (#6513)
  Cloud/desktop mode switcher (#6448)
  Fix doubled named arguments bug (#6422)
  Reimplement `enso_project` as a proper builtin (#6352)
  Fix layer ordering between dropdown and breadcrumbs backgrounds.  (#6483)
  Multiflavor layers (#6477)
  DataflowAnalysis preserves dependencies order (#6493)
  Implement `create_database_table` for Database Table (#6467)
  Limit Dead Letter logging (#6482)
  More reliable shutdown of the EnsoContext to save resources (#6468)
  Make execution mode `live` default for CLI (#6496)
  Finishing Vector Editor (#6470)
  Proper handling of multiple list views. (#6461)
  Fix disappearing cached shapes (#6458)
  Add Execution Context control to Text.write (#6459)
  Change defaults for `Connection.tables` and ensure that `Connection.query` recognizes all available tables (#6443)
  Introducing @BuiltinMethod.needsFrame and InlineableNode (#6442)
  Hide profile button behind a feature flag (#6430)
  ...
  • Loading branch information
Procrat committed May 3, 2023
2 parents 9452501 + bb8f910 commit b63966e
Show file tree
Hide file tree
Showing 325 changed files with 7,731 additions and 3,580 deletions.
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Cargo.toml
/lib/rust/ensogl/ @MichaelMauderer @wdanilo @farmaazon @kazcw
/lib/rust/parser/ @kazcw @wdanilo @jaroslavtulach
/integration-test/ @MichaelMauderer @wdanilo @farmaazon @kazcw
/tools/build-performance/ @kazcw @mwu-tow @wdanilo
/tools/build-performance/ @kazcw @mwu-tow @wdanilo @Akirathan

# Scala Libraries
/lib/scala/ @4e6 @jaroslavtulach @hubertp
Expand All @@ -28,9 +28,9 @@ Cargo.toml

# Engine (old)
# This section should be removed once the engine moves to /app/engine
/build.sbt @4e6 @jaroslavtulach @hubertp
/build.sbt @4e6 @jaroslavtulach @hubertp @Akirathan
/distribution/ @4e6 @jdunkerley @radeusgd @GregoryTravis
/engine/ @4e6 @jaroslavtulach @hubertp
/engine/ @4e6 @jaroslavtulach @hubertp @Akirathan
/project/ @4e6 @jaroslavtulach @hubertp
/test/ @jdunkerley @radeusgd @GregoryTravis
/tools/ @4e6 @jaroslavtulach @radeusgd
Expand Down
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@
- [Added capability to create node widgets with complex UI][6347]. Node widgets
such as dropdown can now be placed in the node and affect the code text flow.
- [The IDE UI element for selecting the execution mode of the project is now
sending messages to the backend.][6341].
sending messages to the backend][6341].
- [List Editor Widget][6470]. Now you can edit lists by clicking buttons on
nodes or by dragging the elements.
- [Fixed text visualisations which were being cut off at the last line.][6421]

[6421]: https://github.com/enso-org/enso/pull/6421
Expand Down Expand Up @@ -201,7 +203,8 @@
[5895]: https://github.com/enso-org/enso/pull/6130
[6035]: https://github.com/enso-org/enso/pull/6035
[6097]: https://github.com/enso-org/enso/pull/6097
[6097]: https://github.com/enso-org/enso/pull/6341
[6341]: https://github.com/enso-org/enso/pull/6341
[6470]: https://github.com/enso-org/enso/pull/6470

#### Enso Standard Library

Expand Down Expand Up @@ -399,6 +402,12 @@
- [Added `Table.parse_to_columns`.][6383]
- [Added parsing methods for `Integer`, `Decimal`, `Json`, `Date`, `Date_Time`,
`Time_Of_Day`, `Time_Zone`, and `URI` to `Text`.][6404]
- [Implemented `create_database_table` allowing upload of in-memory
tables.][6429]
- [Added execution context control to writing files and dry run capabilities to
`Text.write`.][6459]
- [Implemented `create_database_table` allowing saving queries as database
tables.][6467]

[debug-shortcuts]:
https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug
Expand Down Expand Up @@ -602,6 +611,9 @@
[6383]: https://github.com/enso-org/enso/pull/6383
[6404]: https://github.com/enso-org/enso/pull/6404
[6347]: https://github.com/enso-org/enso/pull/6347
[6429]: https://github.com/enso-org/enso/pull/6429
[6459]: https://github.com/enso-org/enso/pull/6459
[6467]: https://github.com/enso-org/enso/pull/6467

#### Enso Compiler

Expand Down Expand Up @@ -691,7 +703,7 @@
- [Optimize Atom storage layouts][3862]
- [Make instance methods callable like statics for builtin types][4077]
- [Convert large longs to doubles, safely, for host calls][4099]
- [Consistent ordering with comparators](4067)
- [Consistent ordering with comparators][4067]
- [Profile engine startup][4110]
- [Report type of polyglot values][4111]
- [Engine can now recover from serialization failures][5591]
Expand All @@ -709,6 +721,8 @@
- [Vector.sort handles incomparable types][5998]
- [Removing need for asynchronous thread to execute ResourceManager
finalizers][6335]
- [Warning.get_all returns only unique warnings][6372]
- [Reimplement `enso_project` as a proper builtin][6352]

[3227]: https://github.com/enso-org/enso/pull/3227
[3248]: https://github.com/enso-org/enso/pull/3248
Expand Down Expand Up @@ -797,9 +811,9 @@
[4048]: https://github.com/enso-org/enso/pull/4048
[4049]: https://github.com/enso-org/enso/pull/4049
[4056]: https://github.com/enso-org/enso/pull/4056
[4067]: https://github.com/enso-org/enso/pull/4067
[4077]: https://github.com/enso-org/enso/pull/4077
[4099]: https://github.com/enso-org/enso/pull/4099
[4067]: https://github.com/enso-org/enso/pull/4067
[4110]: https://github.com/enso-org/enso/pull/4110
[4111]: https://github.com/enso-org/enso/pull/4111
[5591]: https://github.com/enso-org/enso/pull/5591
Expand All @@ -811,11 +825,13 @@
[5791]: https://github.com/enso-org/enso/pull/5791
[5900]: https://github.com/enso-org/enso/pull/5900
[5966]: https://github.com/enso-org/enso/pull/5966
[5998]: https://github.com/enso-org/enso/pull/5998
[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
[6335]: https://github.com/enso-org/enso/pull/6335
[6372]: https://github.com/enso-org/enso/pull/6372
[6352]: https://github.com/enso-org/enso/pull/6352

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

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions app/gui/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ windowAppScopeConfigName: "config"
# utilities and allowing for runtime theme modification.
windowAppScopeThemeName: "theme"

# The URL to the JSON-RPC endpoint to the Project Manager.
# This MUST be kept in sync with the corresponding value in `app/gui/src/constants.rs`.
projectManagerEndpoint: "ws://127.0.0.1:30535"

# TODO [ao] add description here.
minimumSupportedVersion": "2.0.0-alpha.6"

Expand Down
2 changes: 1 addition & 1 deletion app/gui/controller/engine-protocol/src/language_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ trait API {

/// Restart the program execution.
#[MethodInput=RecomputeInput, rpc_name="executionContext/recompute"]
fn recompute(&self, context_id: ContextId, invalidated_expressions: InvalidatedExpressions, mode: Option<ExecutionEnvironment>) -> ();
fn recompute(&self, context_id: ContextId, invalidated_expressions: InvalidatedExpressions, execution_environment: Option<ExecutionEnvironment>) -> ();

/// Obtain the full suggestions database.
#[MethodInput=GetSuggestionsDatabaseInput, rpc_name="search/getSuggestionsDatabase"]
Expand Down
34 changes: 10 additions & 24 deletions app/gui/controller/engine-protocol/src/language_server/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ pub struct LibraryComponentGroup {
///
/// For more information, see
/// https://github.com/enso-org/design/blob/main/epics/basic-libraries/write-action-control/design.md.
#[derive(Hash, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display)]
#[derive(Hash, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum ExecutionEnvironment {
/// Allows editing the graph, but the `Output` context is disabled, so it prevents accidental
/// changes.
Expand All @@ -1173,6 +1173,15 @@ pub enum ExecutionEnvironment {
Live,
}

impl Display for ExecutionEnvironment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Design => write!(f, "design"),
Self::Live => write!(f, "live"),
}
}
}

impl Default for ExecutionEnvironment {
fn default() -> Self {
ExecutionEnvironment::Design
Expand All @@ -1184,29 +1193,6 @@ impl ExecutionEnvironment {
pub fn list_all() -> Vec<Self> {
vec![ExecutionEnvironment::Design, ExecutionEnvironment::Live]
}

/// List all available execution environments as ImStrings. Useful for UI.
pub fn list_all_as_imstrings() -> Vec<ImString> {
Self::list_all().iter().map(|env| (*env).into()).collect()
}
}

impl From<ExecutionEnvironment> for ImString {
fn from(env: ExecutionEnvironment) -> Self {
ImString::new(env.to_string())
}
}

impl TryFrom<&str> for ExecutionEnvironment {
type Error = ();

fn try_from(value: &str) -> core::result::Result<Self, Self::Error> {
match value.to_lowercase().as_str() {
"design" => Ok(ExecutionEnvironment::Design),
"live" => Ok(ExecutionEnvironment::Live),
_ => Err(()),
}
}
}

impl ExecutionEnvironment {
Expand Down
3 changes: 2 additions & 1 deletion app/gui/docs/product/shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ broken and require further investigation.
| <kbd>escape</kbd> | Cancel current action. For example, drop currently dragged connection. |
| <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>t</kbd> | Terminate the program execution |
| <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>r</kbd> | Re-execute the program |
| <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>e</kbd> | Toggle the execution environment between Live and Design. |
| <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>k</kbd> | Switch the execution environment to Design. |
| <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>l</kbd> | Switch the execution environment to Live. |

#### Navigation

Expand Down
8 changes: 8 additions & 0 deletions app/gui/language/ast/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,14 @@ impl<T> SpanSeed<T> {
pub fn child(node: T) -> Self {
Self::Child(SpanSeedChild { node })
}

pub fn token(token: String) -> Self {
Self::Token(SpanSeedToken { token })
}

pub fn is_child(&self) -> bool {
matches!(self, SpanSeed::Child { .. })
}
}


Expand Down
115 changes: 101 additions & 14 deletions app/gui/language/span-tree/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::SpanTree;
use ast::opr::match_named_argument;
use ast::opr::ArgWithOffset;
use ast::Ast;
use ast::SpanSeed;



Expand Down Expand Up @@ -142,6 +143,33 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
),
};
Ok(infix.into_ast())
} else if let ast::Shape::Tree(tree) = ast.shape() {
let mut tree = tree.clone();
let span_info = &mut tree.span_info;
let has_children =
span_info.iter().any(|span| matches!(span, ast::SpanSeed::Child(_)));
match *kind {
BeforeArgument(index) => {
span_info.insert(index, ast::SpanSeed::child(new));
span_info.insert(index + 1, ast::SpanSeed::token(",".to_owned()));
span_info.insert(index + 2, ast::SpanSeed::space(1).unwrap());
}
Append => {
let last_token_index = span_info
.iter()
.rposition(|span| matches!(span, ast::SpanSeed::Token(_)));
let index = last_token_index.unwrap_or(0);
if has_children {
span_info.insert(index, ast::SpanSeed::token(",".to_owned()));
span_info.insert(index + 1, ast::SpanSeed::space(1).unwrap());
span_info.insert(index + 2, ast::SpanSeed::child(new));
} else {
span_info.insert(index, ast::SpanSeed::child(new));
}
}
_ => unreachable!("Wrong insertion point in tree."),
}
Ok(ast.with_shape(tree))
} else {
let mut prefix = ast::prefix::Chain::from_ast_non_strict(&ast);
let item = ast::prefix::Argument::new(new, DEFAULT_OFFSET, None);
Expand Down Expand Up @@ -236,7 +264,6 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
}
}


fn erase_impl<C: Context>(&self) -> Option<EraseOperation<C>> {
if self.node.kind.removable() {
Some(Box::new(move |root, context| {
Expand All @@ -245,6 +272,11 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
let mut ast = root.get_traversing(parent_crumbs)?;
let is_named_argument = match_named_argument(ast).is_some();

// When an element is removed, we have to find an adequate span tree node that
// could become a new temporary target of dragged edge. It should be a node that
// has an reverse set operation to the erase we are performing now.
let mut reinsert_crumbs = None;

if is_named_argument {
// When erasing named argument, we need to remove the whole argument, not only
// the value part. The named argument AST is always a single infix expression,
Expand All @@ -266,6 +298,28 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
infix.args.pop();
}
Ok(infix.into_ast())
} else if let (Crumb::Tree(crumb), ast::Shape::Tree(tree)) =
(last_crumb, ast.shape())
{
let index = crumb.index;
let mut tree = tree.clone();
let span_info: &mut Vec<_> = &mut tree.span_info;
let after = &span_info[index + 1..];
let before = &span_info[..index];
let is_child = |span: &SpanSeed<Ast>| span.is_child();
let child_after_offset = after.iter().position(is_child);
let child_before_offset = before.iter().rposition(is_child);
let (insertion_point_offset, removed_range) =
match (child_after_offset, child_before_offset) {
(Some(after), _) => (-1, index..=index + after),
(None, Some(before)) => (-2, before + 1..=index),
(None, None) => (-1, index..=index),
};

reinsert_crumbs =
Some(self.crumbs.relative_sibling(insertion_point_offset));
span_info.drain(removed_range);
Ok(ast.with_shape(tree))
} else {
let mut prefix = ast::prefix::Chain::from_ast_non_strict(&ast);
prefix.args.pop();
Expand All @@ -275,7 +329,7 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
let mut new_root = root.set_traversing(parent_crumbs, new_ast?)?;


// when erasing a positional or named argument, all further positional arguments
// When erasing a positional or named argument, all further positional arguments
// past its definition order will end up in wrong position. To fix that, we need to
// rewrite them as named arguments.
if let Some(erased_definition_index) = self.kind.definition_index() {
Expand All @@ -286,8 +340,39 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
})
.map(|found| found.node);

// To better understand the code, it's important to know the structure of
// the [`SpanTree`] for prefix chains:
//
// Root
// ├─Chained
// │ ├─Chained
// │ │ ├─Chained
// │ │ │ └─ Argument1
// │ │ └─ Argument2
// │ └─ Argument3
// └─ Argument4
//
// Note that the order of arguments is reversed.
//
// Usually, all modifications of the AST must also modify the SpanTree of the
// expression. In this case, however, we are iterating over the old SpanTree
// while modifying the AST, and we don't update the SpanTree in the process. The
// assumption here is that as we go, we only change the SpanTree deeper than we
// will look at in future iterations. That way, we can be sure that the
// SpanTree's "outer layers" still correspond to the original. It is done that
// way because we cannot dynamically adjust the span tree to be entirely correct
// on every step.
//
// This loop traverses the tree bottom to top, starting at one of the arguments,
// and continues until all arguments are covered. It operates as follows:
// 1. Retrieve the argument from the current level of the [`SpanTree`].
// 2. Rewrite the argument as necessary.
// 3. Update `next_parent` to be the parent of the current node. We use
// [`Ref::ast_parent`] instead of [`Ref::parent`] because a single AST node
// can contain multiple span tree levels, and iterating over all of them
// would cause multiple rewrites of the same argument.
while let Some(node) = next_parent {
next_parent = node.parent()?;
next_parent = node.ast_parent()?;
let argument_node = node
.get_descendant_by_ast_crumbs(&[Crumb::Prefix(PrefixCrumb::Arg)])
.filter(|found| found.ast_crumbs.is_empty());
Expand Down Expand Up @@ -327,17 +412,19 @@ impl<'a, T> Implementation for node::Ref<'a, T> {
// placeholder. The position of placeholder is not guaranteed to be in the same
// place as the removed argument, as it might have been out of order. To find
// the correct placeholder position, we need to search regenerated span-tree.
let reinsert_crumbs = self.kind.definition_index().and_then(|_| {
let call_id = self.kind.call_id();
let name = self.kind.argument_name();

let found = new_span_tree.root_ref().find_node(|node| {
node.kind.is_insertion_point()
&& node.kind.call_id() == call_id
&& node.kind.argument_name() == name
});

found.map(|found| found.crumbs)
let reinsert_crumbs = reinsert_crumbs.or_else(|| {
self.kind.definition_index().and_then(|_| {
let call_id = self.kind.call_id();
let name = self.kind.argument_name();

let found = new_span_tree.root_ref().find_node(|node| {
node.kind.is_insertion_point()
&& node.kind.call_id() == call_id
&& node.kind.argument_name() == name
});

found.map(|found| found.crumbs)
})
});

// For non-resolved arguments, use the preceding insertion point. After the
Expand Down
Loading

0 comments on commit b63966e

Please sign in to comment.