Skip to content

Add standalone preview for file suggestion control#3066

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-typeahead-preview
Draft

Add standalone preview for file suggestion control#3066
Copilot wants to merge 2 commits intomainfrom
copilot/add-typeahead-preview

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

This adds a dedicated frontend/preview entry for the file typeahead used in suggestion.tsx, and removes the standalone-preview dependency on PreviewModel for file suggestion fetching. The preview now uses the existing mock WaveEnv/mock filesystem, starts from ~ by default, and still supports absolute-path queries.

  • Extract preview-safe file suggestion fetching

    • Moved the preview file-suggestion request construction into frontend/app/view/preview/previewsuggestions.ts.
    • The helper accepts an explicit cwd/connection instead of reading PreviewModel state directly.
    • frontend/app/view/preview/preview.tsx now uses the extracted helper, preserving existing behavior while making the fetcher reusable from standalone preview code.
  • Back preview suggestions with the mock WaveEnv/filesystem

    • Added a mock fetchsuggestions implementation in preview-only code.
    • The mock suggestion path resolution mirrors the expected file-query behavior:
      • default base at ~
      • relative queries like Documents/foo
      • absolute queries starting with /
      • directory navigation/completion via trailing /
    • This plugs into the existing preview WaveEnv narrowing/mocking model instead of introducing a separate ad hoc path source.
  • Add a standalone preview

    • Added frontend/preview/previews/suggestion.preview.tsx.
    • The preview renders BlockHeaderSuggestionControl in isolation, anchored to a mock block header, and shows the selected path so the control can be exercised without the full preview view model.
  • Tighten the suggestion control plumbing

    • Passed placeholderText through SuggestionControl into SuggestionControlInner so standalone previews display the intended input placeholder.
  • Add focused coverage

    • Added preview-level tests for:
      • default ~ anchoring without PreviewModel
      • relative and absolute path query handling
      • disposal flow through the extracted helper

Example of the extracted helper usage:

const fetchSuggestions = (query: string, reqContext: SuggestionRequestContext) => {
    return fetchPreviewFileSuggestions(env, query, reqContext, { cwd: "~" });
};

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 15, 2026

Deploying waveterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 185fb4a
Status: ✅  Deploy successful!
Preview URL: https://f43dd40b.waveterm.pages.dev
Branch Preview URL: https://copilot-add-typeahead-previe.waveterm.pages.dev

View logs

Copilot AI changed the title [WIP] Add typeahead control to frontend preview Add standalone preview for file suggestion control Mar 15, 2026
Copilot AI requested a review from sawka March 15, 2026 01:11
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