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

Create a new 'Open in Trace Viewer' command, add it to navigator context menu #1119

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

marcdumais-work
Copy link
Contributor

@marcdumais-work marcdumais-work commented Sep 20, 2024

Starting around Theia v1.50.0, the "open-with" service no longer permitted to open folders from the navigator context menu (only worked for files). It was possible to make it work again, but there were undesirable side-effects. So instead, we decided to register our own command, "Open with Trace Viewer", and add it to the navigator's context menu at the first level. This is very similar to what we have on the Trace Viewer for VSCode extension.

Also updated the README to reflect how a trace can now be be opened from the File Explorer, and recorded a new .gif showing it (will only be visible from the README after the PR is merged).

Note: this PR is currently on top of the upgrade to Theia 1.52.0, that has its own PR. We can merge that one first, or I can re-organize the commits if needed.

@marcdumais-work marcdumais-work changed the title Remove usage of Theia platform "open-with" service, create new "Open in Trace Viewer" command Create a new 'Open in Trace Viewer' command, add it to navigator context menu Sep 20, 2024
@marcdumais-work marcdumais-work force-pushed the new-open-with-command branch 2 times, most recently from f20f42c to add7725 Compare September 20, 2024 17:40
@marcdumais-work marcdumais-work changed the title Create a new 'Open in Trace Viewer' command, add it to navigator context menu Create a new 'Open with Trace Viewer' command, add it to navigator context menu Sep 23, 2024
@marcdumais-work marcdumais-work marked this pull request as ready for review September 24, 2024 12:21
Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

It works well in both browser and electron app. Small comments though.

README.md Outdated
@@ -466,7 +466,7 @@ The code in this repository is licensed under `MIT` (see root `LICENSE`), except
[image-icon]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-icon.png
[image-open-browser]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-browser.png
[image-open-view]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-view.gif
[image-open-with]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-with-trace-viewer.gif
[image-open-with-trace-viewer]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-with-trace-viewer.gif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Github caches images. So, even if you change the source file of the image it will still show the old file on the webpage. So, what I usually do is to have a version number on the file, include that new file and delete the old one with the old name (see below for an example).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen your comment below, about being ok with "open in" - I'll restore that version and it will fix this comment, since the .gif file is named differently.

export const OPEN_WITH_TRACE_VIEWER: Command = {
id: 'trace-explorer:open-with-trace-viewer',
label: 'Open with Trace Viewer'
};
Copy link
Collaborator

@bhufmann bhufmann Sep 24, 2024

Choose a reason for hiding this comment

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

Not sure where to add the comment. Could you please change the priority of the menu entry of that command so that it's lower in the list, preferably last. We did the same change in the vscode-trace-extension PR 249 after receiving user feedback that it's too intrusive (i.e. too high up with the common open commands). See image. Not sure how to do that in Theia but it should be possible.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

change the priority of the menu entry of that command so that it's lower in the list, preferably last

easily done

[use "open in trace viewer"] we should also change it in the vscode-trace-extension

Created an issue, that we can schedule as we see fit: eclipse-cdt-cloud/vscode-trace-extension#275

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed a new version that should address the comments. The context menu entry should be the last item in the "Navigation" section (top part) of the menu. We can't control the order of new entries that might get added by others, but with the vanilla entries, added by Theia, we should be consistently at the end of the section.

Copy link
Contributor Author

@marcdumais-work marcdumais-work Sep 24, 2024

Choose a reason for hiding this comment

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

One question I have: are you bugged by the constant and "id" using "OPEN_WITH..." / "...open-with..." but presenting the command as "open in..."?:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If so, I can align everything to use "open in"

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's now or never because after we release it the command could be triggered by a third-party extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point - let's do it then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, new version pushed

@marcdumais-work marcdumais-work changed the title Create a new 'Open with Trace Viewer' command, add it to navigator context menu Create a new 'Open in Trace Viewer' command, add it to navigator context menu Sep 24, 2024
@marcdumais-work marcdumais-work force-pushed the new-open-with-command branch 3 times, most recently from 6747e89 to 1beaa17 Compare September 24, 2024 18:55
…ext menu

Starting around Theia v1.50.0, the "open-with" service no longer permitted to open
folders from the navigator context menu (only worked for files). It was possible to
make it work again, but there were undesirable side-effects. So instead, we decided
to register our own command, "Open in Trace Viewer", and add it to the navigator's
context menu at the first level. This is very similar to what we have on the `Trace
Viewer for VSCode` extension.

Also updated the README to reflect how a trace can now be be opened from the File
Explorer, and recorded a new .gif showing it.

Signed-off-by: Marc Dumais <[email protected]>
Copy link
Collaborator

@bhufmann bhufmann 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. Tested both browser and electron. Thanks!

@marcdumais-work marcdumais-work merged commit 1a0f1c2 into master Sep 25, 2024
7 checks passed
@marcdumais-work marcdumais-work deleted the new-open-with-command branch September 25, 2024 12:51
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.

2 participants