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

Improve live templates #121

Merged
merged 25 commits into from
Sep 5, 2023
Merged

Improve live templates #121

merged 25 commits into from
Sep 5, 2023

Conversation

ducky64
Copy link
Collaborator

@ducky64 ducky64 commented Sep 5, 2023

Major refactoring for insertion live template infrastructure:

  • InsertionLiveTemplate now manages the entire template lifecycle, from AST creation (which the user must subclass and implement), deletion (to support a larger variety of AST changes), and optional clean-on-completion or cancelation hooks
    • Refactor AST creation code into these
    • Eliminate the prior hack-tastic deleteTemplate - up to the InsertionLiveTemplate subclass to store the AST nodes to delete, no longer inferred by infrastructure
  • The API now takes a container, optionally specific elements for the template (e.g. if only adding to an argument list), and variables (compared to only container before, where the change had to be a unitary PsiElement)
  • Prevent multiple templates from starting, InsertionLiveTemplate.run returns Errorable
  • Better selection of insertion position at caret, in particular works better when selecting comments (prior, it required inserting at a statement)
  • When cleaning fails, log errors to the console
  • MovableLiveTemplate: store variable values by name when moving, and store position by name - allows robustness when the template variables change as they are moved
  • MovableLiveTemplate: explicitly finish the template before starting a new one, instead of relying on .update()

Improve block diagram visualization robustness:

  • Support ALLOCATE in parsing constraints: instead of matching Ref.unapply, take the first two steps and getName on them
  • Support new names for link ports (controller, targets) in infer edge direction
  • Better support for longer prefixes in block diagram transforms

Connection Live Template:

  • ConnectBuilder: support LibElem, since the new fast path won't build out all the ports
  • Connect execution (connect live template, IR transform) now takes in the aggregate list of connected ports, and figures out what to do with them
    • Not distinguishing a starting port makes sense, since the starting port may be the one being appended to a link

Other refactoring:

  • Define isInternal in EdgirUtils and refactor to use this function, to determine when to deprioritize (for UI purposes) items
  • Prevent insertion of categories (insertion live template only)

@ducky64 ducky64 merged commit bd6f713 into main Sep 5, 2023
2 checks passed
@ducky64 ducky64 deleted the connect-cleaning branch September 5, 2023 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant