Skip to content

feat(mpp-idea): Enhance IdeaFileSearchPopup with full context menu features #29

@phodal

Description

@phodal

Background

The current IdeaFileSearchPopup implementation needs to be enhanced to match the full context menu design (see screenshot) and integrate features from RelatedFileWorkspaceManager.

Current State

IdeaFileSearchPopup.kt currently has:

  • Files submenu (search files)
  • Folders submenu (search folders)
  • Recently Opened Files submenu
  • Clear Context option
  • Bottom search field

Target Design

![Context Menu Design](screenshot reference)

Default Context
Files                    >
Folders                  >
Recently Opened Files    >
Rules                    >
Clear Context
─────────────────────────
[ Focus context         ]

Required Changes

1. New Menu Items

  • Default Context: Add option to set/clear default context
  • Rules: Add submenu for context rules (TBD: what rules?)

2. UI Improvements

  • Path display format: Show truncated paths like ...cc/unitmesh/devins/idea/editor
  • File item layout: FileName.kt ...path/to/file (name bold, path gray)
  • History icon: Add IdeaComposeIcons.History for Recently Opened Files

3. Integration with RelatedFileWorkspaceManager Pattern

  • Auto-add current file: Listen to FileEditorManagerListener to auto-add current file to context
  • Related classes: Listen to LookupManagerListener to suggest related classes
  • Workspace panel: Create equivalent of WorkspaceFilePanel for managing selected files
  • File list visualization: Show selected files as chips/tags in toolbar

4. Technical Implementation

// New structure needed:
class IdeaContextManager(project: Project) {
    // State management for selected files
    val selectedFiles: StateFlow<List<VirtualFile>>
    
    // Auto-add current editor file
    fun setupEditorListener()
    
    // Related classes from lookup
    fun setupRelatedClassesListener()
    
    // Clear all context
    fun clearContext()
    
    // Set default context
    fun setDefaultContext(files: List<VirtualFile>)
}

Questions to Clarify

  1. Default Context: What should this do? Save a preset of files?
  2. Rules: What kind of rules? File patterns? Include/exclude rules?
  3. Integration scope: Should this replace or complement the existing file selection in IdeaTopToolbar?

Related Files

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaFileSearchPopup.kt
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaTopToolbar.kt
  • core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/file/RelatedFileWorkspaceManager.kt
  • core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/file/WorkspaceFilePanel.kt

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions