Skip to content

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Nov 7, 2025

Adds detection and improved error messages for version control merge conflicts encountered in the parser.

This is based upon rustc's implementation.

@camc314 camc314 marked this pull request as ready for review November 7, 2025 18:03
Copilot AI review requested due to automatic review settings November 7, 2025 18:03
@github-actions github-actions bot added the A-parser Area - Parser label Nov 7, 2025
Copy link
Contributor Author

camc314 commented Nov 7, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Nov 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Git merge conflict marker detection to the parser, providing enhanced error messages when conflict markers (<<<<<<<, =======, >>>>>>>, |||||||) are encountered instead of generic "Unexpected token" errors.

  • Implements merge conflict marker detection in the parser with support for diff3 format
  • Adds comprehensive error messages with context-aware help text
  • Includes test coverage for both valid code with markers in strings/comments and actual conflict markers

Reviewed Changes

Copilot reviewed 2 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/oxc_parser/src/error_handler.rs Implements is_merge_conflict_marker() and find_merge_conflict_markers() methods for detecting all Git conflict marker patterns
crates/oxc_parser/src/diagnostics.rs Adds merge_conflict_marker() diagnostic function with detailed help messages for different conflict scenarios
tasks/coverage/misc/pass/diff-markers-in-strings.js Tests that markers in strings, templates, and comments don't trigger false positives
tasks/coverage/misc/fail/diff-markers.js Tests actual conflict marker detection in various contexts
tasks/coverage/snapshots/*.snap Updates test coverage metrics and adds expected diagnostic output for conflict markers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camc314 camc314 force-pushed the c/11-04-feat_parser_improve_diagnostic_messages_for_merge_conflicts branch from ea1c6fa to 5603a5e Compare November 7, 2025 18:08
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 7, 2025

CodSpeed Performance Report

Merging #15443 will not alter performance

Comparing c/11-04-feat_parser_improve_diagnostic_messages_for_merge_conflicts (da6cf0f) with main (0fa484d)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (5fa6bb8) during the generation of this report, so 0fa484d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 force-pushed the c/11-04-feat_parser_improve_diagnostic_messages_for_merge_conflicts branch from 5603a5e to ffb2d9d Compare November 7, 2025 20:43
@camc314 camc314 requested a review from sapphi-red November 7, 2025 20:44
@camc314 camc314 force-pushed the c/11-04-feat_parser_improve_diagnostic_messages_for_merge_conflicts branch from ffb2d9d to 02218ae Compare November 7, 2025 21:38
@sapphi-red

This comment was marked as outdated.

This comment was marked as outdated.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Nov 8, 2025
Copy link
Member

Boshen commented Nov 8, 2025

Merge activity

Adds detection and improved error messages for version control merge conflicts encountered in the parser.

This is based upon rustc's implementation.
@graphite-app graphite-app bot force-pushed the c/11-04-feat_parser_improve_diagnostic_messages_for_merge_conflicts branch from da6cf0f to 8951953 Compare November 8, 2025 06:53
@graphite-app graphite-app bot merged commit 8951953 into main Nov 8, 2025
21 checks passed
@graphite-app graphite-app bot deleted the c/11-04-feat_parser_improve_diagnostic_messages_for_merge_conflicts branch November 8, 2025 06:59
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants