Skip to content

Conversation

@senithkay
Copy link
Contributor

@senithkay senithkay commented Nov 15, 2025

Purpose

This PR addresses several issues related to the Expression Editor and its UI.

  • Resolves style issues in the light theme where some items were not visible or inconsistent.
  • Fixes the problem where completions were not appearing in the non-expanded mode due to a layout issue.
  • Fixes an issue in recordConfigModel Expression Editor where selecting an item in the helper pane replaced the entire editor value instead of just the selected part.

Goals

  • Ensure UI consistency and proper visibility of all elements in the light theme.
  • Restore completion popup functionality in both expanded and non-expanded modes.
  • Correctly update only the selected portion of the expression in the editor, avoiding race conditions in value updates.

Approach

  • Updated styles to improve visibility and consistency in the light theme.
  • Applied position: absolute to the CodeMirror tooltip to fix layout issues preventing completions in non-expanded mode.
  • Removed unnecessary localExpressionValue synchronization in recordConfigModel Expression Editor to prevent overwriting the entire value when selecting helper pane items.
  • Verified that all fixes work across themes and editor modes.

Screenshots or GIFs can be added if UI changes are significant. For a detailed write-up, see this document.

Summary by CodeRabbit

  • New Features

    • Multi-project workspace support enabling management of multiple packages within a single workspace
    • New WorkspaceOverview and PackageOverview views for improved project organization
    • Record configuration editor with guided editing mode for complex data structures
    • Visual dependency pull progress tracking during builds
  • Improvements

    • Enhanced project migration workflow supporting multi-project scenarios
    • Better project path and context resolution throughout the application
    • Refined breadcrumb navigation for workspace and package-level navigation
  • Chores

    • Updated js-yaml dependency to version ^4.1.1

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 15, 2025

Caution

Review failed

Failed to post review comments

Walkthrough

This PR introduces multi-project workspace support, new project metadata structures, and a CodeMirror-based expression editor. Changes include new RPC APIs for project information and migration reporting, state machine refactoring to handle workspaceInfo and projectInfo, AI panel workflow updates, and comprehensive UI updates for workspace/package overviews.

Changes

Cohort / File(s) Change Summary
Dependency Updates
common/config/rush/.pnpmfile.cjs, workspaces/api-designer/api-designer-extension/package.json, workspaces/api-designer/api-designer-visualizer/package.json, workspaces/ballerina/ballerina-extension/package.json
Updated js-yaml from ~4.1.0 to ~4.1.1; added pnpmfile override for version consistency.
Core Project Structure Types
workspaces/ballerina/ballerina-core/src/interfaces/bi.ts, workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts
Introduced ProjectDirectoryMap, updated ProjectStructure with projectPath and projectTitle, added PROJECT_KIND enum and ProjectInfo interface; extended ExtendedLangClientInterface with getProjectInfo method.
RPC Type Definitions - AI Panel
workspaces/ballerina/ballerina-core/src/rpc-types/ai-panel/interfaces.ts
Refactored PostProcessRequest/Response and RepairParams/Response to use sourceFiles and updatedFileNames; added packagePath and isActive to ProjectSource; removed standalone SourceFiles interface.
RPC Type Definitions - Migration
workspaces/ballerina/ballerina-core/src/rpc-types/migrate-integration/index.ts, workspaces/ballerina/ballerina-core/src/rpc-types/migrate-integration/interfaces.ts, workspaces/ballerina/ballerina-core/src/rpc-types/migrate-integration/rpc-type.ts
Added openSubProjectReport and storeSubProjectReports RPC methods; extended MigrateRequest with projects array and SaveMigrationReportRequest with projectReports.
State Machine & Configuration
workspaces/ballerina/ballerina-extension/src/stateMachine.ts, workspaces/ballerina/ballerina-extension/src/utils/config.ts, workspaces/ballerina/ballerina-core/src/state-machine-types.ts
Renamed MACHINE_VIEW.Overview to PackageOverview, added WorkspaceOverview; added projectInfo to VisualizerLocation; renamed checkForProjects to async signature; added getPackageName utility.
RPC Client & Extended Language Client
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts, workspaces/ballerina/ballerina-rpc-client/src/BallerinaRpcClient.ts
Added getProjectInfo method and PUSH_MIGRATED_PROJECT constant; added onDependencyPullProgress and onMigratedProject callbacks.
AI Panel Service - Code Generation
workspaces/ballerina/ballerina-extension/src/features/ai/service/code/code.ts, workspaces/ballerina/ballerina-extension/src/features/ai/service/healthcare/healthcare.ts, workspaces/ballerina/ballerina-extension/src/features/ai/service/utils.ts
Switched from single-project to multi-project handling; replaced transformProjectSource with buildFilePaths, flattenProjectToFiles, buildPackageContext; updated prompts to work with ProjectSource arrays.
AI Panel RPC Managers
workspaces/ballerina/ballerina-extension/src/rpc-managers/ai-panel/rpc-manager.ts, workspaces/ballerina/ballerina-extension/src/features/ai/dataMapping.ts
Updated getCurrentProjectSource and added getProjectSource for multi-project; changed postProcess return shape to include sourceFiles; added workspace-aware project loading.
Expression Editor - CodeMirror Integration
workspaces/ballerina/ballerina-side-panel/src/components/editors/MultiModeExpressionEditor/ChipExpressionEditor/CodeUtils.ts, workspaces/ballerina/ballerina-side-panel/src/components/editors/MultiModeExpressionEditor/ChipExpressionEditor/components/ChipExpressionEditor.tsx, workspaces/ballerina/ballerina-side-panel/src/components/editors/MultiModeExpressionEditor/ChipExpressionEditor/utils.ts
Introduced CodeMirror-based chip expression editor; added token parsing, completion filtering, chip decorations; replaced ChipExpressionBaseComponent.
Expression Editor - Removed & Updated Components
workspaces/ballerina/ballerina-side-panel/src/components/editors/MultiModeExpressionEditor/ChipExpressionEditor/ChipExpressionBaseComponent.tsx (removed), workspaces/ballerina/ballerina-side-panel/src/components/editors/MultiModeExpressionEditor/ChipExpressionEditor/components/...
Removed ChipExpressionBaseComponent; added HelperPane, HelperPaneToggleButton, AutoExpandingEditableDiv enhancements; added GUIDED mode to InputMode enum.
Project Artifacts & Structure
workspaces/ballerina/ballerina-extension/src/utils/project-artifacts.ts, workspaces/ballerina/ballerina-extension/src/utils/bi.ts
Replaced buildProjectArtifactsStructure with buildProjectsStructure for workspace support; refactored to work with ProjectInfo and multi-project scenarios.
BI Extension - Activator
workspaces/ballerina/ballerina-extension/src/features/bi/activator.ts
Added handleCommandWithContext for context-aware command invocation; updated command handlers to accept TreeItem; enhanced SHOW_OVERVIEW and DELETE_COMPONENT commands.
BI Extension - Views
workspaces/ballerina/ballerina-extension/src/views/visualizer/activate.ts, workspaces/ballerina/ballerina-visualizer/src/MainPanel.tsx, workspaces/ballerina/ballerina-visualizer/src/Visualizer.tsx
Updated Overview to PackageOverview; added WorkspaceOverview view; replaced buildProjectArtifactsStructure with buildProjectsStructure.
Migration Integration
workspaces/ballerina/ballerina-extension/src/rpc-managers/migrate-integration/rpc-manager.ts, workspaces/ballerina/ballerina-extension/src/rpc-managers/migrate-integration/rpc-handler.ts
Implemented singleton pattern for MigrateIntegrationRpcManager; added openSubProjectReport and storeSubProjectReports methods; enhanced saveMigrationReport for multi-project workflow.
BI Import Integration - Multi-Project
workspaces/ballerina/ballerina-visualizer/src/views/BI/ImportIntegration/ConfigureProjectForm.tsx, workspaces/ballerina/ballerina-visualizer/src/views/BI/ImportIntegration/MigrationProgressView.tsx, workspaces/ballerina/ballerina-visualizer/src/views/BI/ImportIntegration/components/MultiProjectFormFields.tsx
Added multi-project form fields and configuration; enhanced migration progress view for aggregate reports; added multi-project validation and save workflows.
BI UI Components
workspaces/ballerina/ballerina-visualizer/src/components/DownloadProgress/index.tsx, workspaces/ballerina/ballerina-visualizer/src/views/BI/Configurables/ConfigurableItem/ConfigObjectEditor.tsx, workspaces/ballerina/ballerina-visualizer/src/views/BI/HelperPaneNew/Views/RecordConfigModal.tsx
Added DownloadProgress component for migration status; introduced ConfigObjectEditor for record configuration; enhanced RecordConfigModal with expression editing and diagnostics.
Workspace Overview
workspaces/ballerina/ballerina-visualizer/src/views/BI/PackageOverview/index.tsx (renamed from Overview), workspaces/ballerina/ballerina-visualizer/src/views/BI/WorkspaceOverview/index.tsx, workspaces/ballerina/ballerina-visualizer/src/views/BI/PackageOverview/utils.ts
Renamed Overview to PackageOverview with workspace awareness; created new WorkspaceOverview component; extracted integration utilities to utils; added TopNavigationBar.
BI Extension Project Explorer
workspaces/bi/bi-extension/src/project-explorer/activate.ts, workspaces/bi/bi-extension/src/biExtentionContext.ts
Updated activation config to use isBallerinaWorkspace and isEmptyWorkspace; refined command registration and visibility handling for empty/multi-project workspaces.
Minor Updates
workspaces/ballerina/ballerina-extension/grammar/ballerina-grammar, workspaces/ballerina/ballerina-extension/src/RPCLayer.ts, workspaces/ballerina/ballerina-extension/src/utils/logger.ts, workspaces/ballerina/ballerina-visualizer/src/views/migration-report/webview.ts, workspaces/bi/bi-extension/CHANGELOG.md
Grammar submodule update; conditional projectPath handling in RPCLayer; added buildOutputChannel; webview messaging for sub-project reports; version bump.

Sequence Diagram

sequenceDiagram
    participant User
    participant Extension as VS Code Extension
    participant StateMachine as State Machine
    participant RPC as RPC Manager
    participant LS as Language Server
    
    User->>Extension: Open Ballerina Workspace
    Extension->>StateMachine: checkForProjects()
    StateMachine->>RPC: fetchProjectInfo(projectPath)
    RPC->>LS: getProjectInfo(params)
    LS-->>RPC: ProjectInfo {kind, name, children[]}
    RPC-->>StateMachine: projectInfo
    
    alt Multi-Project Workspace
        StateMachine->>Extension: Display WorkspaceOverview
        Extension->>Extension: Render PackageListView (all projects)
        User->>Extension: Select Package
        Extension->>StateMachine: setView(PackageOverview, projectPath)
    else Single Project
        StateMachine->>Extension: Display PackageOverview
    end
    
    alt AI Code Generation
        User->>Extension: Generate/Repair Code
        Extension->>RPC: getProjectSource(requestType)
        RPC-->>Extension: ProjectSource[] {projectName, packagePath, isActive}
        Extension->>Extension: flattenProjectToFiles(projects)
        Extension->>LS: requestCodeGeneration(sourceFiles, updatedFileNames)
        LS-->>Extension: PostProcessResponse {sourceFiles, diagnostics}
        Extension->>Extension: Update Editor
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • State Machine Refactoring (stateMachine.ts): Major changes to project context handling, view selection logic, and workspace-aware state transitions; ensure all code paths correctly resolve single vs. multi-project scenarios
  • Multi-Project Project Structure (project-artifacts.ts): Refactored buildProjectsStructure and projectPath resolution; verify artifact traversal and updates work correctly for each project in a workspace
  • Expression Editor Rewrite (ChipExpressionEditor.tsx, CodeUtils.ts): Complete replacement of component with CodeMirror integration; verify token rendering, completions, and helper pane interactions work as expected
  • AI Panel Workflows (code.ts, healthcare.ts, utils.ts, rpc-manager.ts): Significant changes to project/file handling and prompt construction for multi-project; ensure context is correctly passed through repair loops and code generation
  • RPC API Extensions (core interfaces, extended-lang-client.ts): New ProjectInfo, PROJECT_KIND, and openSubProjectReport/storeSubProjectReports; verify client/server handshakes and serialization
  • BI Migration & Reporting (rpc-manager.ts, MigrationProgressView.tsx): New multi-project report aggregation and sub-project report opening; test aggregate vs. single-project flows

Possibly related PRs

Suggested labels

Extension/MI, Checks/Enable UI Tests

Suggested reviewers

  • hevayo
  • gigara
  • kanushka

Poem

🐰 The Rabbit's Refactoring Song

From single projects to workspaces wide,
The extension now swells with codeful pride.
With CodeMirror chips and ProjectInfo trees,
Multi-project migrations—dare to please!
Through state-machines dancing, RPC calls chime,
Workspace overview blooms—refactoring time! 🌱✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.71% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description is well-structured with Purpose, Goals, and Approach sections addressing specific bugs and solutions. However, it is missing several required template sections. Add missing sections: UI Component Development, Manage Icons, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, Related PRs, Migrations, Test environment, and Learning.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main changes: fixes for expression editor completions, styling, and record config model helper pane value selection.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@senithkay senithkay changed the base branch from main to bi-1.5.x November 15, 2025 19:01
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