Skip to content

Rework definition context rules #477

@jackfirth

Description

@jackfirth

Creating a definition context rule with define-definition-context-refactoring-rule is somewhat awkward. There's a few usability issues:

  • You have to match the entire definition context, which is rarely useful.
  • You have to be careful to use ~replacement, ~splicing-replacement, and ~focus-replacement-on in order to avoid issues like Avoid excessive formatting in for/fold suggestion #476.
  • The set of recognized definition context forms is hard-coded.

Something better should be possible. Perhaps something like how Rhombus macros work, where a statement macro can match on all following statements and statement macros return two values: an expansion and an "unprocessed tail". That would let Resyntax automatically use ~replacement, ~splicing-replacement, and ~focus-replacement-on, and it would remove the need for definition context rules to care about the forms earlier in the definition context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions