core icon indicating copy to clipboard operation
core copied to clipboard

fix: get close tab shortcut from key-binding-registry

Open bubkoo opened this issue 5 months ago • 6 comments

Types

  • [ ] 🎉 New Features
  • [x] 🐛 Bug Fixes
  • [ ] 📚 Documentation Changes
  • [ ] 💄 Code Style Changes
  • [ ] 💄 Style Changes
  • [ ] 🪚 Refactors
  • [ ] 🚀 Performance Improvements
  • [ ] 🏗️ Build System
  • [ ] ⏱ Tests
  • [ ] 🧹 Chores
  • [ ] Other Changes

Background or solution

fix #4604

Changelog

Summary by CodeRabbit

  • 改进
    • 编辑器标签页关闭按钮的提示信息现在会动态显示当前实际的快捷键组合,而非固定为平台默认(如⌘W或Ctrl+W)。如果未设置快捷键,则仍会显示默认值。
    • 关闭标签页按钮的提示气泡位置调整为顶部显示。

bubkoo avatar Jul 18 '25 09:07 bubkoo

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


pengxingjian seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jul 18 '25 09:07 CLAassistant

## Walkthrough

本次更改优化了编辑器标签页关闭按钮的提示信息,动态获取并显示“editor.close”命令的实际快捷键,而不再根据平台硬编码为“⌘W”或“Ctrl+W”。其余组件和服务逻辑保持不变。

## Changes

| 文件路径                                                         | 变更摘要                                   |
|------------------------------------------------------------------|--------------------------------------------|
| packages/design/src/browser/override/editor-tab.service.tsx       | 动态获取“editor.close”命令的快捷键,并在关闭标签页按钮的提示中显示,替换原有的硬编码方式,调整提示弹出位置。|

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant EditorTabCloseComponent
    participant KeybindingRegistry

    User->>EditorTabCloseComponent: 鼠标悬停关闭按钮
    EditorTabCloseComponent->>KeybindingRegistry: 查询"editor.close"快捷键
    KeybindingRegistry-->>EditorTabCloseComponent: 返回快捷键信息
    EditorTabCloseComponent-->>User: 显示包含实际快捷键的提示信息

Estimated code review effort

1 (~5 minutes)


<!-- walkthrough_end -->
<!-- This is an auto-generated comment: all tool run failures by coderabbit.ai -->

> [!WARNING]
> There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
> 
> <details>
> <summary>🔧 ESLint</summary>
> 
> > If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
> 
> yarn install v1.22.22
> [1/4] Resolving packages...
> (node:7289) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
> (Use `node --trace-deprecation ...` to show where the warning was created)
> warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
> warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
> warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
> warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
> warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
> warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
> warning eslint-import-resolver-typescript > [email protected]: Glob versions prior to v9 are no longer supported
> error Couldn't find any versions for "@opensumi/ide-dev-tool" that matches "workspace:*"
> info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
> 
> 
> 
> </details>

<!-- end of auto-generated comment: all tool run failures by coderabbit.ai -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 1df6f8d37bd74bb64ccda8ac285d0f0ffb6fda1f and e0b8a5331b0fd1b12919a94bfd14ee65e72c4666.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `packages/design/src/browser/override/editor-tab.service.tsx` (2 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* packages/design/src/browser/override/editor-tab.service.tsx

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADy5SUIYvfEQPXBV7WHwKXAY8SFiKFkgAaxJZMDUMWngMIjB/IiRcF2jIAHc0ZAcBZnUaejkw2A9sTL4BbAEK/Hx0ZFtIDEcBSkgAFgA2AAZd/ixcCcgAeW4yAGVHHSZ/PxJuDPV82Q0YM+ZtLG5sCgvTL8WLjVCrVAEdC0Wj+RDINCQWZEEqJAA09iuDHg8QYaB88n8XmoUShSAcHjMe3220+7kYsEwpBQGAk+C8UmQ/g68BIEkaKNOHkQeQKRVCsXyjHSiAF6DCOVK5SFlWqtUaDSaTzaiA6H0gADkluRuiUSNQAdIMbR8EU2BhsuJ8FgGIymlb7LhZJEGUyPf5YmgxPlEBirhRJRQfhgGB54MxePgpPbcKGkdh4F56IhZLqSMxINhuLQSWmaLq0678h6pfghXxXX7kN1KHGY15sEp6I0wSsbHSzkpEAwKPBuE6sDbpGs6zwyvylNCGhP8ZAlNlMzJqs76CrkaiEgoHSQEqFMLuzuTgk9Yq2YyQNOZLABhFgp/qOH4uNxnZ8AGQAQWWWVdUwUJGnUeB8S8eRYmJIhSAvahxg8JgHVHWYCD4Rl6AwWdZSIcgLw8V90PgTCpT/eBYwwYEAKIfx83YSAAAp/wAgBKDFugQV0UC5QIM38ehI3QBhY3HOU0J5TD4GdZAoRVRMRDET4gKYVhmLwkZxmQlUpi2aIriaBIBSEKCMC6XpkG0p4mEI+AAC8oj6eUAHF1AACTmQ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f0cToAkJlTZJAdn5B+KMlUPVdSqg8ZM+qDolg5McJgFo5oSwCB9EGWMkRf5SlKU0AcqAEUokhBMLABluxIw8OkGxTkrbsnENwMI6gfQ+LOEE4EDCeD4BeKnAZoI8K/KOaik5xVaAYjSoGHwMgJ6lSUvTOSUweC9PeWARAWIlEMDXCQQM3hNB8JhJBZ00FZAZzjrSihfAh4Tn4sdRCJQygFlUVYTVqdTWygnBoAQdYCDMFMVCE1ZrKAWuVRgNhtLVGozhKECRyUybGJKgFeZVdm5Q1+MgYqUjEILSfHwrwE1qBhQUksFUSg0jOCTfJEE6UEgvAKFEKU/xIXUXSoLcQ0gjBQCNPq6cikziIwtHCHNJ580821XMBK0r2CQUal8DwCiGi4izeFZwbYJqWKyqmqJmjaE6IEHo4JhisYmI9jGXVAUbQzjPLEW8Yhc1tpjseCMQZpxN2JPCSAbBTiKBGpYlxcJHxcOiFW+BiD15/T9dvL+pAf4knoFnABfg0DAM/M4eQYwb4qGgQ/OBhhn7e3UAAfRiogJDgq1p0CQ6BAocH32QBZrQWIuxYgAA5aAAGYADsAhaBUe2KoXY2xxIllI0GAATKRgArLQfYsQ+OxAECRksLNQRPzXulfYAg2NcYoxRlmAg+O0AUyzdjbN2ZoDZgx2IyntjG12FxkgVH2MMD2LsI4K8DAIcTsh1D6G+S8hbLQJDG88MIeYAwbgSHZ6nmw9kXDlnVFBYMAAbwMJAGIaTaqwFTNELgABtAAumicLMRegUAwAKRAcXIBJYMAAXwMEF1R+GPNeZ87gFzf19BAA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings
<details>
<summary>🧪 Generate unit tests</summary>

- [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Create PR with unit tests
- [ ] <!-- {"checkboxId": "07f1e7d6-8a8e-4e23-9900-8731c2c87f58", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Post copyable unit tests in a comment

</details>

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=opensumi/core&utm_content=4606):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai generate unit tests` to generate unit tests for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

coderabbitai[bot] avatar Jul 18 '25 09:07 coderabbitai[bot]

LGTM。 感谢 pr,麻烦签一下 CLA

Ricbet avatar Jul 18 '25 09:07 Ricbet

LGTM。 感谢 pr,麻烦签一下 CLA

done

bubkoo avatar Jul 21 '25 01:07 bubkoo

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 52.61%. Comparing base (c9b2cbc) to head (1df6f8d). Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #4606    +/-   ##
========================================
  Coverage   52.61%   52.61%            
========================================
  Files        1687     1687            
  Lines      104341   104341            
  Branches    22668    22816   +148     
========================================
  Hits        54899    54899            
  Misses      41081    41081            
  Partials     8361     8361            
Flag Coverage Δ
jsdom 48.15% <ø> (ø)
node 12.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jul 21 '25 02:07 codecov[bot]

image Lint 报错处理一下 @bubkoo

erha19 avatar Jul 21 '25 02:07 erha19