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

WIP: feat: quick open support custom css #3839

Closed
wants to merge 3 commits into from

Conversation

wangxiaojuan
Copy link
Contributor

@wangxiaojuan wangxiaojuan commented Jul 5, 2024

Types

  • 🎉 New Features

Background or solution

Changelog

feat:quick open容器支持自定义样式

Summary by CodeRabbit

  • 新功能
    • 增加了 quickOpenContainerStyle 属性,用于动态设置快速打开容器的样式。

Copy link

railway-app bot commented Jul 5, 2024

This PR was not deployed automatically as @wangxiaojuan does not have access to the Railway project.

In order to get automatic PR deploys, please add @wangxiaojuan to the project inside the project settings page.

Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

这次更新主要是为DesignLayoutConfig类和IDesignLayoutConfig接口添加了一个新属性quickOpenContainerStyle,并在MonacoQuickOpenService中使用该属性动态设置容器的样式。这样,可以更灵活地控制快速打开容器的样式。

Changes

文件路径 变更摘要
packages/core-browser/src/layout/constants.ts DesignLayoutConfig类添加了quickOpenContainerStyle属性和相关的getter方法
packages/core-common/src/types/ai-native/index.ts IDesignLayoutConfig接口添加了quickOpenContainerStyle属性
packages/quick-open/src/browser/quick-open.service.tsx 修改了MonacoQuickOpenService中的appendQuickOpenContainer方法以动态设置容器样式

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

@opensumi opensumi bot added the 🎨 feature feature required label Jul 5, 2024
@wangxiaojuan
Copy link
Contributor Author

/next

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b9caae and e3d39d3.

Files selected for processing (3)
  • packages/core-browser/src/layout/constants.ts (2 hunks)
  • packages/core-common/src/types/ai-native/index.ts (1 hunks)
  • packages/quick-open/src/browser/quick-open.service.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/core-common/src/types/ai-native/index.ts
Additional context used
Biome
packages/quick-open/src/browser/quick-open.service.tsx

[error] 98-98: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (3)
packages/core-browser/src/layout/constants.ts (2)

128-128: 新增属性 quickOpenContainerStyle

新增的 quickOpenContainerStyle 属性已正确添加到 internalLayout 对象中。


143-145: 新增 quickOpenContainerStyle 的 getter 方法

getter 方法实现正确,返回了 internalLayout.quickOpenContainerStyle

packages/quick-open/src/browser/quick-open.service.tsx (1)

87-87: 使用 quickOpenContainerStyle 设置样式

确保 quickOpenContainerStyle 的使用正确。

Verification successful

使用 quickOpenContainerStyle 设置样式

确保 quickOpenContainerStyle 的使用正确。

  • quick-open.service.tsx 文件中,quickOpenContainerStyle 用于设置容器元素的 topright 样式属性,并使用了可选链和回退值来确保有效的样式属性。
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `quickOpenContainerStyle` usage in the codebase.

# Test: Search for the usage of `quickOpenContainerStyle`. Expect: Correct usage in relevant files.
rg --type-add 'tsx' --type tsx 'quickOpenContainerStyle'

Length of output: 114


Script:

#!/bin/bash
# Description: Verify the `quickOpenContainerStyle` usage in the codebase.

# Test: Search for the usage of `quickOpenContainerStyle`. Expect: Correct usage in relevant files.
rg --type-add 'tsx:*.tsx' --type tsx 'quickOpenContainerStyle'

Length of output: 475

Comment on lines 100 to 101
container.style.top = (quickOpenContainerStyle?.top as string) || '0px';
container.style.right = (quickOpenContainerStyle?.right as string) || '50%';
Copy link
Contributor

Choose a reason for hiding this comment

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

修复表达式中的赋值问题

根据静态分析工具的提示,表达式中不应包含赋值操作。

-    container.style.top = (quickOpenContainerStyle?.top as string) || '0px';
-    container.style.right = (quickOpenContainerStyle?.right as string) || '50%';
+    const topStyle = (quickOpenContainerStyle?.top as string) || '0px';
+    const rightStyle = (quickOpenContainerStyle?.right as string) || '50%';
+    container.style.top = topStyle;
+    container.style.right = rightStyle;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
container.style.top = (quickOpenContainerStyle?.top as string) || '0px';
container.style.right = (quickOpenContainerStyle?.right as string) || '50%';
const topStyle = (quickOpenContainerStyle?.top as string) || '0px';
const rightStyle = (quickOpenContainerStyle?.right as string) || '50%';
container.style.top = topStyle;
container.style.right = rightStyle;

@opensumi
Copy link
Contributor

opensumi bot commented Jul 5, 2024

🎉 PR Next publish successful!

3.1.5-next-1720162510.0

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

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

Project coverage is 55.02%. Comparing base (4b9caae) to head (32197af).
Report is 1 commits behind head on main.

Files Patch % Lines
packages/core-browser/src/layout/constants.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3839   +/-   ##
=======================================
  Coverage   55.02%   55.02%           
=======================================
  Files        1553     1553           
  Lines       94700    94698    -2     
  Branches    19378    19380    +2     
=======================================
  Hits        52111    52111           
+ Misses      35384    35379    -5     
- Partials     7205     7208    +3     
Flag Coverage Δ
jsdom 50.47% <0.00%> (+<0.01%) ⬆️
node 15.56% <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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e3d39d3 and 32197af.

Files selected for processing (1)
  • packages/quick-open/src/browser/quick-open.service.tsx (2 hunks)
Additional context used
Biome
packages/quick-open/src/browser/quick-open.service.tsx

[error] 104-104: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (1)
packages/quick-open/src/browser/quick-open.service.tsx (1)

214-221: 方法 setContainerStyle 看起来不错。

该方法通过遍历样式对象并将每个样式属性赋值给容器的 style 属性来动态设置容器的样式。

@wangxiaojuan
Copy link
Contributor Author

/next

@opensumi
Copy link
Contributor

opensumi bot commented Jul 5, 2024

🎉 PR Next publish successful!

3.1.5-next-1720167024.0

@opensumi opensumi deleted a comment from coderabbitai bot Jul 10, 2024
@opensumi opensumi deleted a comment from coderabbitai bot Jul 10, 2024
@wangxiaojuan wangxiaojuan requested a review from Ricbet July 10, 2024 03:24
@bytemain bytemain changed the title feat: quick open容器支持自定义样式 feat: quick open support custom css Jul 10, 2024
@bytemain bytemain changed the title feat: quick open support custom css WIP: feat: quick open support custom css Jul 10, 2024
@bytemain
Copy link
Member

感觉应该可以通过覆写 selector 来做

@bytemain bytemain closed this Jul 12, 2024
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.

None yet

3 participants