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

feat: support toggle column selection #4265

Merged
merged 1 commit into from
Dec 25, 2024
Merged

Conversation

hacke2
Copy link
Member

@hacke2 hacke2 commented Dec 24, 2024

Types

  • 🎉 New Features

Background or solution

image

Changelog

feat: support toggle column selection

Summary by CodeRabbit

  • 新功能

    • 引入列选择功能,允许用户在编辑器中通过鼠标和键盘选择文本列。
    • 添加了切换列选择模式的命令。
  • 本地化

    • 为列选择功能添加了英文和中文的本地化条目。

@hacke2 hacke2 requested review from MMhunter and Ricbet December 24, 2024 13:44
@opensumi opensumi bot added the 🎨 feature feature required label Dec 24, 2024
Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

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.

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:*"

概述

遍历

此拉取请求引入了编辑器中列选择的新功能。通过添加新命令 TOGGLE_COLUMN_SELECTION,用户现在可以切换列选择模式。这涉及在多个文件中进行更改,包括命令定义、编辑器贡献、首选项转换器和模式,以及国际化支持。

更改

文件路径 更改摘要
packages/core-browser/src/common/common.command.ts 添加 TOGGLE_COLUMN_SELECTION 命令
packages/editor/src/browser/editor.contribution.ts 注册切换列选择的命令
packages/editor/src/browser/preference/converter.ts 添加 editor.columnSelection 转换器
packages/editor/src/browser/preference/schema.ts 添加列选择配置和默认值
packages/i18n/src/common/editor/en-US.ts 添加英文本地化条目
packages/i18n/src/common/editor/zh-CN.ts 添加中文本地化条目

可能相关的 PR

建议标签

🎨 feature

建议审阅者

  • Ricbet
  • zhanba

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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 (1)
packages/editor/src/browser/editor.contribution.ts (1)

1200-1206: 建议为切换操作添加可见提示或日志记录
当前仅切换用户偏好中的布尔值,若在界面层也能提供提示(如通知或状态栏更新),可提升用户对功能使用状态的认知度。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 647b573 and d8ce06c.

📒 Files selected for processing (6)
  • packages/core-browser/src/common/common.command.ts (1 hunks)
  • packages/editor/src/browser/editor.contribution.ts (1 hunks)
  • packages/editor/src/browser/preference/converter.ts (1 hunks)
  • packages/editor/src/browser/preference/schema.ts (2 hunks)
  • packages/i18n/src/common/editor/en-US.ts (1 hunks)
  • packages/i18n/src/common/editor/zh-CN.ts (1 hunks)
🔇 Additional comments (6)
packages/i18n/src/common/editor/zh-CN.ts (1)

5-6: 新增本地化条目表述清晰,建议保留。
这两条本地化文案简洁明了,符合“列选择模式”功能描述,内容无歧义。

packages/i18n/src/common/editor/en-US.ts (1)

7-8: 文案清晰,符合功能需求。
该英文文案对列选择模式有充分的描述,可正常引导用户理解此功能。

packages/editor/src/browser/preference/converter.ts (1)

197-202: 新增 editor.columnSelection 配置映射,功能与文档注释一致。
此映射将 editor.columnSelection 转换为 monaco 的 columnSelection,默认值为 false,逻辑正确且实现简洁。建议验证在编辑器中确能生效。

packages/core-browser/src/common/common.command.ts (1)

658-663: 新增 TOGGLE_COLUMN_SELECTION 命令,建议与偏好设置保持同步。
此命令与本次新增的 editor.columnSelection 设置相互匹配,推荐在后续 PR 或文档中补充快捷键绑定,方便用户快速开启或关闭列选择。

packages/editor/src/browser/preference/schema.ts (2)

113-113: 默认值设为 false 合理,便于减少误启动
将 columnSelection 默认关闭更符合多数用户习惯,避免因误触导致列编辑模式开启。此处实现符合预期。


1183-1187: 新增首选项配置与编辑器默认值保持一致
此处对 editor.columnSelection 属性的结构与默认值定义与前文的 EDITOR_DEFAULTS 一致,逻辑和实现均无问题。

Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.27%. Comparing base (89c4fea) to head (d8ce06c).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4265      +/-   ##
==========================================
+ Coverage   53.72%   54.27%   +0.55%     
==========================================
  Files        1622     1633      +11     
  Lines       98572    99713    +1141     
  Branches    20143    21628    +1485     
==========================================
+ Hits        52955    54121    +1166     
+ Misses      37911    37884      -27     
- Partials     7706     7708       +2     
Flag Coverage Δ
jsdom 49.79% <100.00%> (+0.60%) ⬆️
node 12.26% <0.00%> (-3.20%) ⬇️

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.

@Ricbet Ricbet merged commit b27409e into main Dec 25, 2024
13 checks passed
@Ricbet Ricbet deleted the feat/toggle-column-selection branch December 25, 2024 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 feature feature required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants