Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Engine updates after adding node: send import first, then the new node (
Browse files Browse the repository at this point in the history
#1332)

When the user creates a node through the searcher that needs additional imports, those imports should be added before or simultaneously to the node content to avoid an invalid intermediate state. This was done in the wrong order before this commit.
  • Loading branch information
s9ferech authored Mar 23, 2021
1 parent a59a3b5 commit da6d66f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
- [Disable area selection][1318]. The area selection was visible despite being
non-functional. To avoid confusion, area selection has been disabled until it
is [correctly implemented][479].
- [Fix error after adding a node][1332]. Sometimes, after picking a suggestion
the inserted node was annotated with "The name could not be found" error.
- [Handle syntax errors in custom-defined visualizations][1341]. The IDE is now
able to run properly, even if some of the custom-defined visualisations inside
a project contain syntax errors.
Expand Down Expand Up @@ -69,6 +71,8 @@ you can find their release notes
[1064]: https://github.com/enso-org/ide/pull/1064
[1316]: https://github.com/enso-org/ide/pull/1316
[1318]: https://github.com/enso-org/ide/pull/1318
[1332]: https://github.com/enso-org/ide/pull/1332
[1341]: https://github.com/enso-org/ide/pull/1341
[1328]: https://github.com/enso-org/ide/pull/1328
[1341]: https://github.com/enso-org/ide/pull/1341
[1348]: https://github.com/enso-org/ide/pull/1348
Expand Down
4 changes: 3 additions & 1 deletion src/rust/ide/src/controller/searcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ impl Searcher {
};
let intended_method = self.intended_method();

// We add the required imports before we create the node/edit its content. This way, we
// avoid an intermediate state where imports would already be in use but not yet available.
self.add_required_imports()?;
let id = match *self.mode {
Mode::NewNode {position} => {
let mut new_node = NewNodeInfo::new_pushed_back(expression);
Expand All @@ -676,7 +679,6 @@ impl Searcher {
node_id
}
};
self.add_required_imports()?;
Ok(id)
}

Expand Down

0 comments on commit da6d66f

Please sign in to comment.