-
Notifications
You must be signed in to change notification settings - Fork 386
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
fix: in web ide menu does not display; in web ide shortcut keys are not available #4160
base: main
Are you sure you want to change the base?
Conversation
weimin2.zhou 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. |
Walkthrough此拉取请求对 Changes
Possibly related PRs
Suggested reviewers
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
warning eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (1)
packages/core-browser/src/keybinding/keybinding.ts (1)
891-894
: 优雅处理了环境特定的快捷键!在 Web 环境下跳过 electron 相关的快捷键绑定,避免与浏览器默认快捷键冲突,实现优雅。建议添加单元测试验证此逻辑。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
packages/core-browser/src/common/common.contribution.ts
(1 hunks)packages/core-browser/src/keybinding/keybinding.ts
(3 hunks)
🔇 Additional comments (2)
packages/core-browser/src/common/common.contribution.ts (1)
63-64
: 请验证简化条件的影响范围
条件判断从复杂的组合逻辑简化为仅检查 !this.appConfig.isRemote
,这个改动可能会影响到以下场景:
- 在非远程但也非 Electron 环境下的行为发生了变化
- 可能会在不适合的场景下启用文件夹和工作区打开功能
建议:
- 添加详细的注释说明此更改的原因
- 考虑添加单元测试验证各种环境组合下的行为
✅ Verification successful
Let me gather more context about the previous implementation and the PR's objective.
移除 isElectronRenderer 检查是合理的改动
从代码历史和使用场景分析,移除 isElectronRenderer
的检查是合理的:
- 文件夹和工作区打开功能只需要确保不在远程环境即可,与是否在 Electron 环境中运行无关
- 在
window.service.ts
中可以看到,Electron 特定功能都有独立的判断和处理逻辑 - 这个改动使得非 Electron 的本地环境(如浏览器)也能支持打开文件夹和工作区的功能
相关的功能使用检查(在 file-tree-next
模块)也仅依赖于这些配置项的布尔值,不会受到实现细节变化的影响。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 搜索与这些配置项相关的使用场景
rg "application\.supportsOpenFolder|application\.supportsOpenWorkspace" -A 3
Length of output: 3757
Script:
#!/bin/bash
# Check the previous implementation and related changes
git log -p packages/core-browser/src/common/common.contribution.ts | grep -A 10 "supportsOpen"
# Check if there are any related test files
fd "common.contribution.test" --type f
# Look for any documentation about remote vs electron environments
rg "isRemote|isElectronRenderer" -A 3 packages/core-browser/
Length of output: 11523
packages/core-browser/src/keybinding/keybinding.ts (1)
20-20
: 依赖注入实现合理!
通过依赖注入方式集成 AppConfig 服务,符合代码设计规范。
Also applies to: 234-236
@eedpublic 签署一下 CLA |
commit message 最好改一下,写清楚这段代码的作用 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4160 +/- ##
==========================================
- Coverage 54.05% 54.04% -0.01%
==========================================
Files 1616 1616
Lines 97963 97967 +4
Branches 20055 20048 -7
==========================================
- Hits 52952 52949 -3
- Misses 37398 37404 +6
- Partials 7613 7614 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -60,8 +60,8 @@ export class ClientCommonContribution | |||
|
|||
constructor() { | |||
const overridePropertiesDefault = { | |||
'application.supportsOpenFolder': !!this.appConfig.isElectronRenderer && !this.appConfig.isRemote, | |||
'application.supportsOpenWorkspace': !!this.appConfig.isElectronRenderer && !this.appConfig.isRemote, | |||
'application.supportsOpenFolder': !this.appConfig.isRemote, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在 Web 环境下这两个功能的表现是什么样的,贴张图
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (1)
packages/core-browser/src/keybinding/keybinding.ts (1)
890-893
: 建议重构电子快捷键处理逻辑以提高可维护性当前实现直接在
tryKeybindingExecution
方法中处理电子快捷键的跳过逻辑。建议将这个逻辑抽取到一个单独的方法中,以提高代码的可维护性和可测试性。建议应用以下更改:
+private shouldSkipElectronBinding(binding: Keybinding): boolean { + return !this.appConfig.isElectronRenderer && binding.command.startsWith('electron.'); +} protected tryKeybindingExecution(bindings: Keybinding[], event: KeyboardEvent): boolean { if (bindings.length === 0) { return false; } for (const binding of bindings) { - // 在web下electron绑定的浏览器基础快捷键无法使用,这里跳过,直接使用浏览器的快捷键 - if (!this.appConfig.isElectronRenderer && binding.command.startsWith('electron.')) { + if (this.shouldSkipElectronBinding(binding)) { continue; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/core-browser/src/keybinding/keybinding.ts
(3 hunks)
🔇 Additional comments (1)
packages/core-browser/src/keybinding/keybinding.ts (1)
234-236
: 注入配置看起来不错!
AppConfig 的注入实现正确,并且遵循了类中其他依赖注入的模式。
Types
Background or solution
Changelog
Summary by CodeRabbit
新功能
修复