Skip to content

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

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bubkoo
Copy link

@bubkoo bubkoo commented Jul 18, 2025

Types

  • ๐ŸŽ‰ New Features
  • ๐Ÿ› 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๏ผ‰ใ€‚ๅฆ‚ๆžœๆœช่ฎพ็ฝฎๅฟซๆท้”ฎ๏ผŒๅˆ™ไปไผšๆ˜พ็คบ้ป˜่ฎคๅ€ผใ€‚

@opensumi opensumi bot added the ๐Ÿž bug Something isn't working label Jul 18, 2025
@CLAassistant
Copy link

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.

Copy link
Contributor

coderabbitai bot commented Jul 18, 2025

Walkthrough

ๆœฌๆฌกๆ›ดๆ”นไผ˜ๅŒ–ไบ†็ผ–่พ‘ๅ™จๆ ‡็ญพ้กตๅ…ณ้—ญๆŒ‰้’ฎ็š„ๆ็คบไฟกๆฏ๏ผŒๅŠจๆ€่Žทๅ–ๅนถๆ˜พ็คบโ€œeditor.closeโ€ๅ‘ฝไปค็š„ๅฎž้™…ๅฟซๆท้”ฎ๏ผŒ่€Œไธๅ†ๆ นๆฎๅนณๅฐ็กฌ็ผ–็ ไธบโ€œโŒ˜Wโ€ๆˆ–โ€œCtrl+Wโ€ใ€‚ๅ…ถไฝ™็ป„ไปถๅ’ŒๆœๅŠก้€ป่พ‘ไฟๆŒไธๅ˜ใ€‚

Changes

ๆ–‡ไปถ่ทฏๅพ„ ๅ˜ๆ›ดๆ‘˜่ฆ
packages/design/src/browser/override/editor-tab.service.tsx ๅŠจๆ€่Žทๅ–โ€œeditor.closeโ€ๅ‘ฝไปค็š„ๅฟซๆท้”ฎ๏ผŒๅนถๅœจๅ…ณ้—ญๆ ‡็ญพ้กตๆŒ‰้’ฎ็š„ๆ็คบไธญๆ˜พ็คบ๏ผŒๆ›ฟๆขๅŽŸๆœ‰็š„็กฌ็ผ–็ ๆ–นๅผใ€‚

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EditorTabCloseComponent
    participant KeybindingRegistry

    User->>EditorTabCloseComponent: ้ผ ๆ ‡ๆ‚ฌๅœๅ…ณ้—ญๆŒ‰้’ฎ
    EditorTabCloseComponent->>KeybindingRegistry: ๆŸฅ่ฏข"editor.close"ๅฟซๆท้”ฎ
    KeybindingRegistry-->>EditorTabCloseComponent: ่ฟ”ๅ›žๅฟซๆท้”ฎไฟกๆฏ
    EditorTabCloseComponent-->>User: ๆ˜พ็คบๅŒ…ๅซๅฎž้™…ๅฟซๆท้”ฎ็š„ๆ็คบไฟกๆฏ
Loading

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.

๐Ÿ”ง ESLint

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:12453) [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 eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > inflight@1.0.6: 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 > glob@7.2.3: 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.

โœจ Finishing Touches
  • ๐Ÿ“ Generate Docstrings
๐Ÿงช Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • 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 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 for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

๐Ÿงน Nitpick comments (2)
packages/design/src/browser/override/editor-tab.service.tsx (2)

23-26: ๅฎž็Žฐ้€ป่พ‘ๆญฃ็กฎ๏ผŒไฝ†ๅฏไปฅ่ฟ›่กŒไผ˜ๅŒ–

ๅŠจๆ€่Žทๅ–ๅฟซๆท้”ฎ็š„ๅฎž็Žฐ้€ป่พ‘ๆญฃ็กฎ๏ผŒๆˆๅŠŸๆ›ฟไปฃไบ†็กฌ็ผ–็ ็š„ๅนณๅฐ็‰นๅฎšๅฟซๆท้”ฎใ€‚ไธ่ฟ‡ๆœ‰ๅ‡ ไธชๆ”น่ฟ›ๅปบ่ฎฎ๏ผš

  1. ็ฌฌ25่กŒๅฏไปฅไฝฟ็”จๅฏ้€‰้“พๆ“ไฝœ็ฌฆๆฅ็ฎ€ๅŒ–ไปฃ็ 
  2. ้€ป่พ‘ๆธ…ๆ™ฐ๏ผŒๆญฃ็กฎๅค„็†ไบ†ๅ›ž้€€ๆƒ…ๅ†ต

ๅบ”็”จไปฅไธ‹ไผ˜ๅŒ–๏ผš

-  const keyBinds = keybindingRegistry.getKeybindingsForCommand('editor.close');
-  const keyBinding = keyBinds && keyBinds[0];
+  const keyBinding = keybindingRegistry.getKeybindingsForCommand('editor.close')?.[0];

27-27: ่€ƒ่™‘ useMemo ไพ่ต–ๆ•ฐ็ป„

useMemo ็š„ไพ่ต–ๆ•ฐ็ป„ไธบ็ฉบ๏ผŒไฝ†่ฎก็ฎ—ไพ่ต–ไบŽ shortCut ๅ˜้‡ใ€‚ๅฆ‚ๆžœ่ฟ่กŒๆ—ถๅฏ่ƒฝๅŠจๆ€ๆ›ดๆ–ฐๅฟซๆท้”ฎ็ป‘ๅฎš๏ผŒๅปบ่ฎฎๅฐ† shortCut ๆทปๅŠ ๅˆฐไพ่ต–ๆ•ฐ็ป„ไธญใ€‚

-  const title = useMemo(() => formatLocalize('editor.closeTab.title', shortCut), []);
+  const title = useMemo(() => formatLocalize('editor.closeTab.title', shortCut), [shortCut]);

ๅฆ‚ๆžœๅฟซๆท้”ฎ็ป‘ๅฎšๅœจ่ฟ่กŒๆ—ถๆ˜ฏ้™ๆ€็š„๏ผŒๅฝ“ๅ‰ๅฎž็ŽฐไนŸๆ˜ฏๅฏไปฅๆŽฅๅ—็š„ใ€‚

๐Ÿ“œ Review details

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

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between be6af37 and 1df6f8d.

๐Ÿ“’ Files selected for processing (1)
  • packages/design/src/browser/override/editor-tab.service.tsx (2 hunks)
๐Ÿงฐ Additional context used
๐Ÿง  Learnings (1)
packages/design/src/browser/override/editor-tab.service.tsx (1)
Learnt from: bytemain
PR: opensumi/core#4088
File: packages/ai-native/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx:73-74
Timestamp: 2024-10-12T07:43:08.790Z
Learning: ๅœจ `LivePreviewDiffDecorationModel` ็ฑป๏ผˆไฝไบŽ `packages/ai-native/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx`๏ผ‰ไธญ๏ผŒ้€š่ฟ‡ไพ่ต–ๆณจๅ…ฅ๏ผˆ`@Autowired`๏ผ‰ไปŽ module ็š„ `providers` ๅฃฐๆ˜Žไธญ่Žทๅ–็š„ไพ่ต–๏ผˆๅฆ‚ `_onPartialEditEvent`๏ผ‰๏ผŒๅ…ถ้”€ๆฏ้€ป่พ‘็”ฑ `ClientApp` ็š„็”Ÿๅ‘ฝๅ‘จๆœŸ็ฎก็†๏ผŒไธ้œ€่ฆๆ‰‹ๅŠจ่ฐƒ็”จ `dispose()` ่ฟ›่กŒ้”€ๆฏใ€‚
๐Ÿช› Biome (1.9.4)
packages/design/src/browser/override/editor-tab.service.tsx

[error] 25-25: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

๐Ÿ”‡ Additional comments (1)
packages/design/src/browser/override/editor-tab.service.tsx (1)

4-4: ๅฏผๅ…ฅๅ˜ๆ›ดๆญฃ็กฎ

ๆญฃ็กฎๆทปๅŠ ไบ† KeybindingRegistry ๅฏผๅ…ฅ๏ผŒ่ฟ™ๆ˜ฏๅฎž็ŽฐๅŠจๆ€่Žทๅ–ๅฟซๆท้”ฎๅŠŸ่ƒฝๆ‰€ๅฟ…้œ€็š„ใ€‚

@Ricbet
Copy link
Member

Ricbet commented Jul 18, 2025

LGTMใ€‚
ๆ„Ÿ่ฐข pr๏ผŒ้บป็ƒฆ็ญพไธ€ไธ‹ CLA

@bubkoo
Copy link
Author

bubkoo commented Jul 21, 2025

LGTMใ€‚ ๆ„Ÿ่ฐข pr๏ผŒ้บป็ƒฆ็ญพไธ€ไธ‹ CLA

done

Copy link

codecov bot commented Jul 21, 2025

Codecov Report

All modified and coverable lines are covered by tests โœ…

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.

โ˜” View full report in Codecov by Sentry.
๐Ÿ“ข Have feedback on the report? Share it here.

๐Ÿš€ New features to boost your workflow:
  • โ„๏ธ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • ๐Ÿ“ฆ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erha19
Copy link
Member

erha19 commented Jul 21, 2025

image Lint ๆŠฅ้”™ๅค„็†ไธ€ไธ‹ @bubkoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿž bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ๅ…ณ้—ญ Tab ๅฟซๆท้”ฎๅ†™ๆญปไบ†
4 participants