Skip to content

Multi-clause function editing: break out clauses and smart placement #38

Description

@mariari

Current Behavior

Multi-clause functions (same name/arity with different pattern matches) are merged into a single entry in the function coder. All clauses appear in one pane. This is correct but limited.

Desired Improvements

1. Break out individual clauses

Each clause of a multi-clause function could be its own editable pane, with:

  • Clause-level move up/down (reorder clauses)
  • Clause-level delete
  • Visual grouping showing they belong to the same function

2. Smart "New function" placement

When adding a new function via the "New function" editor, if the function name/arity matches an existing multi-clause function, the new clause should be placed adjacent to the existing clauses rather than at the end of the file. This maintains Elixir's requirement that function clauses be consecutive.

Current Fix

merge_clauses/1 in GtBridge.Analysis.all_functions/1 merges consecutive entries with the same name/arity/kind into a single entry spanning all clauses (commit in mariari/editor-session-self-import).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions