|
| 1 | +--- |
| 2 | +title: "JavaScript Editor Updates" |
| 3 | +excerpt: "This is a Template to write Blog Posts for weekly updates" |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-06-07" |
| 6 | +slug: "JSeditor-updates" |
| 7 | +author: "Elwin Li" |
| 8 | +description: "GSoC Contributor" |
| 9 | +tags: "gsoc25,sugarlabs,week1,javaScript editor" |
| 10 | +image: "assets/Images/GSOC.png" |
| 11 | +--- |
| 12 | + |
| 13 | +<!-- markdownlint-disable --> |
| 14 | + |
| 15 | +# Week 1 Progress Report by Elwin Li |
| 16 | + |
| 17 | +**Project:** [Advanced JavaScript Editor with MusicBlocks Interactions](https://github.com/sugarlabs/musicblocks/tree/gsoc-2025/elwin) |
| 18 | +**Mentors:** [Walter Bender](https://github.com/walterbender), [Anindya Kundu](https://github.com/meganindya), [Devin Ulibarri](https://github.com/pikurasa) |
| 19 | + |
| 20 | +**Reporting Period:** 2025-06-02 - 2025-06-07 |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Goals for This Week |
| 25 | + |
| 26 | +- **Goal:** Complete and deploy code to blocks functionality. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## This Week’s Achievements |
| 31 | + |
| 32 | +**Refactored code to be config driven** |
| 33 | +I refactored my code for code to block conversion to use a JSON config file so that the logic behind the conversion is as generic as possible. |
| 34 | +An example config for a block is shown below: |
| 35 | + |
| 36 | + { |
| 37 | + "name": "repeat", |
| 38 | + "comments": "Repeat block in the Flow palette", |
| 39 | + "arguments": [ |
| 40 | + { |
| 41 | + "type": "NumberExpression" |
| 42 | + } |
| 43 | + ], |
| 44 | + "ast": { |
| 45 | + "identifiers": [ |
| 46 | + { |
| 47 | + "property": "type", |
| 48 | + "value": "ForStatement" |
| 49 | + } |
| 50 | + ], |
| 51 | + "argument_properties": [ |
| 52 | + "test.right" |
| 53 | + ], |
| 54 | + "children_properties": [ |
| 55 | + "body.body" |
| 56 | + ] |
| 57 | + }, |
| 58 | + "blocklist_connections": [ |
| 59 | + "parent_or_previous_sibling", |
| 60 | + "argument", |
| 61 | + "first_child", |
| 62 | + "next_sibling" |
| 63 | + ], |
| 64 | + "default_vspaces": { |
| 65 | + "argument": 1 |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | +This config is for the repeat block, as conveniently stated in the comments section for readability. |
| 70 | +There are several pieces of information we need for a block for the conversion code to work: |
| 71 | +- The name of the block |
| 72 | +- The number of arguments, and their types |
| 73 | +- The associated AST information |
| 74 | + - The identifiers, or the path to that block (needed for matching) |
| 75 | + - The paths to the argument and children properties from the AST |
| 76 | +- The connections the block has in the blocklist [parent/previous sibling, argument(s), child(ren), next sibling] |
| 77 | +- vspace information |
| 78 | + |
| 79 | +Based on these pieces of information, the conversion code is generic enough to parse through and translate into blocklist format. |
| 80 | +This is very important because this means that adding a new block for support is now as simple as adding a config like this to the JSON file. |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +## Challenges & How I Overcame Them |
| 85 | + |
| 86 | +- **Challenge:** Coming up with the config format. |
| 87 | + |
| 88 | + **Solution:** Lots of trial and error, and using many different examples to make the code generic. |
| 89 | + |
| 90 | +- **Challenge:** Argument handling was not working with configuration. |
| 91 | + |
| 92 | + **Solution:** Added a separate section in the config file for argument blocks, but made it as close to other blocks as possible. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Key Learnings |
| 97 | + |
| 98 | +- Deepened understanding of JSON configuration files. |
| 99 | +- Improved skills in **debugging**, **code design**, and **collaboration workflows**. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## Next Week’s Roadmap |
| 104 | + |
| 105 | +- Fully add all blocks that we want to support for code to block conversion, with corresponding documentation and error handling. |
| 106 | +- Move on to next phase of the JSeditor project, which is the debugger |
| 107 | +- Familiarize myself with the necessary files I will need to work with for the debugger |
| 108 | +- Work on getting breakpoints to work |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Acknowledgments |
| 113 | + |
| 114 | +Thank you to my mentors, the Sugar Labs community, and fellow GSoC contributors for ongoing support. |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## Connect with Me |
| 119 | + |
| 120 | +- GitHub: [@ebeetles](https://github.com/ebeetles) |
| 121 | + |
| 122 | +- LinkedIn: [Elwin Li](https://www.linkedin.com/in/elwinsli/) |
| 123 | + |
| 124 | +--- |
0 commit comments