Skip to content

Add standalone file suggestion preview and fix PreviewEnv service narrowing#3066

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

Add standalone file suggestion preview and fix PreviewEnv service narrowing#3066
Copilot wants to merge 4 commits intomainfrom
copilot/add-typeahead-preview

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

The file suggestion control in suggestion.tsx did not have a standalone frontend/preview entry, and its fetch path was coupled to PreviewModel for cwd resolution. The preview work also exposed a regression in the real app: PreviewEnv narrowed services with the wrong key shape (ObjectService instead of object), which broke onSelect when PreviewModel updated block metadata.

  • Standalone file suggestion preview

    • Added frontend/preview/previews/suggestion.preview.tsx for the typeahead file picker.
    • Wired it to the existing preview WaveEnv/mock filesystem so it can run without the full preview model.
    • Anchors default suggestions at ~, while preserving absolute-path queries starting with /.
  • Extracted reusable file suggestion fetcher

    • Added frontend/app/view/preview/previewsuggestions.ts.
    • Moved preview file-suggestion request construction out of preview.tsx and into a helper that accepts explicit cwd/connection inputs.
    • Keeps the in-app preview flow unchanged while making the standalone preview independent of PreviewModel.statFile.
  • Preview mock suggestion support

    • Added preview-only mock suggestion handling backed by DefaultMockFilesystem.
    • Supports:
      • empty query from ~
      • relative queries like Documents/foo
      • absolute queries like /Users/mike/Doc
      • trailing-slash directory navigation/completion
  • Fix PreviewEnv service contract

    • Corrected the preview env narrowing from:
      • services.ObjectService
    • to:
      • services.object
    • Updated PreviewModel call sites to use this.env.services.object.UpdateObjectMeta(...), which matches the actual WaveEnv service map and restores onSelect behavior in the non-mock path.
  • Minor suggestion control plumbing

    • Passed placeholderText through SuggestionControl into SuggestionControlInner so the standalone preview renders the intended input placeholder.

Example of the extracted fetch path:

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

Corrected service usage in PreviewModel:

await this.env.services.object.UpdateObjectMeta(blockOref, updateMeta);

📱 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: 5f0870a
Status: ✅  Deploy successful!
Preview URL: https://0eee7b5e.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
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot AI changed the title Add standalone preview for file suggestion control Add standalone file suggestion preview and fix PreviewEnv service narrowing Mar 15, 2026
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