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

fix: use modified uri handling for diff editor #4150

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Nov 5, 2024

Types

  • 🐛 Bug Fixes

Background or solution

在 Diff 编辑器场景下,修改后的内容展示优先级更高

Changelog

use modified uri handling for diff editor

Summary by CodeRabbit

  • 新功能
    • 改进了菜单项注册逻辑,特别是针对 DiffEditor 的 URI 处理。
  • 错误修复
    • 保留了菜单项验证的错误处理,确保命令和子菜单引用的有效性。

@opensumi opensumi bot added the 🐞 bug Something isn't working label Nov 5, 2024
Copy link
Contributor

coderabbitai bot commented Nov 5, 2024

Walkthrough

此拉取请求对 MenusContributionPoint 类的 contribute 方法进行了修改,主要涉及菜单项注册的逻辑。更新后的实现从查询参数中尝试获取 modified URI,而不是原来的 original URI。这一变化影响了当菜单 ID 对应于 MenuId.EditorTitle 时,argsTransformer 函数的参数转换逻辑。同时,菜单项验证的错误处理逻辑仍然保留,确保命令和子菜单引用经过注册表验证。整体结构保持不变,主要集中在改善 DiffEditor 的 URI 参数处理。

Changes

文件路径 更改摘要
packages/extension/src/browser/vscode/contributes/menu.ts 修改 MenusContributionPoint 类的 contribute 方法,调整 DiffEditor 的 URI 参数处理逻辑。

Possibly related PRs

Suggested labels

🐞 bug

Suggested reviewers

  • Ricbet
  • bytemain

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 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

🧹 Outside diff range and nitpick comments (1)
packages/extension/src/browser/vscode/contributes/menu.ts (1)

253-256: 改进了差异编辑器的 URI 处理逻辑

修改后的实现更符合差异编辑器的使用场景,通过优先获取修改后的 URI 来确保菜单操作作用于最新的内容上。

不过建议添加一些注释来解释为什么要使用 modified URI:

-                  // 对于 DiffEditor 情况时,尝试通过 query 获取 modified URI 作为首个参数
+                  // 对于 DiffEditor 情况时,优先使用 modified URI 作为首个参数
+                  // 这样可以确保菜单操作作用于最新的修改内容上,提供更好的用户体验
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 967717c and cb0869f.

📒 Files selected for processing (1)
  • packages/extension/src/browser/vscode/contributes/menu.ts (1 hunks)

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 54.22%. Comparing base (967717c) to head (cb0869f).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...s/extension/src/browser/vscode/contributes/menu.ts 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4150   +/-   ##
=======================================
  Coverage   54.22%   54.22%           
=======================================
  Files        1598     1598           
  Lines       97652    97652           
  Branches    19976    19984    +8     
=======================================
  Hits        52954    52954           
  Misses      37125    37125           
  Partials     7573     7573           
Flag Coverage Δ
jsdom 49.78% <0.00%> (ø)
node 15.60% <0.00%> (ø)

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.

@erha19 erha19 merged commit 36a2020 into main Nov 15, 2024
13 checks passed
@erha19 erha19 deleted the feat/support-better-markdown-preview branch November 15, 2024 09:56
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.

2 participants