Skip to content

Conversation

@ManlyMarco
Copy link
Owner

No description provided.

@ManlyMarco ManlyMarco requested a review from Copilot October 28, 2025 01:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the context menu system by extracting the MenuEntry struct into a separate ContextMenuEntry class and updating the API to support MemberInfo parameters. The refactoring distributes context menu registration across individual feature classes rather than centralizing it in the ContextMenu class.

Key changes:

  • Extracted MenuEntry to a new ContextMenuEntry class with updated API signature
  • Moved context menu entry registration from centralized initialization to individual feature classes
  • Changed MenuContents from instance to static property for easier access across features

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
RuntimeUnityEditor.Core/Features/ContextMenuEntry.cs New file defining the extracted ContextMenuEntry struct with MemberInfo support
RuntimeUnityEditor.Core/Features/ContextMenu.cs Refactored to use new ContextMenuEntry, removed MenuEntry definition and centralized menu registration
RuntimeUnityEditor.Core/Windows/REPL/REPLWindow.cs Added "Send to REPL" context menu entry registration
RuntimeUnityEditor.Core/Windows/ObjectView/ObjectViewWindow.cs Added preview and event details context menu entry registrations
RuntimeUnityEditor.Core/Windows/ObjectTree/ObjectTreeViewer.cs Added find in object tree and find references context menu entry registrations
RuntimeUnityEditor.Core/Windows/Inspector/Inspector.cs Added "Send to inspector" context menu entry registration
RuntimeUnityEditor.Core/Windows/Clipboard/ClipboardWindow.cs Added copy to clipboard context menu entry registration
RuntimeUnityEditor.Core/Windows/Breakpoints/BreakpointsWindow.cs Moved breakpoint context menu registration from ContextMenu to BreakpointsWindow
RuntimeUnityEditor.Core/Utils/Abstractions/DnSpyHelper.cs Added dnSpy-related context menu entry registrations
RuntimeUnityEditor.Bepin5/PatchInspector/PatchInspector.cs Added harmony patch management context menu entry registrations
RuntimeUnityEditor.Core/RuntimeUnityEditor.Core.projitems Added ContextMenuEntry.cs to project compilation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

MinimumSize = new Vector2(250, 100);
DefaultScreenPosition = ScreenPartition.LeftUpper;

ContextMenu.MenuContents.Add(new ContextMenuEntry("Copy to clipboard", null, (o, info, name) => { if (Contents.LastOrDefault() != (o ?? info)) Contents.Add(o ?? info); }));
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The inline lambda is complex with nested logic (o ?? info used twice) and the condition check. Consider extracting this to a named method for better readability and testability.

Copilot uses AI. Check for mistakes.
@ManlyMarco ManlyMarco changed the title Refactor ContextMenu API and usages Refactor ContextMenu API and usages (breaking API change) Oct 28, 2025
@ManlyMarco ManlyMarco merged commit 3912b61 into master Oct 28, 2025
@ManlyMarco ManlyMarco deleted the ctx branch October 28, 2025 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants