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

tabbar: support icon-less items #12804

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

cdamus
Copy link
Contributor

@cdamus cdamus commented Aug 7, 2023

What it does

VS Code renders action buttons in the tab bar for commands that do not have icons using their "title" text, instead. This commit does the same in Theia.

Additionally, two related minor issues are fixed:

  • the $(icon) specifiers for icons show in the tooltip of an action, which is confusing
  • the roll-over highlight shows only on action buttons for commands that use the "icon" property, not those that embed icon specifiers in their titles

I am happy to extract these fixes into separate PRs if you do not feel it appropriate to join them to the primary issue at hand.

Fixes #12686

How to test

  1. Clone the menu_bug_1 branch of the OP's sample repository as indicated in the issue description.
  2. Build the myext extension in that sample repository and link it into the plugins/ directory of your Theia build.
  3. Launch Theia and open a code editor on some file (e.g., a TS or JSON file from the OP's sample repository).
  4. See the "Goodbye World" action presented in the toolbar next to the pencil-icon "Hello World" action as shown below, and verify that it works (showing a message toast).

CleanShot 2023-08-07 at 08 57 50

Other tests that I would recommend, especially covering the ancillary issues fixed herein, include:

  • append a Font Awesome icon specifier to the title of the "Goodbye World" command and see that it renders the icon and tooltip plausibly like this example using $(cube):
    CleanShot 2023-08-07 at 09 34 13
  • remove the "title" property of the myext.goodbyeWorld command from the myext extension's package.json and see that at least the ID is shown for the command, which will indicate to the developer of this extension that something is amiss (otherwise there would just be a blank spot in the toolbar which could possibly be unobserved)
    CleanShot 2023-08-07 at 09 47 58

Review checklist

Reminder for reviewers

@@ -32,7 +32,7 @@ before(() => {
statusBarEntryUtility = testContainer.get(LabelParser);
});

describe('StatusBarEntryUtility', () => {
describe.only('StatusBarEntryUtility', () => {
Copy link
Member

Choose a reason for hiding this comment

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

@cdamus please remove the .only or only this test in @theia/core will effectively run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh gosh, that was silly.

Copy link
Contributor Author

@cdamus cdamus Aug 7, 2023

Choose a reason for hiding this comment

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

Commit d17284f fixes that and I've verified that the entire core suite (495 tests run and 2 skipped) is restored.

@vince-fugnitto vince-fugnitto added vscode issues related to VSCode compatibility ui/ux issues related to user interface / user experience toolbar issues related to the toolbar labels Aug 21, 2023
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.

The changes work well and look good to me 👍
I'll ask others to review if they have any feedback, if not we can still merge for this month's release.

@cdamus
Copy link
Contributor Author

cdamus commented Aug 28, 2023

This fix does not interact well with other changes merged in the mean-time to master, so I've some more work to do.

The merge of eclipse-theia#12799 introduced a regression in
the rendering of MenuToolbarItems that aren't
pop-up menus but instead just commands that
happen to have a menu path: they were rendered
as pop-up menus instead of simple buttons.

This fix refines the condition for the new pop-up
menu rendering to check that the menu to be
rendered is not a command to be executed
directly on click.

Fixes eclipse-theia#12687

Signed-off-by: Christian W. Damus <cdamus.ext@eclipsesource.com>
VS Code renders action buttons in the tab bar
for commands that do not have icons using
their title text, instead. This commit does the
same in Theia.

Additionally, two related minor issues are fixed:

- the $(icon) specifiers for icons show in the
  tooltip of an action, which is confusing
- the roll-over highlight shows only on action
  buttons for commands that use the "icon"
  property, not those that embed icon specifiers
  in their titles

Fixes eclipse-theia#12686

Signed-off-by: Christian W. Damus <cdamus.ext@eclipsesource.com>
@cdamus
Copy link
Contributor Author

cdamus commented Aug 28, 2023

This fix does not interact well with other changes merged in the mean-time to master, so I've some more work to do.

So it wasn't as much a bad interaction of this fix with intervening changes as it was a regression introduced on master by those other changes (specifically #12799). Commit a608abe is rebased onto PR #12869 that I've raised separately to fix that regression in its original context.

Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

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

Thank you for re-working this based on the current master! As far as I can tell everything works now as expected, regular items, run items, etc. Great work!
@vince-fugnitto Do you want to have another look at this?

@martin-fleck-at
Copy link
Contributor

@vince-fugnitto I'm merging this for now. If you encounter any problems with it, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolbar issues related to the toolbar ui/ux issues related to user interface / user experience vscode issues related to VSCode compatibility
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Icon-less VS Code “editor/title” menu contribution not rendered properly
3 participants