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

💻 add { } for keywords automatically #5140

Closed
hasan-sh opened this issue Feb 13, 2024 · 0 comments · Fixed by #5253
Closed

💻 add { } for keywords automatically #5140

hasan-sh opened this issue Feb 13, 2024 · 0 comments · Fixed by #5253
Assignees
Labels
frontend Issue with the web interface

Comments

@hasan-sh
Copy link
Collaborator

Idea
Currently we ask teachers to explicitly add curly braces { } around keywords so that they can be translated. It's much better UX to do that automatically, plus we already have the code that recognize keywords! This change should be integrated when we save the code of an adventure within the customize-adventure page.

@hasan-sh hasan-sh added the frontend Issue with the web interface label Feb 13, 2024
@hasan-sh hasan-sh self-assigned this Feb 14, 2024
@jpelay jpelay assigned jpelay and unassigned hasan-sh Feb 20, 2024
@mergify mergify bot closed this as completed in #5253 Mar 19, 2024
mergify bot pushed a commit that referenced this issue Mar 19, 2024
Adds curly braces automatically around keywords in the teacher's adventure code. 

For that, we iterate over the code snippets inside the contents of the editor, and use Lezer to parse and the code, and eventually iterate over the syntax tree to add curly braces around the keywords. The generated code should be as close as possible to the original one, maintaining indentation levels, spaces, and even errors. 

Also adds a warning for the case when the teacher selects several levels and also have code snippets, letting them know this can lead to trouble.

Fixes #5140

**How to test**
* Automated tests should pass (WIP)
* Create an adventure, and write your code normally.
* Log in as a student, or preview the class where that adventure was added and see that you can change the keywords language.
* You could also see the generated code by going to the local database, searching for the adventure you just created and check that the keywords have curly braces around them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Issue with the web interface
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants