feat(spx-gui): monitor target/property select#2859
Conversation
Summary of ChangesHello @cn0809, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly upgrades the functionality of monitor widgets by allowing users to select specific targets (stage or sprites) and their associated properties for display. This change involves a complete overhaul of the monitor's configuration UI, transitioning from a simple text input to interactive dropdowns for target and property selection. Under the hood, it integrates with the Language Server Protocol to dynamically retrieve available properties and ensures that the monitor's data model and rendering adapt seamlessly to these new capabilities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to select a target (stage or sprite) and a property for monitor widgets. The changes are well-implemented across the data model, UI components, and LSP client. A custom LSP notification for property renaming is also included. The related UISelect component has been enhanced to support asynchronously loaded options, which is a great improvement. I have one suggestion to improve code robustness.
There was a problem hiding this comment.
Pull request overview
This PR implements monitor target and property selection functionality for the SPX GUI, addressing issue #2820. The changes enable monitors to watch properties on specific sprites or the stage, with UI support for selecting targets and properties dynamically loaded from the language server.
Changes:
- Added
targetfield to Monitor model to distinguish between stage (empty string) and sprite properties - Implemented UI components for selecting monitor target (stage/sprite) and property with LSP-based property lookup
- Added automatic synchronization when sprites or properties are renamed to maintain referential integrity
- Enhanced monitor rendering to handle empty labels and display target prefix in property values
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/spxls/go.mod | Updated xgolsw dependency to version with property support |
| tools/spxls/go.sum | Updated checksums for xgolsw dependency |
| spx-gui/src/models/spx/widget/monitor.ts | Added target field to Monitor model with getter/setter and updated export/import logic |
| spx-gui/src/components/ui/select/UISelect.vue | Added MutationObserver to handle async-loaded options in select component |
| spx-gui/src/components/editor/stage/widget/detail/MonitorDetail.vue | Implemented target and property selection UI with LSP-based property loading |
| spx-gui/src/components/editor/preview/stage-viewer/widgets/MonitorNode.vue | Updated monitor rendering to handle empty labels and show target prefix in values |
| spx-gui/src/components/editor/preview/EditorPreview.vue | Added validation for monitor configuration before running project |
| spx-gui/src/components/editor/common/viewer/quick-config/utils.ts | Exposed target getter in WidgetLocalConfig for rendering |
| spx-gui/src/components/editor/code-editor/lsp/spxls/notifications.ts | Defined propertyRenamed notification type from LSP |
| spx-gui/src/components/editor/code-editor/lsp/spxls/commands.ts | Added getProperties command type for LSP |
| spx-gui/src/components/editor/code-editor/lsp/index.ts | Implemented property renamed notification handler and getProperties method |
| spx-gui/src/components/editor/code-editor/common.ts | Added Property and PropertiesTarget types with lspStageTarget constant |
| spx-gui/src/components/editor/code-editor/code-editor.ts | Exposed getProperties method in CodeEditor API |
| spx-gui/src/components/asset/index.ts | Added monitor target update when sprite is renamed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| require ( | ||
| github.com/goplus/builder/tools/ai v0.0.0 | ||
| github.com/goplus/xgolsw v0.16.1 | ||
| github.com/goplus/xgolsw v0.16.2-0.20260226010849-bc7e940eb027 |
There was a problem hiding this comment.
Mark: 等 xgolsw 发布正式版本后这里更新到正式版本再合入
|
/review |
|
/review |
| position: toLSPPosition(position), | ||
| newName | ||
| } | ||
| ) |
There was a problem hiding this comment.
Concurrent rename race condition
onceEvent('propertyRenamed', ...) is registered before the rename request. If two rename() calls are in-flight concurrently, the second call's listener could fire on the first rename's notification (or vice versa), silently updating the wrong monitor's variable name.
Consider either serializing rename calls or associating notifications with a request correlation ID. At minimum, document that rename() must not be called concurrently.
|
Good implementation overall — the target/property select UX is clean, legacy |
| lspClient.onPropertyRenamed(({ target, oldName, newName }) => { | ||
| for (const widget of spxProject.stage.widgets) { | ||
| if (widget.type === 'monitor' && widget.target === target && widget.variableName === oldName) { | ||
| widget.setVariableName(newName) |
There was a problem hiding this comment.
如 #2859 (comment) 所述,建议这里补充注释,说明为什么这里不需要用 action 包
|
#2930 好像把这个 PR 依赖的 xgolsw、spx 改动带进来了?是的话这个 PR 应该可以直接 merge 了 |
那个 PR 里 xgolsw、spx 不是正式版本,要等正式版本发布了在这个 PR 里更新下吗 |
等那俩发正式版本再单独提 PR 更新吧 |
close: #2820