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: control whether previewer to dispose when editor closed #3888

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

bytemain
Copy link
Member

@bytemain bytemain commented Jul 29, 2024

Types

  • 🎉 New Features

Background or solution

diff previewer 支持关闭编辑器后仍然保存状态

Changelog

add a option to control whether previewer to dispose when editor closed

Summary by CodeRabbit

  • 新功能

    • 增强了内联差异预览的功能,允许用户自定义预览选项。
    • 新增配置选项,用户可选择在编辑器关闭时是否释放预览器。
  • 改进功能

    • 更新内联差异处理程序,以支持更复杂的状态管理和配置。

Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Walkthrough

此次变更显著增强了 inline-diff-previewer.tsinline-diff.handler.ts 文件中的功能,主要通过引入新的接口 IDiffPreviewerOptionsIExtendedSerializedState 来实现更灵活的差异预览配置。这些更改提升了类型安全性和可扩展性,使得用户可以根据自定义设置控制预览器的行为。

Changes

文件 更改摘要
packages/ai-native/src/browser/widget/inline-diff/inline-diff-previewer.ts
packages/ai-native/src/browser/widget/inline-diff/inline-diff.handler.ts
引入 IDiffPreviewerOptions 接口,更新 IExtendedSerializedState 接口以包含选项。修改了 BaseInlineDiffPreviewerLiveInlineDiffPreviewer 的构造函数和方法签名,以支持新的状态表示。更新 InlineDiffHandler 类,改进 _store 属性和 restoreState 方法,增加 createDiffPreviewer 方法的可选参数。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InlineDiffHandler
    participant BaseInlineDiffPreviewer
    participant LiveInlineDiffPreviewer

    User->>InlineDiffHandler: 创建差异预览请求
    InlineDiffHandler->>BaseInlineDiffPreviewer: 初始化预览器(传入选项)
    InlineDiffHandler->>LiveInlineDiffPreviewer: 初始化实时预览器(传入选项)
    LiveInlineDiffPreviewer->>InlineDiffHandler: 返回预览状态
    InlineDiffHandler->>User: 返回预览结果
Loading

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

railway-app bot commented Jul 29, 2024

🚅 Previously deployed to Railway in the core project. Environment has been deleted.

@opensumi opensumi bot added the 🎨 feature feature required label Jul 29, 2024
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

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

Project coverage is 54.84%. Comparing base (94b67ea) to head (eeebbfa).

Files Patch % Lines
...rowser/widget/inline-diff/inline-diff-previewer.ts 0.00% 8 Missing and 1 partial ⚠️
.../browser/widget/inline-diff/inline-diff.handler.ts 0.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3888   +/-   ##
=======================================
  Coverage   54.84%   54.84%           
=======================================
  Files        1558     1558           
  Lines       95093    95098    +5     
  Branches    19475    19484    +9     
=======================================
+ Hits        52158    52161    +3     
- Misses      35662    35664    +2     
  Partials     7273     7273           
Flag Coverage Δ
jsdom 50.29% <0.00%> (+<0.01%) ⬆️
node 15.52% <0.00%> (-0.01%) ⬇️

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 b649b61 into main Jul 29, 2024
13 checks passed
@Ricbet Ricbet deleted the feat/store-options branch July 29, 2024 08:30
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