microsoft / microsoft/SwiftStreamingMarkdown

Make MarkdownController and StreamedMarkdownController lifecycle methods async

Open
#144 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
364
Forks
51
PR merge metrics
No merged PRs in 30d

Description

Summary

The lifecycle methods on MarkdownController and StreamedMarkdownController are currently synchronous, even though every call site invokes them from an async context (.task { ... }) or a place where a Task { } wrapper is already implied.

Marking them async lets the call sites await them directly, aligns the controllers with the package's Swift-concurrency conventions (AGENTS.md), and keeps the async boundary explicit at the view layer.

Methods to convert:

  • StreamedMarkdownController.start() / end()
  • MarkdownController.onAppear(markdown:) / onDisappear()

The fire-and-forget interaction hooks (onTableCopyTap, onImageTap, etc.) and the sync onChange(markdown:) yield-into-continuation method are intentionally left synchronous, since their call sites are non-async UIKit/AppKit delegates and SwiftUI action closures.

Motivation

  • Call sites already run inside .task { } (an async context), so await-ing is natural and avoids implicit fire-and-forget.
  • Makes the concurrency boundary explicit and consistent across the two controllers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate MarkdownController and StreamedMarkdownController, then trace their start, end, onAppear(markdown:), and onDisappear() call sites, especially those inside .task closures. Make the four lifecycle methods async and update their async callers to await them; leave the interaction hooks and onChange(markdown:) synchronous.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, macos, swift
Domain
desktop-dev, mobile-dev
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.