Skip to content

Add opt-in script context binding - #1781

Merged
cyanzhong merged 1 commit into
mainfrom
develop
Oct 6, 2026
Merged

cyanzhong merged 1 commit into
mainfrom
develop

Conversation

@cyanzhong

Copy link
Copy Markdown
Contributor

We need a way to isolate script executions for MarkEdit-app/extensions#54.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The context mechanism is consistently integrated across both hosts and has focused coverage for its key behaviors.

Review effort: Balanced
Findings: None

What changed in this PR

Adds opt-in, per-script API bindings so injected extensions can retain isolated file-path context.

Changes:

  • Introduces script-context factories and proxied MarkEdit/require bindings.
  • Wraps injected scripts with script-local contexts.
  • Adds Swift and TypeScript coverage for isolation, caching, escaping, and Quick Look.
File Description
MarkEditCore/​Tests/​EditorUserAssetTests.swift Tests generated script bindings and Quick Look behavior.
MarkEditCore/​Sources/​EditorUserAsset.swift Injects script-local context bindings.
CoreEditor/​test/​scriptContext.test.ts Tests context isolation and shared APIs.
CoreEditor/​src/​scriptContext.ts Implements context factories and proxies.
CoreEditor/​src/​@types/​global.d.ts Declares the global context factory.
CoreEditor/​index.ts Exposes context creation to injected scripts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cyanzhong
cyanzhong merged commit c1ceb1a into main Oct 6, 2026
2 checks passed
cyanzhong added a commit that referenced this pull request Oct 6, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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