Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shaped Projectors #1387

Draft
wants to merge 19 commits into
base: dev
Choose a base branch
from
Draft

Shaped Projectors #1387

wants to merge 19 commits into from

Conversation

disconcision
Copy link
Member

@disconcision disconcision commented Sep 6, 2024

Fixes #1396.

This PR enables projectors to replace arbitrary (full) terms instead of just terms represented by convex tiles. For example, you can fold let and fun expressions, or infix operators and their children. More experimentally, you can fold/typefold differently shaped things, including comments, case rules, let tiles (leaving their child out).

Features:

  • Feature: Allow un/projection of arbitrary full terms
  • Feature: Allow folding of comments
  • Feature: Better logic to decide where the caret ends up after unprojection (this is currently slightly regressed relative to dev for the convex case)
  • Feature: If there's a selection, try to project that selection. If can't, no-op. Only if there is no selection use projector-specified strategy to form a selection based on the indicated piece. This means that some projectors (like fold) might support multiple selection shapes
  • Decide on API for allowing a projector to leave one or both unidelimited children uncovered (for example, only cover type ascription pseudo-operator and the rightwards type child while leaving the leftwards child uncovered). rn this is handled generically by term selection logic, but i guess each projector kind should decide this itself. can't quite decide what the logic should be based on though

Bugs:

  • Bug: Can't trigger projection on non-leading delimiters of non-convex tiles
  • Bug: exception when trying to project convex mono from right side
  • Bug: nested infix ops (or nested prefix and infix) sometimes throw aba exns
  • Bug: regrouting issue for subtraction, application when first child is projected
  • Bug: cant change existing projection without unprojecting
  • Bug: folding case rules causes bug when moving through to the right (Not_found, maybe due to inclusion of trailing linebreak?)
  • Bug: nested infix folds makes inner fold a hole in live value display
  • Bug: Secondary: prevent folding of whitespace
  • bug: Secondary: postfix comments still get prefix shape
  • bug: Secondary: unfolding from front of comment triggers buffer overflow (since attempted move to orig id)

Cleanup:

  • Remove param from RemoveIndicated
  • TODOs

Optional:

  • stretch: even better logic for caret placement?
  • edge case, not necessarily undesired: for n-tuples, unfolding moves to same comma as was originally folded on

@disconcision disconcision changed the title Segment Projectors Shaped Projectors Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

projectors break application/subtraction remolding
1 participant