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 Preview does not always open file in preview mode #14524

Open
Tracked by #13192
nimo23 opened this issue Nov 25, 2024 · 3 comments
Open
Tracked by #13192

Open Preview does not always open file in preview mode #14524

nimo23 opened this issue Nov 25, 2024 · 3 comments

Comments

@nimo23
Copy link

nimo23 commented Nov 25, 2024

Bug Description:

Open Preview does not open the file in Preview mode if the file is not already open in Source mode.

Steps to Reproduce:

  1. Go to Explorer and select any file that can be previewed (e.g. *.md file); this file should not already be opened in source mode (in another tab)
  2. Right-click on this file from the Explorer and select the context menu item Open Preview.
  3. Nothing happens. The file does not open.

If you open the file in "source mode" and then click Open Preview, the file will open successfully in "preview mode".

Additional Information

  • Operating System:
  • Theia Version: 1.55
  • Mac OS
@tsmaeder
Copy link
Contributor

tsmaeder commented Dec 3, 2024

@nimo23 confirmed, it's not nice, but I guess not critical since there is an easy workaround.

@tsmaeder
Copy link
Contributor

tsmaeder commented Dec 3, 2024

The way it looks, the code is intended to work this way: see preview-contribution.ts#259: "Open Preview" opens a preview on the currently active editor, not on the selection in the explorer. "Open with..." and selecting preview works.

@tsmaeder tsmaeder mentioned this issue Dec 3, 2024
63 tasks
@nimo23
Copy link
Author

nimo23 commented Dec 3, 2024

Another reproducer:

  1. Go to the Explorer and select any file which can not be previewed (e.g. a *.ts file)
  2. Go to Explorer and select any file that can be previewed (e.g. *.md file); this file should not already be opened in source mode (in another tab)
  3. Right-click on this file from the Explorer and select the context menu item
  4. Open Preview.
  5. Preview opens successfully.

This means that if an editor currently has no active tabs then Explorer->Context Menu->Open Preview does not work - and the user does not get any feedback after clicking.

We could improve the user experience with one of the following solutions:

  1. Enable the menu Explorer->Context Menu->Open Preview only when the editor has active tabs. Otherwise to view or enable this menu item makes no sense in this context, since clicking on the menu item has no effect.

  2. Another solution (which is better) is to call implicitly "Open With..."->.. (which always works) when clicking Explorer->Context Menu->Open Preview menu.

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

No branches or pull requests

2 participants