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

Code Input Widget #8753

Open
Tracked by #8750
farmaazon opened this issue Jan 12, 2024 · 4 comments
Open
Tracked by #8750

Code Input Widget #8753

farmaazon opened this issue Jan 12, 2024 · 4 comments
Labels
-gui d-intermediate Difficulty: some prior knowledge required p-medium Should be completed in the next few sprints x-new-feature Type: new feature request

Comments

@farmaazon
Copy link
Contributor

farmaazon commented Jan 12, 2024

Ctrl/Cmd click on parameter (defined by WidgetArgument presence) should turn it to "Code Input" widget, where user may put any arbitrary Enso code.

After accepting, the widget should stay, i.e. it should not be "broken" into other widgets - for example, when user type 2 + 2 and accepts it, the widget displaying 2 + 2 should stay instead of being turned into two numeric widgets with + between them.

The code-repair algorithm should be improved to handle some "breaking" code correctly:

  • The unclosed text literals should be closed - TextLiteral printer could do that.
  • Similarly, the unclosed ( should be automatically closed, because we cannot handle it by wrapping in ()
  • Unclosed [ should be handled with current tree-repair approach, because it should be limited by encircling ().
  • We should be sure we never interpret "empty node" as a block.

Otherwise, some code written in code input widget could break other widgets or the entire application

@farmaazon farmaazon added d-intermediate Difficulty: some prior knowledge required p-medium Should be completed in the next few sprints x-new-feature Type: new feature request -gui labels Jan 12, 2024
@farmaazon farmaazon moved this from ❓New to 📤 Backlog in Issues Board Jan 12, 2024
@farmaazon
Copy link
Contributor Author

Refinement notes:

  • Initially single line
  • No highlighting
  • We should ensure the connections are still working properly.
  • What about breaking syntax? It should be handled in general: if AST node change would break parent after reparse, we should add (), and if still facing same issue, the edit should be discarded (being implemented by @kazcw)

@farmaazon
Copy link
Contributor Author

Probably we should settle on "how to store metadata in our codebase - maybe in AST nodes?"

@farmaazon
Copy link
Contributor Author

farmaazon commented Jan 18, 2024

The metadata changes are tracked in:

This task should be done after them.

@farmaazon
Copy link
Contributor Author

Added a section about proper AST repairing, to avoid issues discovered when numeric input widget accepted just any code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-gui d-intermediate Difficulty: some prior knowledge required p-medium Should be completed in the next few sprints x-new-feature Type: new feature request
Projects
Status: 📤 Backlog
Development

No branches or pull requests

2 participants