Skip to content

Unified: Use offsets for swift-syntax locations - #22543

Merged
tausbn merged 2 commits into
mainfrom
tausbn/unified-swift-use-offsets-for-locations
Sep 11, 2026
Merged

Unified: Use offsets for swift-syntax locations#22543
tausbn merged 2 commits into
mainfrom
tausbn/unified-swift-use-offsets-for-locations

Conversation

@tausbn

@tausbn tausbn commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Gets rid of the range objects that were used previously. This results in a roughly 50% decrease in the size of the resulting JSON.

The field names that store this new information ($pos, $end, $lineStarts) match the implementation used in the TypeScript extractor.

@tausbn tausbn added the no-change-note-required This PR does not need a change note label Sep 10, 2026
Gets rid of the `range` objects that were used previously. This results
in a roughly 50% decrease in the size of the resulting JSON.

The field names that store this new information ($pos, $end,
$lineStarts) match the implementation used in the TypeScript extractor.
@tausbn
tausbn force-pushed the tausbn/unified-swift-use-offsets-for-locations branch from 4f39db3 to 6add305 Compare September 10, 2026 15:37
@tausbn
tausbn marked this pull request as ready for review September 10, 2026 15:49
@tausbn
tausbn requested a review from a team as a code owner September 10, 2026 15:49
Copilot AI balanced review requested due to automatic review settings September 10, 2026 15:49

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 compact location format is consistently implemented, documented, and covered by UTF-8 and line-ending tests.

Review tier: Balanced
Findings: None

What changed in this PR

Replaces verbose Swift syntax ranges with compact UTF-8 offsets and a shared line-start table.

Changes:

  • Emits $pos, $end, and root-level $lineStarts.
  • Reconstructs tree-sitter-style points in the Swift adapter.
  • Updates documentation, fixtures, and location tests.
File Description
unified/​swift-syntax-rs/​swift/​Sources/​SwiftSyntaxFFI/​SwiftSyntaxFFI.swift Emits compact offset metadata.
unified/​swift-syntax-rs/​src/​lib.rs Tests UTF-8 offsets and line boundaries.
unified/​swift-syntax-rs/​README.md Documents the new JSON format.
unified/​extractor/​tests/​swift_syntax_pipeline.rs Updates pipeline fixtures.
unified/​extractor/​tests/​fixtures/​let_x.swiftsyntax.json Updates serialized Swift fixture.
unified/​extractor/​src/​languages/​swift/​adapter.rs Converts offsets into AST ranges and points.

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

asgerf
asgerf previously approved these changes Sep 10, 2026

@asgerf asgerf 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.

LGTM. I've kicked off a DCA run.

…use-offsets-for-locations

# Conflicts:
#	unified/extractor/tests/swift_syntax_pipeline.rs
@tausbn

tausbn commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the merge conflict by getting rid of the changes to the test we deleted elsewhere. This should not affect the DCA results.

@tausbn

tausbn commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

DCA appears to be uneventful. Merging.

@tausbn
tausbn merged commit 64ad410 into main Sep 11, 2026
8 checks passed
@tausbn
tausbn deleted the tausbn/unified-swift-use-offsets-for-locations branch September 11, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants