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

implement workbench: startup editor preference #12813

Merged

Conversation

vladarama
Copy link
Contributor

What it does

Fixes: #12754

This PR implements the workbench: startup editor preference. This allows the user to choose which editor is shown on startup when none are restored from the previous session.

Implemented preferences:

  • none: no editor will be shown on startup.
  • welcomePage: the default welcome page will be shown on startup.
  • readme: it will open the folder's readme file in preview mode.
  • newUntitledFile: opens an untitled file on startup.
  • welcomePageInEmptyWorkbench: only opens the welcome page when opening
    empty workbench.

How to test

  1. Open Theia application.
  2. Go to Settings -> workbench: startup editor and select one of the preference to test.
  3. Close any opened editor and restart Theia.
  4. The selected editor should be shown on startup.
  5. Repeat 2-4 until all of the preferences are tested.

Review checklist

Reminder for reviewers

@msujew msujew added the preferences issues related to preferences label Aug 17, 2023
@vladarama vladarama requested a review from msujew August 17, 2023 18:56
Copy link
Contributor Author

@vladarama vladarama left a comment

Choose a reason for hiding this comment

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

Hey @msujew ,
Thanks for reviewing, I have addressed your comments and fixed the implementation errors. It should be a lot cleaner now 👍

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.

Thanks, looks good to me. Each of the new preference values seem to work as expected 👍

@JonasHelming
Copy link
Contributor

@vince-fugnitto Do you want to merge this?

@vince-fugnitto
Copy link
Member

@vince-fugnitto Do you want to merge this?

Not yet, I'm still performing an offline review with @vladarama about the changes.

Vlad Arama added 5 commits August 22, 2023 13:56
This commit introduces 5 new startup editor preferences:
- none: no editor will be shown on startup
- welcomePage: the default welcome page will be shown on startup
- readme: it will open the folder's readme in preview mode
- newUntitledFile: opens an untitled file on startup
- welcomePageInEmptyWorkbench: only opens the welcome page when opening
  empty workbench
This commit aims to address and fix various comments received on the PR:
- This includes waiting for the `preferenceService` and the
`workspaceService` to be ready before actually using them.
- It also includes a minor refactoring of the `openReadme` method to avoid the
conversion from URI -> string -> URI.

Signed-Off-By: Vlad Arama <vlad.arama@ericsson.com>
This commit removes the `alwaysShowWelcomePage` preference to allow the
checkbox to toggle between the `welcomePage` (checked) and `none`
(unchecked) states. This is the behavior currently present in vscode.

Signed-off-by: Vlad Arama <vlad.arama@ericsson.com>
This commit addresses a few comments:
- Move preferences from `@theia/core` to `@theia/getting-started`
- Simplify `newUntitledFile` code to reuse the command

Signed-off-by: Vlad Arama <vlad.arama@ericsson.com>
This commit addresses review comments by doing the following:
- Remove unused injections
- Use `NEW_UNTITLED_TEXT_FILE` instead of `NEW_UNTITLED_FILE`
- Fix typos and align preference id with VS Code

Signed-off-by: Vlad Arama <vlad.arama@ericsson.com>
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.

LGTM 👍 I confirmed the following workbench.startupEditor:

Preference Use-Case Result
welcomePage no editors present the welcome page is opened on startup
welcomePage no editors present (no workspace) the welcome page is opened on startup
welcomePage editors present the welcome page is not opened on startup
none all cases nothing happens on startup besides restoring past views
newUntitledFile no editors present an untitled text file is opened on startup
newUntitledFile no editors present (no workspace) an untitled text file is opened on startup
newUntitledFile editors present no untitled file is opened on startup
readme no editors present the readme is opened on startup
readme no editors present, no readme present in the workspace the welcome page is opened as a fallback on startup
readme no editors present (no workspace) the welcome page is opened as a fallback on startup
readme editors present no readme is opened on startup
welcomePageInEmptyWorkbench workspace present no welcome page is opened on startup
welcomePageInEmptyWorkbench no workspace present the welcome page is opened on startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preferences issues related to preferences
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

preferences: add workbench: startup editor setting
4 participants