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

Create new project action in searcher. #1566

Merged
merged 25 commits into from
May 21, 2021
Merged

Conversation

farmaazon
Copy link
Collaborator

@farmaazon farmaazon commented May 12, 2021

Pull Request Description

This PR implements a new action in searcher for creating new project; the project will be opened. It has a lot of refactoring of our controllers to support closing and opening new projects

Checklist

Please include the following checklist in your PR:

  • The CHANGELOG.md was updated with the changes introduced in this PR.
  • The documentation has been updated if necessary.
  • All code conforms to the Rust style guide.
  • All code has automatic tests where possible.
  • All code has been profiled where possible.
  • All code has been manually tested in the IDE.
  • All code has been manually tested in the "debug/interface" scene.
  • All code has been manually tested by the PR owner against our test scenarios.
  • All code has been manually tested by at least one reviewer against our test scenarios.

@farmaazon farmaazon requested a review from mwu-tow May 12, 2021 16:03
@farmaazon farmaazon marked this pull request as ready for review May 13, 2021 14:07
@farmaazon farmaazon requested a review from wdanilo as a code owner May 13, 2021 14:07
@farmaazon farmaazon self-assigned this May 13, 2021
@farmaazon farmaazon added Category: Controllers The Application layer not bound to visual part Difficulty: Core Contributor Should only be attempted by a core contributor Priority: High Should be scheduled as soon as possible Type: Enhancement An enhancement to the current state of Enso IDE labels May 13, 2021
@farmaazon farmaazon force-pushed the wip/ao/create-new-project2 branch from 3463a1e to 99f32f1 Compare May 13, 2021 14:26
// === Status Notifications ===
// ============================

pub type ProcessHandle = usize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the name Process here, initially I thought about different kind of process.
Perhaps something more along lines of "Job", "Task", "BackgroundAction", etc?

impl StatusNotifications {
pub fn new() -> Self { default() }

pub fn publish_event(&self, label:impl Into<String>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd bikeshed a few more names here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont understand this comment

// TODO[ao]: we should think how to handle engine's versions in cloud.
// https://github.com/enso-org/ide/issues/1195
let version = semver::Version::parse(controller::project::ENGINE_VERSION_FOR_NEW_PROJECTS)?;
let project_id = default();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that project_id should ever be default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add TODO and issue.

src/rust/ide/src/controller/ide/desktop.rs Show resolved Hide resolved
src/rust/ide/src/controller/project.rs Outdated Show resolved Hide resolved
@@ -41,6 +43,7 @@ impl Action {
completion.name.clone()
}
Self::Example(example) => format!("Example: {}", example.name),
Self::CreateNewProject => "Create New Project".to_owned(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Self::CreateNewProject => "Create New Project".to_owned(),
Self::CreateNewProject => "Create a New Project".to_owned(),

but then it looks like PoKeMoN script.
Perhaps just New Project?

@@ -17,7 +17,8 @@ use enso_protocol::language_server::MethodPointer;
use enso_protocol::project_manager;
use flo_stream::Subscriber;
use parser::Parser;

use crate::transport::web::WebSocket;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unordered use decls

#[derive(Debug,Clone)]
pub struct Data {
pub struct Properties {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps its Flowbox legacy, but seeing properties used caused me think that this is something totally different.

// Automock macro does not work without explicit lifetimes here.
#[allow(clippy::needless_lifetimes)]
fn manage_projects<'a>(&'a self) -> Option<&'a dyn ManagingProjectAPI>;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps IDE should also provide parser?

Comment on lines 116 to 117
/// The model of currently opened project.
fn current_project(&self) -> model::Project;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we still assume that IDE has exactly one project opened. I wonder if this should be documented in the trait.

CHANGELOG.md Outdated
@@ -42,13 +70,24 @@ you can find their release notes
#### Visual Environment

- [Window management buttons.][1511]. The IDE now has components for
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thisi s a commited file with git conflicts!

impl StatusNotifications {
pub fn new() -> Self { default() }

pub fn publish_event(&self, label:impl Into<String>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont understand this comment

}

/// A polymorphic handle of IDE controller.
pub type Ide = Rc<dyn API>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

@@ -0,0 +1,83 @@
//! The Plain IDE Controller
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing dot.

Comment on lines 60 to 61
//TODO [ao]: this should be not the default; instead project model should not need the id.
// See also https://github.com/enso-org/ide/issues/1572
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing link to an issue. I understand that the first line describes an issue (missing link there) and the second line refers to yet another issue (because to the wording "see also") - is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I remove the also.

Comment on lines +634 to +635
// We checked that manage_projects returns Some just a moment ago, so
// unwrapping is safe.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. the "Some" is not correctly formatted
  2. What does it mean "just a moment ago"?
  3. The safety is not clearly seen in the code, imo this should be refactored.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's a comment, not documentation, so I don't see any need for formatting. But it should be Ok after the refactoring
  2. You're in match checking if it returned Ok.
  3. It's quite hard to refactor; already discussed with @mwu-tow : it would make the manage_project method return Rc, not a reference, and thus we couldn't return self what is quite handy here.

let application = Application::new(&web::get_html_element_by_id("root").unwrap());
let view = application.new_view::<ide_view::project::View>();
let status_bar = view.status_bar().clone_ref();
// We know the name of new project before it actually loads. We set it right now to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the word "actually" is not needed here.

@farmaazon farmaazon merged commit 5adc952 into develop May 21, 2021
@farmaazon farmaazon deleted the wip/ao/create-new-project2 branch May 21, 2021 13:24
mwu-tow pushed a commit to enso-org/enso that referenced this pull request Oct 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Category: Controllers The Application layer not bound to visual part Difficulty: Core Contributor Should only be attempted by a core contributor Priority: High Should be scheduled as soon as possible Type: Enhancement An enhancement to the current state of Enso IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants