-
-
Notifications
You must be signed in to change notification settings - Fork 2
Contributing a Search Source
itsmylab edited this page Aug 4, 2026
·
1 revision
Generated from
docs/contributions/search-source.md. Edit the canonical source through a pull request.
Use this playbook to make another kind of existing Canopy data discoverable in the command/search palette.
flowchart LR
Data[Existing authoritative data]
Source[registerSpotSource]
Timing{Timing}
Instant[Instant synchronous rows]
Deferred[Debounced async rows]
Palette[SpotSearch merges and ranks rows]
Action[Existing action or custom opener]
Data --> Source --> Timing
Timing -- memory only --> Instant --> Palette
Timing -- I/O --> Deferred --> Palette
Palette --> Action
SpotSearch is a projection, not a new authority. The source should query an existing store, index, service, or context.
src/spotSources.ts source contract and registration
src/components/spotIcons.tsx optional row-kind icon
src/spotSources.test.ts registry and row behavior
src/components/SpotSearch.test.tsx palette behavior when needed
- Identify the authoritative data and its existing cache/query API.
- Choose a stable source ID. Settings persist disabled IDs.
- Choose a section label and one-line settings description.
- Use
instantonly for synchronous in-memory work. - Use
deferredfor filesystem, network, LSP, Git, or database calls. - Set a sensible minimum query length for expensive sources.
- Produce stable row IDs, a row kind, title, detail, score, and action.
- Reuse an existing action. Use a custom action only when the registry cannot express the opener.
- Register an icon only for a genuinely new row kind.
- Store and call the unregister functions if the source has a shorter lifetime than the application.
- Test source ordering, disabled state, minimum query, rejection isolation, action behavior, and cleanup.
sequenceDiagram
participant Palette
participant A as Source A
participant B as Source B
participant C as Source C
par query sources
Palette->>A: rows(query)
Palette->>B: rows(query)
Palette->>C: rows(query)
end
B-->>Palette: rejects
A-->>Palette: rows
C-->>Palette: rows
Note right of Palette: Drop B for this keystroke, keep A and C
One source failure must not empty the palette.
npm run test -- src/spotSources.test.ts src/components/SpotSearch.test.tsx
npm run typecheck- Existing data authority reused.
- Stable source and row IDs used.
- Correct instant/deferred timing selected.
- Expensive source has a minimum query.
- Failure cannot suppress other sources.
- Action and optional icon reuse existing registries.
- Ordering, disable, error, and cleanup behavior tested.
Generated from FluidWorksApp/canopy-ide. Canonical documentation changes belong in the main repository.
Canopy Architecture
- Home
- Architecture
- Core Rust System
- LLM Context
- Integration Guide
- Contribution Playbooks
- Testing and Coverage
- Publish the Wiki
Playbooks