Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial New Project Wizard scaffolding #2534

Merged
merged 35 commits into from
Mar 27, 2024
Merged

Conversation

sharon-wang
Copy link
Member

@sharon-wang sharon-wang commented Mar 25, 2024

Intent

This PR mainly includes scaffolding and initial setup/components for the New Project flow, currently only allowing for the creation of a new folder based on the user's project name and directory selections. At this moment, the usable functionality of the New Project wizard is equivalent to the New Folder modal.

This video shows the "happy path" flow:

newprojectwizard.mp4

This video shows the different ways to trigger the New Project Wizard, as well as what's stored in the projectConfig data structure upon "accepting" the wizard modal.

newprojectwizard_projectconfig.mp4

UI Notes

  • checking the git repo checkbox doesn't yet do anything
  • project type selection doesn't yet do anything
  • radio buttons on the Python interpreter page don't yet do anything
  • Venv/Conda dropdown options are hardcoded text
  • Conda Python interpreter versions are hardcoded text

Dev Notes

  • this is feature-flagged by adding IsDevelopmentContext to the precondition for the New Project Wizard action
  • lots of TODOs in the code! I am keeping track of what still needs to be done/fixed this way
  • lots of commented out code in the components as placeholders for now
  • lots of strings are not localized yet

Approach

  • Create the modal for the New Project flow based on the New Folder modal
  • Add the New Project action to the same places where you can create a new folder
    • Application menu bar: File > New Project…
    • IDE Actions bar: New > New Project…
    • IDE Top Action Bar Custom Folder Menu: {myCurrentFolderName} > New Project…
    • Command Palette (Cmd+Shift+P): Workspaces: New Project…
  • Handle navigating between steps (back/next buttons) in the wizard
    • Create an action bar with ok, cancel, back and next buttons
    • Each step in the modal is called a WizardStep (e.g, setting the project name and location is a WizardStep, setting up the Python environment/interpreter is a WizardStep)
    • Each substep in a WizardStep is called a WizardSubStep (e.g., setting the project name is a substep, setting the project parent directory is a substep, choosing if the project should be initialized as a git repo is a substep)
  • Store the user's project configuration state via useContext, so the project config can be accessed from any step
  • Populate the Python interpreter dropdown with the detected runtimes from the languageRuntimeService.registeredRuntimes

Here's a visualization of the component hierarchy:

  • The CurrentStep is replaced with the appropriate step each time the user navigates in the wizard (using Back/Next buttons)
    • Steps that currently exist: projectTypeStep, projectNameLocationStep, pythonEnvironmentStep

QA Notes

At this point, this work is not meant to be QA'd.

Functionality is a duplication of New Folder.
Can't use keyboard 'Enter' key to create the project.
re-rendering the combo box with the detected python runtimes isn't working yet. Currently, you need to go back a step and come back to the python env step to see the populated combo box.
While the new project feature is under development, include precondition `IsDevelopmentContext`
If the button should be hidden, the config corresponding to the button should be supplied to the OKCancelBackNextActionBar.
Resolves the issue where the Enter key can't be used to accept the modal.
...unless the project type has changed.
category: workspacesCategory,
f1: true,
// TODO: remove feature flag IsDevelopmentContext when the feature is ready
precondition: ContextKeyExpr.and(EnterMultiRootWorkspaceSupportContext, IsDevelopmentContext),
Copy link
Member Author

Choose a reason for hiding this comment

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

IsDevelopmentContext feature flag here -- this means the Create New Project action won't show up in a release build.

Copy link
Contributor

@softwarenerd softwarenerd left a comment

Choose a reason for hiding this comment

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

Looks good. Some localization missing where I mentioned it and elsewhere. 😀

Copy link
Contributor

@nstrayer nstrayer left a comment

Choose a reason for hiding this comment

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

Looks good to me!
I had some React style comments.

One thing I'm curious about is the file organization. it seems like most of the code is in a subfolder of workbench/browser/positronModalDialogs, is there a reason for this rather than having it in its own folder such as workbench/browser/newProjectWizard?

Comment on lines 92 to 97
{/* <div style={{ marginBottom: '16px' }}>
Your project will be created at:&nbsp;
<span style={{ fontFamily: 'monospace', color: '#D7BA7D' }}>
{newProjectResult.parentFolder + '/' + newProjectResult.projectName}
</span>
</div> */}
Copy link
Contributor

Choose a reason for hiding this comment

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

Will these chunks be uncommented in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, either uncommented or probably replaced.

I have a few spots where I want to display a mixture of regular text and code, but I don't yet have a good way to do that without adding these div+span elements.

There seems to be some sort of string localization support with markdown rendering in other areas (such as Settings), but I haven't figured out how to make that work yet.

@sharon-wang
Copy link
Member Author

One thing I'm curious about is the file organization. it seems like most of the code is in a subfolder of workbench/browser/positronModalDialogs, is there a reason for this rather than having it in its own folder such as workbench/browser/newProjectWizard?

I added the new project wizard as a subfolder of workbench/browser/positronModalDialogs, since the entrypoint/action to opening up the modal sits alongside the entrypoints of the other dialogs in that directory (new folder, new folder from git). I suppose I thought of the wizard as "one of the dialogs" instead of a more separate component. I can totally move it to workbench/browser/positronNewProjectWizard though -- I can see that making sense since it has more functionality than the existing modal dialogs.

@sharon-wang
Copy link
Member Author

Thank you both for the reviews and React insight!

@sharon-wang sharon-wang merged commit 0326a4e into main Mar 27, 2024
1 check passed
@sharon-wang sharon-wang deleted the feature/project-wizard branch March 27, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants