Skip to content

Conversation

antfu
Copy link
Member

@antfu antfu commented Dec 25, 2019

resolves #371

The magic comments are replaced with more readable markers.

/*___wenyan_module_<module_name>_start___*/
/*___wenyan_module_<module_name>_end___*/

Also in the IDE

  • Replaced block with comments to note the code is been hidden.
  • Make Hide Imported Code checked by default.

image

chore: make Hide Imported Code  checked by default
@LingDong-
Copy link
Member

Nice! It's great that you have /* ... is hidden */, very thoughtful!

However, could you please make sure that if the imported module also imported a module, the nested structure doesn't confuse the regex? Please correct me if I'm wrong, it seems that your regex doesn't require the start and end comments to match, and could be problematic if one pair of them encloses another?

Or perhaps we can use the regex to just fetch the names of the modules and put them in a Set, and throw away everything before the last end_module comment, and finally put the list of names in its place.

Thanks a lot!

@antfu
Copy link
Member Author

antfu commented Dec 25, 2019

Sure! I just discovered the same. Will have a fix tmr!

@antfu
Copy link
Member Author

antfu commented Dec 26, 2019

It's done! I also add npm scripts ide:dev and site:dev for better development experiences. By running this command, it will auto rebuild every time you make changes. Hope you find it useful.

And sorry I saw you saying not to commit the built ide.html file, but it's already included in some early commits and it's hard to remove it from the history. So I rebuild a latest one I won't include it in the future PRs.

@LingDong- LingDong- merged commit e62ef91 into wenyan-lang:master Dec 26, 2019
@LingDong-
Copy link
Member

Awesome, thanks a lot!
Don't worry too much about the ide.html file, I can simply delete everything in it when there's a conflict, and rebuild it locally :)

LingDong- added a commit that referenced this pull request Jan 20, 2020
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.

[Feature request] Hide compiled code of std lib from Online IDE
2 participants