Skip to content

Handle overlapping, non-nested placeholder spans in Checks #18953

@gersona

Description

@gersona

Describe the problem

See this thread for the initial discussion #18600 (comment)

Overlapping non-nested matches are allowed by configuration: nothing in the placeholders: machinery inherently forbids two regexes (or one regex) from producing overlapping ranges.

Solution brainstorm

  • Document and implement a clear rule for overlapping, non-nested placeholder spans (e.g. merge to a single covered interval, deterministic precedence, or explicit “unsupported” behavior with safe fallbacks).
  • Align highlight_string() / UI highlighting with whatever rule we choose for checks and autofix paths that rely on the same ranges.

Describe alternatives you have considered

No response

Screenshots

No response

Additional context

We want concrete examples from real projects (or realistic snippets), for example, actual placeholders: flags (and sample source strings) that produce overlapping matches.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions