Skip to content

Class-framework-agnostic code editor#2858

Merged
nighca merged 1 commit intogoplus:devfrom
nighca:issue-2803
Mar 10, 2026
Merged

Class-framework-agnostic code editor#2858
nighca merged 1 commit intogoplus:devfrom
nighca:issue-2803

Conversation

@nighca
Copy link
Collaborator

@nighca nighca commented Feb 25, 2026

close #2803.

Extracts a class-framework-agnostic XGo code editor core and re-builds the SPX editor integration on top of it, including updated highlighting/language IDs and several new editor UI subsystems (completion/hover/diagnostics/context menu/etc.). This aligns Builder’s editor architecture with the need to support multiple XGo class frameworks (issue #2803).

Changes:

  • Introduce xgo-code-editor (framework-agnostic core) and spx-code-editor (SPX adapter/wrapper) modules.
  • Move XGo identifier/name utilities and syntax highlighting assets from spx utils to xgo, and switch default highlight language to xgo.
  • Update editor/coprocessor integrations (Copilot MCP tools, tutorial/copilot context injection, resource typing refactors).

@gemini-code-assist
Copy link

Summary of Changes

Hello @nighca, 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 introduces a major architectural overhaul to generalize the Code Editor module, making it adaptable to various XGo class frameworks beyond just SPX. This is achieved by establishing clear interfaces, implementing dependency injection, and isolating framework-specific logic. A significant focus is also placed on improving project persistence, with robust serialization and deserialization capabilities for AI-generated assets and their states, allowing for seamless saving and loading of projects even mid-generation. The project loading mechanism itself has been fortified to intelligently manage local cache and cloud data, enhancing overall data integrity and user experience.

Highlights

  • Code Editor Generalization: The Code Editor module has been refactored to be framework-agnostic, separating core logic from SPX-specific implementations through new interfaces and dependency injection. This allows for easier integration of other XGo class frameworks.
  • Project Persistence & Loading: The project loading mechanism in the Editing module has been significantly enhanced to handle local cache and cloud data more robustly, including versioning and owner/name conflict resolution. This ensures data integrity and a smoother user experience during project retrieval.
  • AI-Generated Asset State Management: Asset generation classes (AnimationGen, BackdropGen, CostumeGen, SpriteGen) now support full serialization and deserialization of their states, including ongoing tasks and phases. This enables saving and loading of projects with active AI generation processes, allowing users to resume work seamlessly.
  • Refactored Asset Generation Logic: The Phase and Task classes, central to AI generation, have been updated to support serialization and deserialization. The Task class no longer automatically cancels previous tasks on start(), providing more control over task lifecycle. AnimationGen's extractFrames step is now integrated into finish().
  • Improved File Loading Robustness: The File loading mechanism has been improved to gracefully handle scenarios where concurrent loading calls are aborted, ensuring that subsequent requests are not negatively impacted.
  • Increased Asset Name Length: The maximum length for normalized asset names (e.g., for sprites, costumes, animations) has been increased from 20 to 50 characters, providing more flexibility for naming.

🧠 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
  • docs/develop/generalization/code-editor.md
    • Added a detailed design document outlining the impact analysis and work plan for generalizing the code editor.
  • docs/develop/generalization/project.md
    • Added a detailed design document explaining the generalization of the project model, including the IProject interface and model reorganization.
  • spx-gui/AGENTS.md
    • Updated test command example to include npx vitest.
  • spx-gui/src/components/agent-copilot/CopilotProvider.vue
    • Modified project saving logic to export the project first, then save the serialized data to the cloud, and finally update metadata.
  • spx-gui/src/components/asset/gen/animation/AnimationGenItem.vue
    • Updated isAnimationLoading to check finishState.status instead of extractFramesState.status.
  • spx-gui/src/components/asset/gen/animation/AnimationGenPreview.vue
    • Removed extractFrames call and related state resets, simplifying the save animation flow to directly call finish().
  • spx-gui/src/components/asset/gen/animation/AnimationSettingsInput.vue
    • Updated computed properties disabled and submitDisabled to reflect changes in animation generation phases, replacing isExtractingFrames with isFinishing.
  • spx-gui/src/components/asset/gen/backdrop/BackdropGen.vue
    • Refactored image selection to use imageIndex instead of image object directly, and updated preview logic.
  • spx-gui/src/components/asset/gen/common/ImageSelector.vue
    • Modified selected prop type from File | null to number | null and select event to emit number (index) instead of File.
  • spx-gui/src/components/asset/gen/sprite/SpriteGen.vue
    • Updated EditorState instantiation to pass i18n and modified editorStateInGen to correctly initialize.
  • spx-gui/src/components/asset/gen/sprite/SpriteGenPhaseSettings.vue
    • Refactored image selection to use imageIndex instead of image object directly, and updated preview logic.
  • spx-gui/src/components/asset/index.ts
    • Updated asset generation handling to use editorCtx.state.genState for adding and getting positions of sprite and backdrop generations.
  • spx-gui/src/components/copilot/CopilotRoot.vue
    • Modified project loading to first load serialized data from cloud, then load it into the SpxProject instance.
  • spx-gui/src/components/editor/ProjectEditor.vue
    • Updated project saving logic for adding sprites and backdrops to export the project first, then save the serialized data to the cloud, and finally update metadata.
  • spx-gui/src/components/editor/code-editor/context.ts
    • Removed SpxProject from useProvideCodeEditorCtx parameters and updated CodeEditor instantiation to use editorState.project.
  • spx-gui/src/components/editor/editing.test.ts
    • Updated makeCloudHelper and makeLocalCache mocks to return ProjectSerialized objects.
    • Adjusted cloudHelper.save and localCacheHelper.save implementations.
    • Removed mode parameter from makeEditing.
    • Renamed start() to startEditing().
    • Added comprehensive tests for Editing.loadProject covering various cache and cloud scenarios.
  • spx-gui/src/components/editor/editing.ts
    • Refactored Saving class to export and save ProjectSerialized instead of IProject directly.
    • Updated Editing constructor to determine mode based on signedInUsername and project.owner.
    • Added loadProject method to Editing for robust project loading with local cache and cloud synchronization logic.
  • spx-gui/src/components/editor/editor-state.test.ts
    • Updated makeCloudHelpers mocks to return ProjectSerialized objects.
    • Updated makeEditorState to pass i18n instance.
  • spx-gui/src/components/editor/editor-state.ts
    • Introduced SpxProjectWithGens class to compose SpxProject and GenState into IProject.
    • Refactored EditorState constructor to accept i18n and initialize History and GenState.
    • Removed direct spriteGens and backdropGens management, delegating to GenState.
    • Removed genCollapsePosProviderMap and related methods.
  • spx-gui/src/components/editor/gen.test.ts
    • Added new test file for GenState to verify sprite and backdrop name validation and conflict resolution.
  • spx-gui/src/components/editor/gen.ts
    • Added new file gen.ts which introduces GenState class to manage asset generations (sprites and backdrops), including name validation, adding/removing generations, and handling their positions.
    • Implemented load and export methods for serialization within GenState.
  • spx-gui/src/components/editor/navbar/EditorNavbar.vue
    • Updated project import/export logic to handle ProjectSerialized objects instead of IProject directly.
  • spx-gui/src/components/editor/sprite/SpriteList.vue
    • Updated onBeforeUnmount to use editorCtx.state.genState.registerSpritePosProvider.
    • Updated list computed property to use editorCtx.state.genState.sprites.
    • Updated handleSpriteGenClick to use editorCtx.state.genState.removeSprite.
  • spx-gui/src/components/project/ProjectCreateModal.vue
    • Modified project creation and saving to export the project to ProjectSerialized before saving to cloud.
  • spx-gui/src/components/project/ProjectPublishModal.vue
    • Modified project publishing to export the project to ProjectSerialized before saving to cloud.
  • spx-gui/src/components/project/index.ts
    • Modified makePrivate function to export the project to ProjectSerialized before saving to cloud.
  • spx-gui/src/models/common/cloud.ts
    • Refactored CloudHelpers to work with ProjectSerialized objects directly for load and save methods, removing direct IProject dependency.
  • spx-gui/src/models/common/file.test.ts
    • Enhanced File loading tests to include scenarios where concurrent calls are aborted but the loader is not immediately responsive, ensuring subsequent loads work correctly.
  • spx-gui/src/models/common/file.ts
    • Added aborted getter to Loading class.
    • Updated File.arrayBuffer to check loading.aborted to avoid waiting for already aborted loads.
  • spx-gui/src/models/common/local.ts
    • Refactored LocalHelpers to work with ProjectSerialized objects directly for load and save methods, removing direct IProject dependency.
  • spx-gui/src/models/common/test.ts
    • Updated MockProject's export and load methods to work with ProjectSerialized objects.
    • Added sndConfig and sndFiles helper functions for serialization/deserialization in tests.
  • spx-gui/src/models/common/xbp.test.ts
    • Updated save and load tests to work with ProjectSerialized objects.
  • spx-gui/src/models/common/xbp.ts
    • Refactored XbpHelpers to work with ProjectSerialized objects directly for load and save methods, removing direct IProject dependency.
  • spx-gui/src/models/project.ts
    • Introduced ProjectSerialized type.
    • Updated IProject interface methods load and export to use ProjectSerialized type.
    • Added TODO comments for exportFiles.
  • spx-gui/src/models/spx/animation.test.ts
    • Updated animation tests to use ProjectSerialized for loading projects.
  • spx-gui/src/models/spx/backdrop.ts
    • Added assetPath option to BackdropExportLoadOptions.
    • Updated Backdrop.load and Backdrop.export to use assetPath.
  • spx-gui/src/models/spx/common/asset-name.ts
    • Increased normalizeAssetName truncation length from 20 to 50 characters.
  • spx-gui/src/models/spx/gen/aigc-mock.ts
    • Refactored MockAigcApis to include subscribers for tasks, processTask for event handling, and registerTaskHandler for custom task logic.
    • Updated createTask, cancelTask, and subscribeTaskEvents to use this new event-driven model.
  • spx-gui/src/models/spx/gen/animation-gen.test.ts
    • Updated animation generation tests to reflect changes in AnimationGen's constructor and phase management (removed extractFrames as a separate step).
    • Added extensive tests for AnimationGen serialization/deserialization at various stages (running enrich, finished generateVideo, finished finish, running generateVideo, running finish).
  • spx-gui/src/models/spx/gen/animation-gen.ts
    • Refactored AnimationGen to remove extractFrames as a separate phase, integrating its logic into finish().
    • Added restoreGenerateVideoTask and restoreExtractFramesTask for resuming tasks.
    • Implemented export and static load methods for serialization/deserialization of AnimationGen state, including nested tasks and phases.
  • spx-gui/src/models/spx/gen/backdrop-gen.test.ts
    • Updated backdrop generation tests to reflect changes in BackdropGen's constructor and image selection (setImageIndex).
    • Added tests for BackdropGen serialization/deserialization at various stages (running enrich, finished enrich, finished genImages, finished finish, running genImages) and loadAll.
  • spx-gui/src/models/spx/gen/backdrop-gen.ts
    • Refactored BackdropGen to use imageIndex instead of image directly.
    • Added parent property and updated setName and setSettings to use it for name validation.
    • Added restoreGenerateTask for resuming tasks.
    • Implemented export, static load, and static loadAll methods for serialization/deserialization of BackdropGen state.
  • spx-gui/src/models/spx/gen/common.test.ts
    • Updated Task tests to use the new MockAigcApis for more realistic task event handling.
    • Removed explicit apis parameter from Task constructor.
  • spx-gui/src/models/spx/gen/common.ts
    • Added PhaseSerialized and mapPhaseResult types for serialization.
    • Updated Phase class to include load and export methods, and modified track to directly update state.remaining to avoid re-exporting files.
    • Renamed taskRunDuration to taskDurations.
    • Updated Task class to include data in constructor, removed runDuration getter, and added load and export methods for serialization.
    • Removed this.tryCancel() from Task.start().
  • spx-gui/src/models/spx/gen/costume-gen.test.ts
    • Updated costume generation tests to reflect changes in CostumeGen's constructor.
    • Added extensive tests for CostumeGen serialization/deserialization at various stages (running enrich, finished enrich, finished generate, finished finish, running generate).
  • spx-gui/src/models/spx/gen/costume-gen.ts
    • Refactored CostumeGen constructor to accept inits object.
    • Added restoreGenerateTask for resuming tasks.
    • Implemented export and static load methods for serialization/deserialization of CostumeGen state.
  • spx-gui/src/models/spx/gen/sprite-gen.test.ts
    • Updated sprite generation tests to reflect changes in SpriteGen's constructor and image selection (setImageIndex).
    • Added tests for SpriteGen serialization/deserialization at various stages (initial, after enrich, after genImages, after prepareContent, with selectedItem, with finished nested gens, with running genImages task) and loadAll.
  • spx-gui/src/models/spx/gen/sprite-gen.ts
    • Refactored SpriteGen constructor to accept inits object.
    • Added parent property and updated setName and setSettings to use it for name validation.
    • Added restoreGenImagesTask for resuming tasks.
    • Implemented export, static load, and static loadAll methods for serialization/deserialization of SpriteGen state, including nested CostumeGen and AnimationGen instances.
  • spx-gui/src/models/spx/project.ts
    • Updated SpxProject.load and SpxProject.export to use the new ProjectSerialized type.
  • spx-gui/src/pages/community/project.vue
    • Modified project loading and liking/unliking to first load serialized data from cloud, then load it into the SpxProject instance.
  • spx-gui/src/pages/editor/index.vue
    • Updated LocalCache to work with ProjectSerialized.
    • Refactored project loading logic into stateQueryRet to use EditorState.editing.loadProject and removed the separate loadProject function.
    • Simplified checkChangesNotToBeSaved and handleBeforeUnload by removing checks for unfinished asset generations, as GenState now handles their persistence.
  • spx-gui/src/utils/spx/index.test.ts
    • Updated normalizeXGoIdentifierAssetName tests to reflect the increased truncation length from 20 to 50 characters.
  • spx-gui/src/utils/spx/index.ts
    • Increased normalizeXGoIdentifierAssetName truncation length from 20 to 50 characters.
  • spx-gui/src/widgets/spx-runner/SpxRunner.ce.vue
    • Modified project loading to first load serialized data from cloud, then load it into the SpxProject instance.
Activity
  • New design documents (code-editor.md, project.md) were added to outline the architectural changes for generalization.
  • Extensive refactoring was performed across multiple modules (editing, editor-state, gen, animation-gen, backdrop-gen, costume-gen, sprite-gen) to support the new generalized architecture and state serialization.
  • New test files and updated existing ones demonstrate the robustness of the new state management and serialization features for AI-generated assets.
  • The project loading and saving mechanisms were centralized and made more resilient, impacting how projects are handled in ProjectEditor, ProjectCreateModal, ProjectPublishModal, and community/project.vue.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot]

This comment was marked as outdated.

@@ -0,0 +1,14 @@
import { inject, provide, type InjectionKey } from 'vue'
Copy link
Collaborator Author

@nighca nighca Mar 4, 2026

Choose a reason for hiding this comment

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

从 CopilotRoot 中抽出来以避免可能的循环依赖;拆之前的 CopilotRoot 同时承载了

  1. copilot context 的定义(会被 app 中的其他业务逻辑依赖)
  2. 集成 app 中的其他业务逻辑(会依赖其他业务逻辑)

这两个角色,所以在 code-editor 统一对外的导出文件后会引入循环依赖

import { effectKinds } from '@/utils/spx'
import SpxEffectKindItem from './SpxEffectKindItem.vue'

defineProps<{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

不改变组件的行为,只是加上 props、emits 类型声明以匹配统一的 InputHelper Component 类型要求


export type SelectableResource = Exclude<ResourceModel, Stage>

// TODO: Merge with `IResourceSelector` in `xgo-code-editor` to simplify the codebase.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个先没调整,是因为这里对 items 和 useCreateMethods 的类型要求与 xgo-code-editor IResourceSelector 对二者的类型要求不同;前者是既有逻辑,后者是新增接口,但传递 resource 信息时要求 resource URI 而不是 resource(sprite 等)实例,要二者合并起来改动比较大,之后再看

* We temporarily disable encoding to keep things working, but we should fix the language server
* to do the encoding and re-enable this in the future.
*/
const shouldEncodeResourceName = false
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

相关:#2904

@@ -0,0 +1,37 @@
/**
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

之后 spx-code-editor 和 xgo-code-editor 两个模块与 components/ui 类似,视作相对独立的整体,对外导出统一到单个文件

/** `RotationStyle` in spx */
SpxRotationStyle = 'spx-rotation-style',
/** Resource name (`SpriteName`, `SoundName`, etc.) */
// TODO: Rename to `resource-name` or `xgo-resource-name` — the resource mechanism is spx-agnostic
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个字符串值后续应该改为 resource-name 或 xgo-resource-name,因为“resource”的机制是与 spx 无关的,spx resource 是 resource 的一种实现

@nighca nighca marked this pull request as ready for review March 5, 2026 05:20
Copilot AI review requested due to automatic review settings March 5, 2026 05:20
Copy link
Contributor

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

Extracts a class-framework-agnostic XGo code editor core and re-builds the SPX editor integration on top of it, including updated highlighting/language IDs and several new editor UI subsystems (completion/hover/diagnostics/context menu/etc.). This aligns Builder’s editor architecture with the need to support multiple XGo class frameworks (issue #2803).

Changes:

  • Introduce xgo-code-editor (framework-agnostic core) and spx-code-editor (SPX adapter/wrapper) modules.
  • Move XGo identifier/name utilities and syntax highlighting assets from spx utils to xgo, and switch default highlight language to xgo.
  • Update editor/coprocessor integrations (Copilot MCP tools, tutorial/copilot context injection, resource typing refactors).

Reviewed changes

Copilot reviewed 110 out of 186 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spx-gui/src/utils/xgo/index.ts New XGo identifier/keyword utilities extracted from SPX utils.
spx-gui/src/utils/xgo/index.test.ts Tests for XGo identifier name normalization.
spx-gui/src/utils/xgo/highlighter.ts Update Shiki language aliases to prefer xgo.
spx-gui/src/utils/spx/index.ts Remove XGo identifier helpers/keywords from SPX utils.
spx-gui/src/pages/editor/index.vue Wire code editor via spx-code-editor and register MCP tools via registry.
spx-gui/src/models/spx/project.ts Remove getResourceModel API (resource model typing refactor).
spx-gui/src/models/spx/gen/aigc-mock.ts Cleanup unused-vars eslint disables after config change.
spx-gui/src/models/spx/common/resource.ts Rename resource type alias and remove ResourceModelIdentifier helper.
spx-gui/src/models/spx/common/asset-name.ts Switch XGo identifier imports to @/utils/xgo.
spx-gui/src/components/tutorials/TutorialRoot.vue Use new Copilot context module.
spx-gui/src/components/tutorials/TutorialCourseSuccess.vue Use new Copilot context module.
spx-gui/src/components/editor/stage/StageEditor.vue Switch imports to spx-code-editor UI exports.
spx-gui/src/components/editor/sprite/SpriteEditor.vue Switch imports to spx-code-editor UI exports.
spx-gui/src/components/editor/runtime.ts Move TextDocumentRange import to xgo editor module.
spx-gui/src/components/editor/preview/EditorPreview.vue Use spx-code-editor API for diagnostics + code file naming.
spx-gui/src/components/editor/panels/ConsolePanel.vue Use spx-code-editor exports for CodeLink + document naming.
spx-gui/src/components/editor/editor-state.ts Update ResourceModel import to new resource module.
spx-gui/src/components/editor/common/EditorList.vue Update ResourceType typing import.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/snippet.ts New framework-agnostic snippet parser with provider-based variables.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/resource/index.ts Resource references controller refactor to IResourceProvider.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/markdown/index.ts Default markdown code fences now use xgo.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/markdown/ResourcePreview.vue Render resources via provider-defined renderer component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/markdown/InputValuePreview.vue New provider-driven input value preview rendering.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/markdown/DiagnosticItem.vue New diagnostic item UI building block.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/markdown/CodeBlock.vue New markdown code block renderer using CodeView.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/pen.svg New input-helper icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/index.ts Input helper controller refactor + re-exports of provider types.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/StringInput.vue New generic string input component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/ResourceInput.vue Resource input refactored to use IResourceProvider selector/renderer.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/IntegerInput.vue New generic integer input component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/InputHelperUI.vue Input helper UI now uses provider-defined type handlers.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/DecimalInput.vue New generic decimal input component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/input-helper/BooleanInput.vue Update boolean input emits to include submit.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/inlay-hint/index.ts Inlay-hint controller now re-exports core types from generic module.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/inlay-hint/InlayHintUI.vue New inlay hint decoration renderer.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/icons/zoom-reset.svg New zoom control icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/icons/zoom-out.svg New zoom control icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/icons/zoom-in.svg New zoom control icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/hover/index.ts Hover controller refactor to new generic hover provider types.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/hover/HoverUI.vue New hover dropdown UI and hovered-text decorations.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/hover/HoverCardContent.vue New hover content wrapper component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/hover/HoverCard.vue New hover card container + action buttons.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/hover/ActionButton.vue New hover action button component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/drop-indicator/index.ts Drop indicator controller refactor to UI-controller type.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/drop-indicator/DropIndicatorUI.vue New drop indicator decorations renderer.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/document-tab/DocumentTabs.vue New document tab list UI (main + temp docs).
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/document-tab/DocumentTab.vue Tab rendering now driven by text document displayName + thumbnail.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/diagnostics/index.ts Diagnostics controller refactor to generic diagnostics provider types.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/diagnostics/DiagnosticsUI.vue New diagnostic decorations renderer.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/read.svg New definition icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/listen.svg New definition icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/DefinitionOverviewWrapper.vue New definition overview wrapper UI.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/DefinitionItem.vue New definition item renderer.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/DefinitionIcon.vue New definition icon selection component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/DefinitionDetailWrapper.vue New definition detail layout wrapper.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/definition/DefinitionDetail.vue New definition detail renderer (document base + slot fallback).
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/copilot.ts Default markdown code fences now use xgo.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/context-menu/index.ts Context menu controller refactor to generic provider types.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/context-menu/ContextMenuUI.vue New context menu UI wiring (menu + trigger).
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/context-menu/ContextMenuTrigger.vue New context-menu trigger button implementation.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/context-menu/ContextMenu.vue New context-menu dropdown content.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/completion/index.ts Completion controller refactor to generic provider types.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/completion/fuzzy/strings.ts New fuzzy helper utility (copied upstream).
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/completion/fuzzy/README.md Attribution doc for copied fuzzy implementation.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/completion/CompletionUI.vue New completion dropdown container.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/completion/CompletionItem.vue New completion item rendering with match highlighting.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/completion/CompletionCard.vue New completion list + documentation pane UI.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/common.ts New shared Monaco conversion + decoration utilities.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/rename.svg New command icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/modify.svg New command icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/goto.svg New command icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/fix.svg New command icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/copy.svg New command icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/copilot.svg New command icon asset.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/command/CommandIcon.vue New command icon component.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/api-reference/index.ts API reference controller refactor + category view info support.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/ZoomControl.vue New code editor zoom control UI.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/MonacoEditor.vue New Monaco editor wrapper component with custom options.
spx-gui/src/components/editor/code-editor/xgo-code-editor/ui/CodeEditorCard.vue New shared card container for editor popovers.
spx-gui/src/components/editor/code-editor/xgo-code-editor/snippet-variables.ts New snippet variables provider contract + default implementation.
spx-gui/src/components/editor/code-editor/xgo-code-editor/resource.ts Generic resource provider contract + default LSP-backed implementation.
spx-gui/src/components/editor/code-editor/xgo-code-editor/project.ts Define ClassFramework + IXGoProject abstraction.
spx-gui/src/components/editor/code-editor/xgo-code-editor/monaco.ts New Monaco loader registering xgo and wiring Shiki highlighting.
spx-gui/src/components/editor/code-editor/xgo-code-editor/lsp/types.ts New generic LSP client interface for editor core.
spx-gui/src/components/editor/code-editor/xgo-code-editor/inlay-hint.ts New generic inlay hint provider implementation.
spx-gui/src/components/editor/code-editor/xgo-code-editor/index.ts Public entrypoint exporting xgo-code-editor APIs + components.
spx-gui/src/components/editor/code-editor/xgo-code-editor/hover.ts New generic hover provider implementation with built-in actions.
spx-gui/src/components/editor/code-editor/xgo-code-editor/document-base/index.ts Refactor document base to injectable definitions + IDocumentBase.
spx-gui/src/components/editor/code-editor/xgo-code-editor/diagnostics.ts New generic diagnostics provider with workspace-diagnostic caching.
spx-gui/src/components/editor/code-editor/xgo-code-editor/context.ts New generic code editor injection + rename warning helper.
spx-gui/src/components/editor/code-editor/xgo-code-editor/context-menu.ts New generic context menu provider implementation.
spx-gui/src/components/editor/code-editor/xgo-code-editor/common.test.ts Tests for definition id stringify/parse in generic module.
spx-gui/src/components/editor/code-editor/xgo-code-editor/api-reference.ts Define API reference provider contract + category view metadata.
spx-gui/src/components/editor/code-editor/ui/snippet.ts Remove old SPX-coupled snippet parser (moved to providers).
spx-gui/src/components/editor/code-editor/ui/markdown/InputValuePreview.vue Remove old SPX-specific input preview implementation.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/resource/resource-selector.ts Update resource typing imports; prep for shared selector interface.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/resource/SpxResourceItem.vue Render resource items from resource URIs via model lookup.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/spx-effect-input/SpxEffectKindItem.vue New SPX effect kind preview item component.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/spx-effect-input/SpxEffectKindInput.vue Add emit contracts for effect kind input.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxSpecialObjInput.vue Add submit emit contract.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxRotationStyleInput.vue Add submit emit contract.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxPlayActionInput.vue Add submit emit contract.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxLayerActionInput.vue Add submit emit contract.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxKeyInput.vue Add submit emit contract.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxDirectionInput.vue New direction input UI (angle picker + numeric input).
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxDirActionInput.vue Add submit emit contract.
spx-gui/src/components/editor/code-editor/spx-code-editor/ui/CodeEditorUI.vue SPX wrapper supplying framework-specific handlers to xgo UI.
spx-gui/src/components/editor/code-editor/spx-code-editor/text-document.ts SPX code owner implementations for stage/sprite documents.
spx-gui/src/components/editor/code-editor/spx-code-editor/spx-project.ts Implement IXGoProject adapter for SpxProject.
spx-gui/src/components/editor/code-editor/spx-code-editor/snippet-variables.ts SPX snippet variables provider extracted from old snippet parser.
spx-gui/src/components/editor/code-editor/spx-code-editor/resource.ts SPX resource provider extending generic resource provider.
spx-gui/src/components/editor/code-editor/spx-code-editor/lsp/spxls/methods.ts Update imports to use generic xgo editor types.
spx-gui/src/components/editor/code-editor/spx-code-editor/lsp/spxls/index.d.ts Relocate spxls type reference shim.
spx-gui/src/components/editor/code-editor/spx-code-editor/lsp/spxls/commands.ts Update imports to use generic xgo editor types.
spx-gui/src/components/editor/code-editor/spx-code-editor/lsp/spx-lsp-client.ts Implement ILSPClient; adjust types and comments.
spx-gui/src/components/editor/code-editor/spx-code-editor/index.ts Public entrypoint re-exporting xgo-code-editor + SPX additions.
spx-gui/src/components/editor/code-editor/spx-code-editor/document-base/key.ts Update category imports to xgo-code-editor.
spx-gui/src/components/editor/code-editor/spx-code-editor/document-base/index.ts Update imports to xgo-code-editor; note snippet vars provider location.
spx-gui/src/components/editor/code-editor/spx-code-editor/document-base/helpers.ts Update helper wiring to xgo-code-editor exports + new key defs.
spx-gui/src/components/editor/code-editor/spx-code-editor/document-base/common.ts Update imports to xgo-code-editor.
spx-gui/src/components/editor/code-editor/spx-code-editor/diagnostics.ts SPX diagnostics provider merges runtime + LSP diagnostics.
spx-gui/src/components/editor/code-editor/spx-code-editor/context.ts SPX code editor wiring: Monaco, LSP client, providers, injection.
spx-gui/src/components/editor/code-editor/spx-code-editor/common.test.ts Remove definition-id tests (moved to xgo tests); extend URI tests.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/sound.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/sensing.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/motion.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/look.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/game.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/event.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/api-reference/icons/control.svg New API reference category icon asset.
spx-gui/src/components/editor/code-editor/spx-code-editor/FormatButton.vue Update formatting to use new code editor injection API.
spx-gui/src/components/editor/code-editor/spx-code-editor/CodeLink.vue Update CodeLink to use new code editor injection API.
spx-gui/src/components/editor/code-editor/monaco.ts Remove old Monaco module (superseded by xgo-code-editor/monaco).
spx-gui/src/components/editor/code-editor/lsp/spxls/index.d.ts Remove old spxls shim file from previous location.
spx-gui/src/components/editor/EditorContextProvider.vue Switch SpxProject import to type-only.
spx-gui/src/components/copilot/custom-elements/CodeLink.ts Use spx-code-editor re-exports for CodeLink + document IDs.
spx-gui/src/components/copilot/custom-elements/CodeChange.vue Use new useCodeEditorRef API from spx-code-editor.
spx-gui/src/components/copilot/custom-elements/CodeBlock.vue Use new useCodeEditorRef API from spx-code-editor.
spx-gui/src/components/copilot/context.ts New Copilot injection context module.
spx-gui/src/components/copilot/MarkdownView.vue Switch Copilot context import to new module.
spx-gui/src/components/copilot/CopilotUI.vue Switch Copilot context import to new module.
spx-gui/src/components/common/CodeView.vue Switch highlighter + default language to xgo.
spx-gui/src/components/agent-copilot/markdown/FileContent.vue Switch syntax language to xgo.
spx-gui/src/components/agent-copilot/markdown/CodeView.vue Switch highlighter + default language to xgo.
spx-gui/eslint.config.js Update ignored fuzzy path and unused-vars args ignore pattern.
spx-gui/.prettierignore Update ignored paths for moved highlight/theme assets and fuzzy code.

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

@xgopilot
Copy link
Contributor

xgopilot bot commented Mar 5, 2026

Good structural split. The two-layer (xgo-code-editor / spx-code-editor) architecture is clean and the IXGoProject / ILSPClient / ICodeOwner interfaces are well-scoped. A few noteworthy issues found: (1) dispose only cleans up lspClient and diagnosticsProvider — other providers leak; (2) useCodeEditor() throws synchronously in setup, which races with async init; (3) uiRef = computed(() => new CodeEditorUIController(...)) leaks controllers on every recompute; (4) the spx-providers table in code-editor.md has wrong file paths; (5) project.md still lists CodeEditor as spx-coupled — contradicted by this very PR. Details in inline comments below.

Copy link
Collaborator

@cn0809 cn0809 left a comment

Choose a reason for hiding this comment

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

lgtm

@nighca nighca merged commit 7a4e031 into goplus:dev Mar 10, 2026
5 checks passed
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.

Code editor for different class frameworks

3 participants