Skip to content

Port createSourceFile and createSourceFileFromFile - #64216

Open
John Favret (johnfav03) wants to merge 2 commits into
microsoft:mainfrom
johnfav03:feature/63875-2b-source-file-api
Open

Port createSourceFile and createSourceFileFromFile#64216
John Favret (johnfav03) wants to merge 2 commits into
microsoft:mainfrom
johnfav03:feature/63875-2b-source-file-api

Conversation

@johnfav03

Copy link
Copy Markdown
Contributor

In the TS API, these are exposed as:

  • createSourceFile(fileName: string, sourceText: string, options?: CreateSourceFileOptions)
  • createSourceFileFromFile(file: DocumentIdentifier, options?: CreateSourceFileOptions)

Part of #63875

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

Copilot-Session: 6d538b67-9406-44b0-9f8b-5e83f902447e
Copilot AI balanced review requested due to automatic review settings September 9, 2026 19:21
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 9, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 9, 2026

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.

🔵 Needs a closer look

It changes cross-language protocol encoding, filesystem callbacks, AST identity, and Unicode handling across multiple execution paths.

Pull request overview

Adds standalone source-file creation APIs across the Go server and TypeScript clients, including WTF-8 preservation and safer node handles.

Changes:

  • Adds createSourceFile and createSourceFileFromFile.
  • Preserves lone UTF-16 surrogates across paths, callbacks, scanning, and encoding.
  • Strengthens node handles with source-file identity validation.
File summaries
File Description
tsc/internal/tspath/path.go Preserves surrogates during path canonicalization.
tsc/internal/tspath/path_test.go Tests surrogate paths.
tsc/internal/scanner/scanner.go Adds WTF-8-aware scanning and offsets.
tsc/internal/scanner/scanner_test.go Tests surrogate escapes.
tsc/internal/core/core.go Corrects WTF-8 UTF-16 lengths.
tsc/internal/api/session.go Implements server APIs and node identity checks.
tsc/internal/api/session_createsourcefile_test.go Tests server-side creation.
tsc/internal/api/proto.go Defines protocol methods and options.
tsc/internal/api/encoder/stringtable.go Supports filename overrides.
tsc/internal/api/encoder/encoder.go Encodes overridden names and identity metadata.
tsc/internal/api/encoder/decoder.go Safely decodes displayed filenames.
tsc/internal/api/callbackfs.go Uses base64 WTF-8 callback payloads.
tools/scripts/tsc/generate-encoder.ts Generates identity-aware node handles.
tools/gen-proto/main.go Generates ScriptKind protocol types.
tools/gen-proto/main_test.go Verifies generated APIs.
packages/typescript/test/wtf8.test.ts Tests WTF-8 and MessagePack round trips.
packages/typescript/test/sync/api.test.ts Tests synchronous APIs and stale handles.
packages/typescript/test/sync/api-generators.test.ts Tests generated batching and parity.
packages/typescript/test/encoder.test.ts Tests surrogate string-table boundaries.
packages/typescript/test/async/api.test.ts Tests asynchronous APIs and stale handles.
packages/typescript/src/api/sync/client.ts Encodes synchronous filesystem callbacks.
packages/typescript/src/api/sync/api.ts Exposes synchronous creation APIs.
packages/typescript/src/api/proto.generated.ts Adds generated protocol declarations.
packages/typescript/src/api/path.ts Adds WTF-8-safe URI conversion.
packages/typescript/src/api/node/wtf8.ts Implements WTF-8 encoding.
packages/typescript/src/api/node/node.ts Tracks and validates source identity.
packages/typescript/src/api/node/node.infrastructure.ts Extends source-file metadata.
packages/typescript/src/api/node/node.generated.ts Emits identity-aware node IDs.
packages/typescript/src/api/node/msgpack.ts Encodes MessagePack strings as WTF-8.
packages/typescript/src/api/node/encoder.ts Preserves surrogate string boundaries.
packages/typescript/src/api/async/client.ts Encodes asynchronous filesystem callbacks.
packages/typescript/src/api/async/api.ts Exposes asynchronous creation APIs.
packages/typescript/scripts/generateSync.ts Generates batched binary-response handling.
Review details
  • Files reviewed: 33/33 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants