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

Open new, multi-root workspace from CLI #11034

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Apr 14, 2022

What it does

This PR implements the ability to open a multi-root workspace by entering multiple folders on the command line.

How to test

  1. Run the Theia CLI and enter multiple folders on the command line.
  2. Depending on the number of (existing) folders entered
  • 0 -> open last workspace
  • 1 -> open folder as workspace (or open workspace file)
  • > 1 -> create new untitled workspace file and open it.

Decisions:

  • If multiple entries are found, they're filtered down to existing folders; non-folders are ignored.
  • If a single entry is found, it's handled fairly naively: the rest of the workspace system knows to ignore non-existent results from the workspace CLI
  • There's some URI logic that could use @msujew's advice.

Review checklist

Reminder for reviewers

@colin-grant-work colin-grant-work added theia-cli issues related to the theia-cli proposal feature proposals (potential future features) workspace issues related to the workspace labels Apr 14, 2022
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirmed that the following works well for me on linux:

  • yarn electron start without a workspace will open the previously opened workspace
  • yarn electron start ${folder} will open the application with the folder as a workspace
  • yarn electron start ${invalid-folder} will open the application without a workspace
  • yarn electron start ${folder-1} ${folder-2} will open the application with a multi-root workspace with the supplied folder roots
  • yarn electron start ${folder-1} ${folder-2} ${invalid-folder} will open the application with a multi-root workspace with the supplied folder roots omitting the invalid one

@colin-grant-work
Copy link
Contributor Author

@msujew, would you be willing to weigh in on the URI handling in this PR?

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Noticed some issues on Windows with this. I checked that it works correctly with the suggestion applied 👍

You will need to rebase in order to use Path.fsPath().

packages/workspace/src/browser/workspace-service.ts Outdated Show resolved Hide resolved
packages/workspace/src/node/default-workspace-server.ts Outdated Show resolved Hide resolved
packages/workspace/src/node/default-workspace-server.ts Outdated Show resolved Hide resolved
@colin-grant-work colin-grant-work force-pushed the feature/multi-root-workspace-CLI branch from afedf8d to fb88fa4 Compare May 19, 2022 18:29
@colin-grant-work colin-grant-work force-pushed the feature/multi-root-workspace-CLI branch from 10ec751 to 3f0b264 Compare May 19, 2022 18:31
@colin-grant-work
Copy link
Contributor Author

@msujew, many thanks! 🙌

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

@colin-grant-work You're welcome :)

After the latest changes everything works well for me!

@colin-grant-work colin-grant-work merged commit d8a6ab4 into eclipse-theia:master May 20, 2022
@colin-grant-work colin-grant-work deleted the feature/multi-root-workspace-CLI branch May 20, 2022 14:20
@vince-fugnitto vince-fugnitto added this to the 1.26.0 milestone May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal feature proposals (potential future features) theia-cli issues related to the theia-cli workspace issues related to the workspace
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants