[WEB-1116] fix: page outline not reflecting changes in realtime
Description
Headings stopped loading post the real time changes as we're not directly fetching and feeding in the data to the editor, but instead the control is with our live server.
Hence the calculation needs to happen inside the editor post it's initialization, and the web app that needs to render the headings list needs to subscribe to the editor updates for calculating using the editorRef.onHeadingChange function and can optionally pass a callback to perform a side effect based on the updated list of headings.
We're emitting an update event once the calculation of headings is complete since custom events aren't supported in tiptop, to give the latest headings' list on content change.
this.editor.emit("update", { editor: this.editor, transaction: newState.tr });
When a component renders for the first time there's no guarantee that the editor will emit an update (as maybe editor has initialized a long time ago, so for that reason we've exposed another function editorRef.getHeadings() to get the latest headings list.
Minor fixes
- On selecting new images as well the toolbar item gets highlighted.
Summary by CodeRabbit
Release Notes
-
New Features
- Introduced
HeadingListExtensionfor improved management of headings in the editor. - Added
onHeadingChangeandgetHeadingsmethods for dynamic access to headings in both editable and read-only modes.
- Introduced
-
Bug Fixes
- Enhanced recognition of active image handling states in the editor's menu.
-
Refactor
- Removed reliance on
markingsprop across multiple components for streamlined state management. - Updated component rendering logic to respond to the editor's readiness state.
- Removed reliance on
-
Chores
- Adjusted import paths to align with the Tiptap framework for better integration.
Walkthrough
The changes in this pull request involve multiple modifications across various files in the editor's codebase. Key updates include enhancements to the isActive function in the ImageItem component, adjustments to import paths for ProseMirror classes, the introduction of a new HeadingListExtension, and the addition of methods for managing headings in the useEditor and useReadOnlyEditor hooks. Additionally, several components have been refactored to remove dependencies on the markings prop, streamlining their interfaces and improving state management.
Changes
| Files | Change Summary |
|---|---|
packages/editor/src/core/components/menus/menu-items.ts |
Modified isActive function in ImageItem to include check for imageComponent command. |
packages/editor/src/core/extensions/drop.tsx |
Updated import paths for Plugin and EditorView from prosemirror-state and prosemirror-view to @tiptap/pm/state and @tiptap/pm/view. |
packages/editor/src/core/extensions/extensions.tsx |
Added HeadingListExtension to CoreEditorExtensions. |
packages/editor/src/core/extensions/headers.ts |
Introduced HeadingListExtension with IMarking interface and functionality to manage headings. |
packages/editor/src/core/extensions/index.ts |
Added export * from "./headers"; to include HeadingListExtension. |
packages/editor/src/core/extensions/read-only-extensions.tsx |
Added HeadingListExtension to CoreReadOnlyEditorExtensions. |
packages/editor/src/core/extensions/table/table/utilities/create-cell.ts |
Changed import source for Fragment, Node, and NodeType from prosemirror-model to @tiptap/pm/model. |
packages/editor/src/core/extensions/table/table/utilities/get-table-node-types.ts |
Changed import source for NodeType and Schema from prosemirror-model to @tiptap/pm/model. |
packages/editor/src/core/hooks/use-editor.ts |
Added onHeadingChange and getHeadings methods to manage heading updates and retrieval. |
packages/editor/src/core/hooks/use-read-only-editor.ts |
Added onHeadingChange and getHeadings methods for heading management. |
packages/editor/src/core/types/editor.ts |
Added onHeadingChange and getHeadings methods to EditorReadOnlyRefApi. |
web/core/components/pages/editor/editor-body.tsx |
Removed useEffect for markings, added editorReady prop, and simplified PageContentBrowser usage. |
web/core/components/pages/editor/header/mobile-root.tsx |
Removed markings prop from PageEditorMobileHeaderRoot. |
web/core/components/pages/editor/header/root.tsx |
Removed markings prop, updated rendering logic for PageSummaryPopover based on editor readiness. |
web/core/components/pages/editor/page-root.tsx |
Removed useEditorMarkings hook and associated markings state and props. |
web/core/components/pages/editor/summary/content-browser.tsx |
Refactored to manage headings state internally instead of relying on markings. |
web/core/components/pages/editor/summary/popover.tsx |
Removed markings prop from PageSummaryPopover. |
Possibly related PRs
- #5585: Modifications to the
ImageItemfunction inmenu-items.ts, enhancing image handling functionalities within the editor. - #5554: Changes to the
use-editoranduse-read-only-editorhooks, improving overall editor interactions, particularly around image handling and state management.
Suggested labels
🌟improvement
Suggested reviewers
- SatishGandham
- aaryan610
🐇 In the editor's realm, changes abound,
With headings and images, new joy is found.
No more markings to weigh us down,
Just a streamlined path for all around.
Hooray for the code, let the features bloom,
As we hop through the edits, dispelling the gloom! 🌼✨
Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL
Commits
Files that changed from the base of the PR and between 361ef9236e412ced80ddd9c6bc7a80e68abe9183 and 36c096a69be408266d8d40dfb09f699fbafbae65.
Files selected for processing (17)
- packages/editor/src/core/components/menus/menu-items.ts (1 hunks)
- packages/editor/src/core/extensions/drop.tsx (1 hunks)
- packages/editor/src/core/extensions/extensions.tsx (2 hunks)
- packages/editor/src/core/extensions/headers.ts (1 hunks)
- packages/editor/src/core/extensions/index.ts (1 hunks)
- packages/editor/src/core/extensions/read-only-extensions.tsx (2 hunks)
- packages/editor/src/core/extensions/table/table/utilities/create-cell.ts (1 hunks)
- packages/editor/src/core/extensions/table/table/utilities/get-table-node-types.ts (1 hunks)
- packages/editor/src/core/hooks/use-editor.ts (1 hunks)
- packages/editor/src/core/hooks/use-read-only-editor.ts (1 hunks)
- packages/editor/src/core/types/editor.ts (1 hunks)
- web/core/components/pages/editor/editor-body.tsx (5 hunks)
- web/core/components/pages/editor/header/mobile-root.tsx (0 hunks)
- web/core/components/pages/editor/header/root.tsx (2 hunks)
- web/core/components/pages/editor/page-root.tsx (3 hunks)
- web/core/components/pages/editor/summary/content-browser.tsx (2 hunks)
- web/core/components/pages/editor/summary/popover.tsx (4 hunks)
Files not reviewed due to no reviewable changes (1)
- web/core/components/pages/editor/header/mobile-root.tsx
Files skipped from review due to trivial changes (3)
- packages/editor/src/core/extensions/drop.tsx
- packages/editor/src/core/extensions/table/table/utilities/create-cell.ts
- packages/editor/src/core/extensions/table/table/utilities/get-table-node-types.ts
Additional comments not posted (29)
packages/editor/src/core/extensions/index.ts (1)
22-22: LGTM!Re-exporting the
./headersmodule from thisindex.tsfile aligns with the PR objectives and follows a common pattern for organizing related modules. It improves code maintainability and makes the necessary functions and types accessible to other parts of the application.Just a friendly reminder to ensure that the
./headersmodule is well-tested, as any issues within that module could propagate to other parts of the codebase that rely on these exports.packages/editor/src/core/extensions/headers.ts (1)
1-57: Excellent implementation of the HeadingListExtension!The code segment demonstrates a well-structured and logical approach to managing headings in a ProseMirror editor. Here are the key aspects of the implementation:
The
IMarkinginterface clearly defines the structure of a heading element, including its type, level, text, and sequence number.The extension maintains a storage object to hold the array of headings, ensuring that the state is properly managed within the extension.
The core functionality is implemented through a ProseMirror plugin that appends a transaction whenever the document state changes. This approach effectively captures changes in the editor's content.
The plugin iterates through the document's nodes, correctly identifying heading nodes and collecting their data, including the heading level, text content, and a sequence number based on the heading level.
Emitting an update event after updating the headings storage allows other components to react to changes in the heading list, ensuring that the page outline reflects changes in real-time.
The
getHeadings()method provides a convenient way for other components to retrieve the latest heading data, addressing the case where the editor may not emit an update upon initial rendering.Overall, the extension solves the problem of keeping the heading list in sync with the editor's content effectively. The code is clean, readable, and follows best practices.
web/core/components/pages/editor/summary/content-browser.tsx (4)
1-2: LGTM!The imports are necessary for the component to manage its own state, side effects, and interact with the editor.
13-24: Great job on refactoring the headings management!The component now maintains its own state for
headingsand stays in sync with the editor's headings through the effect. The effect also initializes the headings on the first render and cleans up the subscription when the component unmounts. This enhances the component's encapsulation and responsiveness to changes in the editor's content.
42-43: LGTM!The rendering logic now relies on the
headingsstate instead of themarkingsprop, ensuring that the component reflects the current state of the editor's headings dynamically. The component also renders a placeholder message when there are no headings.
8-10: Good catch on removing the unused prop!The removal of the
markingsprop is consistent with the refactor of headings management. The component no longer relies on this prop and instead maintains its own state forheadings.web/core/components/pages/editor/summary/popover.tsx (4)
5-5: LGTM!The import statement is correct and aligns with the PR objective of using the editor ref to fetch headings.
19-19: LGTM!The destructuring is correct and aligns with the removal of the
markingsprop as mentioned in the AI-generated summary. TheeditorRefprop is correctly passed to thePageContentBrowsercomponent.
56-56: LGTM!The
editorRefprop is correctly passed to thePageContentBrowsercomponent, and the removal of themarkingsprop aligns with the AI-generated summary.
68-68: LGTM!The
editorRefprop is correctly passed to thePageContentBrowsercomponent.packages/editor/src/core/extensions/read-only-extensions.tsx (2)
22-22: LGTM!The import statement for
HeadingListExtensionis syntactically correct and aligns with the PR objectives to introduce support for heading lists in the read-only editor.
112-112: Verify theHeadingListExtensionfunctionality.The addition of
HeadingListExtensionto theCoreReadOnlyEditorExtensionsexport is syntactically correct and aligns with the PR objectives to introduce support for heading lists in the read-only editor.To ensure the extension functions as intended, please verify the following:
- The extension subscribes to updates from the editor using the
editorRef.onHeadingChangefunction to calculate headings based on the latest content.- The extension provides the
editorRef.getHeadings()function to retrieve the latest headings list directly, even if the editor was initialized some time ago.- The extension emits an update event with the latest list of headings whenever content changes occur, as custom events are not supported in the current framework (tiptop).
Run the following script to verify the extension functionality:
Verification successful
Verification of
HeadingListExtensionfunctionality complete.The
HeadingListExtensionhas been successfully implemented and integrated into the editor. Based on the codebase analysis, we can confirm:
The extension subscribes to updates from the editor using the
onHeadingChangefunction, which is implemented in bothuse-read-only-editor.tsanduse-editor.ts. It uses the "update" event to calculate headings based on the latest content.While we couldn't find a direct implementation of
getHeadings(), it is referenced in theEditorReadOnlyRefApiinterface ineditor.ts, suggesting its existence. The headings are stored ineditorRef.current?.storage.headingList.headings, which is likely whatgetHeadings()returns.The extension emits an update event with the latest list of headings whenever content changes occur. This is implemented in the
headers.tsfile:this.editor.emit("update", { editor: this.editor, transaction: newState.tr });The implementation aligns with the PR objectives and provides the necessary functionality for handling heading lists in the read-only editor.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `HeadingListExtension` functionality. # Test 1: Search for the usage of `editorRef.onHeadingChange`. Expect: At least one occurrence. rg --type typescript -A 5 $'editorRef.onHeadingChange' # Test 2: Search for the definition of `editorRef.getHeadings`. Expect: At least one occurrence. ast-grep --lang typescript --pattern $'function getHeadings($$$) { $$$ }' # Test 3: Search for the emission of the update event with the latest list of headings. Expect: At least one occurrence. rg --type typescript -A 5 $'this.editor.emit("update", { editor: this.editor, transaction: newState.tr })'Length of output: 462
Script:
#!/bin/bash # Description: Verify the `HeadingListExtension` functionality (revised). # Test 1: Search for the usage of `onHeadingChange`. Expect: At least one occurrence. rg --type ts -A 5 'onHeadingChange' # Test 2: Search for the definition of `getHeadings`. Expect: At least one occurrence. ast-grep --lang typescript --pattern 'function getHeadings' # Test 3: Search for the emission of the update event. Expect: At least one occurrence. rg --type ts -A 5 'emit\("update"' # Test 4: Search for the HeadingListExtension class or function. Expect: At least one occurrence. rg --type ts -A 10 'HeadingListExtension'Length of output: 6094
web/core/components/pages/editor/header/root.tsx (3)
2-2: LGTM!The import statement for
EditorReadOnlyRefApiandEditorRefApiis correct and necessary for the component's functionality.
48-62: LGTM!The conditional rendering of
PageSummaryPopoverbased on the editor's readiness state is implemented correctly. The props passed to the component and the conditional class names for the containingdivare appropriate and necessary for the desired functionality.
1-1: Verify the impact of removing themarkingsprop.The removal of the
markingsprop from the component's props and its usage within the component, particularly in thePageSummaryPopover, suggests a change in the component's responsibility and data requirements. While this change may simplify the component and improve performance, it's crucial to ensure that the removal of themarkingsprop does not break any functionality within thePageSummaryPopovercomponent or other parts of the application that may have relied on this data.Please run the following script to verify the impact of removing the
markingsprop:packages/editor/src/core/types/editor.ts (2)
28-28: LGTM!The
onHeadingChangemethod is a valuable addition to theEditorReadOnlyRefApitype. It enables subscribing to heading changes in the editor, which is crucial for updating the page outline in real-time as mentioned in the PR objectives.The method signature is well-defined, accepting a callback function that receives the updated headings array and returns a cleanup function for managing the subscription.
29-29: Looks good!Introducing the
getHeadingsmethod in theEditorReadOnlyRefApitype is a thoughtful addition. It provides a direct way to retrieve the current headings state, which is particularly useful when the editor may not emit an update event during initialization.By returning an array of
IMarkingobjects, it maintains consistency with theonHeadingChangecallback and allows components to access the latest headings list whenever needed.packages/editor/src/core/hooks/use-read-only-editor.ts (2)
92-103: LGTM! Verify the assumption about the editor's storage.The
onHeadingChangemethod correctly subscribes to the "update" event and invokes the provided callback with the current list of headings. The cleanup function ensures that the event listener is removed when the component unmounts, preventing memory leaks.Verify that the editor's storage has a
headingListproperty with aheadingsarray. Run the following script to check:
104-106: LGTM! Verify the assumption about the editor's storage.The
getHeadingsmethod provides a simple way to retrieve the current list of headings from the editor's storage.Verify that the editor's storage has a
headingListproperty with aheadingsarray. Run the following script to check:Verification successful
To ensure our search command is working correctly and we're looking in the right places, let's try a more general search first, then narrow it down to editor-related files. We'll use
rg(ripgrep) for this search.
Let's try a broader search to find where the editor's storage or headings are being accessed or modified. We'll focus on editor-related directories and use more general terms.
Let's try a different approach using
findandgrepto search for the relevant information in the editor package.
Verified: The
headingListproperty andheadingsarray exist in the editor's storageThe search results confirm that the editor's storage structure matches the assumption in the original review comment. Specifically:
- The
headingListproperty exists in the editor's storage.- The
headingsarray is accessed viastorage.headingList.headings.- A
getHeadingsmethod is implemented, which returnseditorRef?.current?.storage.headingList.headings.This implementation is consistent across both the regular editor (
use-editor.ts) and the read-only version (use-read-only-editor.ts). TheheadingListextension, defined inheaders.ts, initializes and manages the headings storage.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the editor's storage has a `headingList` property with a `headings` array. # Test: Search for the `headingList` property in the editor's storage. Expect: At least one occurrence. rg --type typescript -A 5 $'headingList' $(fd --type file --extension ts --exclude node_modules) # Test: Search for the `headings` property in the `headingList` object. Expect: At least one occurrence. rg --type typescript -A 5 $'headingList.headings' $(fd --type file --extension ts --exclude node_modules)Length of output: 80484
Script:
#!/bin/bash # Search for 'editor' to verify the command is working and we're searching the right files echo "Searching for 'editor':" rg --type typescript 'editor' $(fd --type file --extension ts --exclude node_modules) # If the above search works, search for 'editorRef' which is used in the code snippet echo "\nSearching for 'editorRef':" rg --type typescript 'editorRef' $(fd --type file --extension ts --exclude node_modules) # If we find 'editorRef', search for 'storage' nearby echo "\nSearching for 'editorRef' and 'storage' in the same file:" rg --type typescript -C 5 'editorRef.*storage' $(fd --type file --extension ts --exclude node_modules)Length of output: 120982
Script:
#!/bin/bash # Search for 'editor' and 'storage' in the same file, focusing on editor-related directories echo "Searching for 'editor' and 'storage' in editor-related files:" rg --type typescript -C 5 'editor.*storage' packages/editor/src # Search for 'heading' or 'outline' in editor-related files echo "\nSearching for 'heading' or 'outline' in editor-related files:" rg --type typescript -e 'heading' -e 'outline' packages/editor/src # Search for any methods or properties related to getting headings or outline echo "\nSearching for methods or properties related to headings or outline:" rg --type typescript -e 'getHeadings' -e 'getOutline' -e 'headingList' packages/editor/srcLength of output: 765
Script:
#!/bin/bash # Search for 'editor' and 'storage' in the same file echo "Searching for 'editor' and 'storage' in editor-related files:" find packages/editor/src -type f -name "*.ts" -o -name "*.tsx" | xargs grep -n -C 3 "editor.*storage" # Search for 'heading' or 'outline' in editor-related files echo "\nSearching for 'heading' or 'outline' in editor-related files:" find packages/editor/src -type f -name "*.ts" -o -name "*.tsx" | xargs grep -n -E "heading|outline" # Search for methods or properties related to getting headings or outline echo "\nSearching for methods or properties related to headings or outline:" find packages/editor/src -type f -name "*.ts" -o -name "*.tsx" | xargs grep -n -E "getHeadings|getOutline|headingList"Length of output: 25136
packages/editor/src/core/extensions/extensions.tsx (2)
22-22: LGTM!The addition of
HeadingListExtensionto the import statement is necessary to make the extension available for use in theCoreEditorExtensionsarray. This aligns with the PR objective of enabling real-time updates to headings in the editor.
170-170: Verify the functionality ofHeadingListExtension.The addition of
HeadingListExtensionto theCoreEditorExtensionsarray is necessary to enable its functionality in the editor. This aligns with the PR objective of enabling real-time updates to headings in the editor.Please verify that the
HeadingListExtensionis working as expected by testing the following scenarios:
- Make changes to headings in the editor and ensure that the page outline reflects the changes in real-time.
- Verify that the
editorRef.onHeadingChangefunction is being called with the updated headings list whenever changes occur.- Confirm that the
editorRef.getHeadings()function returns the latest headings list, even if the editor was initialized some time ago.Run the following script to navigate to the relevant files and test the functionality:
Verification successful
HeadingListExtension functionality verified
The
HeadingListExtensionhas been successfully integrated into the editor and appears to be functioning as intended. Key findings:
- The extension is properly included in both core and read-only extensions.
- It provides storage for headings and a
getHeadingsmethod.- The
onHeadingChangeandgetHeadingsfunctions are correctly implemented in the editor hooks.- Real-world usage is demonstrated in the
content-browser.tsxcomponent, which utilizes both functions for updating and retrieving headings.The implementation supports real-time updates to headings in the editor, aligning with the PR objectives. The
onHeadingChangefunction subscribes to editor updates, ensuring that heading changes are reflected immediately.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the functionality of `HeadingListExtension`. # Test 1: Search for the usage of `HeadingListExtension` in the codebase. # Expect: Usage in relevant components that display the page outline. rg --type typescript -A 5 $'HeadingListExtension' # Test 2: Search for the usage of `editorRef.onHeadingChange` in the codebase. # Expect: Usage in relevant components that subscribe to heading changes. rg --type typescript -A 5 $'editorRef.onHeadingChange' # Test 3: Search for the usage of `editorRef.getHeadings` in the codebase. # Expect: Usage in relevant components that retrieve the latest headings list. rg --type typescript -A 5 $'editorRef.getHeadings'Length of output: 257
Script:
#!/bin/bash # Description: Verify the functionality of HeadingListExtension # Search for HeadingListExtension usage echo "Searching for HeadingListExtension usage:" fd -e ts -e tsx | xargs rg -n -A 5 "HeadingListExtension" echo "\nSearching for onHeadingChange references:" fd -e ts -e tsx | xargs rg -n -A 5 "onHeadingChange" echo "\nSearching for getHeadings references:" fd -e ts -e tsx | xargs rg -n -A 5 "getHeadings"Length of output: 6893
web/core/components/pages/editor/page-root.tsx (1)
136-144: Verify that thePageEditorBodycomponent has been updated to handle headings calculation and updates.The removal of the
markingsandupdateMarkingsprops aligns with the PR objective of calculating headings within the editor after initialization and subscribing to updates usingeditorRef.onHeadingChange. However, please ensure that:
- The
PageEditorBodycomponent has been updated to internally handle the calculation and updating of headings usingeditorRef.onHeadingChange.- The removal of the
markingsandupdateMarkingsprops does not introduce any unintended side effects or break the real-time reflection of changes in the editor.Run the following script to verify the
PageEditorBodycomponent:packages/editor/src/core/components/menus/menu-items.ts (1)
195-195: LGTM! The expanded check improves the accuracy of the active state for image-related functionalities.The modification to the
isActiveproperty of theImageItemfunction is a positive change that aligns with the PR objective. By checking for both the "image" and "imageComponent" commands, it ensures that theImageItemmore accurately reflects the active state of image-related functionalities in the editor.This improvement can potentially enhance the user experience by providing a more intuitive and responsive UI for image handling. The change is localized and does not appear to have any negative impact on other parts of the code.
web/core/components/pages/editor/editor-body.tsx (4)
41-41: Verify the impact of prop changes on the component.The addition of
editorReadyand removal ofmarkingsprops seem to be part of a larger refactor. Please ensure that:
- The component's behavior is correctly influenced by the
editorReadystate.- The logic that previously depended on
markingshas been appropriately refactored.
70-70: LGTM!The code segment deriving various values looks good. The logic is correct and there are no apparent issues.
103-103: LGTM!The
handleServerErrorcallback looks good. It correctly sets the connection status totrueon server errors and is memoized usinguseCallback.
140-140: Verify the impact of changes onPageContentBrowser.The changes to the
PageContentBrowsercomponent seem to be part of a larger refactor. Please ensure that:
- The conditional rendering based on
isFullWidthprovides the desired user experience.- The
PageContentBrowsercorrectly interacts with the appropriate editor ref based on theisContentEditablestate.- The removal of
markingsprop has been appropriately handled within thePageContentBrowsercomponent.packages/editor/src/core/hooks/use-editor.ts (2)
157-168: LGTM!The
onHeadingChangefunction is implemented correctly and follows best practices:
- It allows subscribing to heading changes by providing a callback.
- It subscribes to the "update" event emitted by the editor to listen for changes.
- It invokes the callback with the current list of headings whenever an update occurs.
- It returns a cleanup function to unsubscribe from the event when the component unmounts, preventing memory leaks.
The code is well-structured and maintains a consistent indentation style.
169-171: LGTM!The
getHeadingsfunction is implemented correctly:
- It provides a straightforward way to retrieve the current list of headings from the editor's storage.
- It directly accesses the
headingList.headingsproperty to get the headings.- The code is concise and easy to understand.
This function enhances the accessibility of heading information within the editor's context.
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?
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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.