Skip to content

[ENHANCEMENT] Extract workspace-scoped CodeIndexManager registry #1594

Description

@WebMad

Problem

CodeIndexManager combines indexing behavior with workspace resolution, instance creation, caching, and registry-wide cleanup. This makes a small infrastructure responsibility harder to test independently.

Context

A focused first refactoring step related to #1592. This issue does not attempt to fix the indexing failures covered by that umbrella tracker.

Desired behavior

Move workspace selection and manager instance ownership into CodeIndexManagerRegistry, following the existing Registry naming convention. Keep CodeIndexManager focused on an individual workspace's indexing services.

Scope

  • Move getInstance, getAllInstances, disposeAll and the workspace-path map into the registry.
  • Extract workspace folder selection into a private early-return helper.
  • Preserve explicit-path priority, active-editor/first-folder fallback, and one manager per workspace path.
  • Preserve actual workspace URIs; use VS Code's file URI API for explicit paths outside open workspace folders.
  • Update consumers and test mocks without changing indexing/orchestration behavior.

Acceptance criteria

  • Manager no longer owns the static registry.
  • Existing callers use the new registry.
  • Focused unit tests cover workspace resolution, instance reuse/isolation, enumeration, cleanup and recreation.
  • Relevant tests, type checking, lint and CI pass without increasing lint suppressions.

Constraints

No provider redesign, persisted-setting migration, scanner changes, or broader indexing bug fixes. Canonical file URIs replace the previous hand-built fallback, which can affect URI-derived keys for unusual explicit paths; real workspace URIs remain unchanged.

Related umbrella issue: #1592

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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