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

Put close icons at the start of the tab label by default on macOS #15103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cdamus
Copy link
Contributor

@cdamus cdamus commented Mar 3, 2025

What it does

Adds a new window.tabCloseIconPlacement preference for whether to present the Close (X) icon in tab titles on the left or the right of the tab.
Defaults to the left on macOS platform in conformity with the OS's native tab controls.
The tab bar rendering is updated to take the preference into account.

The preference is suppressed in the Settings view on non-Mac platforms as being largely irrelevant on those systems.

Fixes eclipse-theia/theia-ide#460

How to test

On a macOS system, build and launch the Theia example app. See that tabs in the main editor area are on the left side where they belong.

Open Settings and change the "Tab close icon placement" preference to "end". See the close icons move back to where they are presented on Linux and Windows platforms. Restore the default setting. See the close icons restored to the left side.

On Linux and Windows systems, verify that the "Tab close icon placement" preference does not appear in the Settings UI and that tab titles look as they ever did.

Follow-ups

None.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

None.

Review checklist

Note

My testing is only on macOS platform as that is the platform that my system runs and the feature is meant to be disabled on other platforms. I'm depending on buddy tests from the Theia community to check for regressions on other platforms.

Reminder for reviewers


CleanShot 2025-03-03 at 16 36 06

@cdamus cdamus force-pushed the issues/theia-ide/460 branch from 32cc3de to 69af7eb Compare March 3, 2025 21:43
Comment on lines 457 to 463
"window": {
"tabCloseIconPlacement": {
"description": "Place the close icons on tab titles at the start or end of the tab. The default is the host OS convention.",
"end": "Place the close icon at the end of the label. In left-to-right languages, this is the right side of the tab.",
"start": "Place the close icon at the start of the label. In left-to-right languages, this is the left side of the tab."
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Please don't add the translations manually to the nls.json file. We have a workflow for that that automatically performs this task before the release. See also here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Mark! I'll revert that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted with commit f61560f. Perhaps that linked documentation can add a note that these files are not meant to be edited by hand when adding new translatable strings.

cdamus added 2 commits March 3, 2025 16:59
Add a new window.tabCloseIconPlacement preference for whether to present
the Close (X) icon in tab titles on the left or the right of the tab.
Default to the left on macOS platform in conformity with the OS's native
tab controls.
Show the new preference in the Settings UI on macOS platform only.

Render the tab title with the icon on the left or right accordingly.

Fixes eclipse-theia/theia-ide#460

Signed-off-by: Christian W. Damus <[email protected]>
Per review, don't attempt to manually add strings to the nls bundle.

Signed-off-by: Christian W. Damus <[email protected]>
@cdamus cdamus force-pushed the issues/theia-ide/460 branch from 69af7eb to f61560f Compare March 3, 2025 22:02
@cdamus
Copy link
Contributor Author

cdamus commented Mar 3, 2025

I'm trying to figure out what the test failure is in the @theia/core test run on Linux platform. I don't see anything in the log that clearly looks like a test failure (no red X, only green checks) but I do see the error quoted below. Is that it? How might this be related to the preference changes in this PR? Needless to say, the @theia/core tests pass for me on macOS platform. Any help diagnosing this will be appreciated.

@theia/core: Encountered an error while validating dummy with value { shouldBeValid: false } against schema { type: 'string' } Error: Only a test!
@theia/core:     at validator.validateString (/home/runner/work/theia/theia/packages/core/lib/browser/preferences/preference-validation-service.spec.js:317:19)
@theia/core:     at PreferenceValidationService.validateBySchema (/home/runner/work/theia/theia/packages/core/lib/browser/preferences/preference-validation-service.js:89:33)
@theia/core:     at Context.<anonymous> (/home/runner/work/theia/theia/packages/core/lib/browser/preferences/preference-validation-service.spec.js:320:24)
@theia/core:     at callFn (/home/runner/work/theia/theia/node_modules/mocha/lib/runnable.js:364:21)
@theia/core:     at Runnable.run (/home/runner/work/theia/theia/node_modules/mocha/lib/runnable.js:352:5)
@theia/core:     at Runner.runTest (/home/runner/work/theia/theia/node_modules/mocha/lib/runner.js:677:10)
@theia/core:     at /home/runner/work/theia/theia/node_modules/mocha/lib/runner.js:800:12
@theia/core:     at next (/home/runner/work/theia/theia/node_modules/mocha/lib/runner.js:592:14)
@theia/core:     at /home/runner/work/theia/theia/node_modules/mocha/lib/runner.js:602:7
@theia/core:     at next (/home/runner/work/theia/theia/node_modules/mocha/lib/runner.js:485:14)
@theia/core:     at Immediate._onImmediate (/home/runner/work/theia/theia/node_modules/mocha/lib/runner.js:570:5)
@theia/core:     at process.processImmediate (node:internal/timers:491:21)
@theia/core: Request to validate preference with no type information: dummy
@theia/core: Request to validate preference with no type information: dummy
@theia/core: Request to validate preference with no type information: dummy
@theia/core: Request to validate preference with no type information: dummy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

Tabs have close button on the wrong side on macOS
2 participants