Copy - Paste through the web Follow
For communitiy adoption of MPS it's highly desirable to have an option of quick-copying between different computers:
- Publishing code exceprts
- Export/Import of code blocks
Otherwise, people have to:
- publish plaintext version (cannot be imported back, looses colors)
- make screenshots (cannot be imported back, hard-to-do)
- publish entire projects (messy and hard to do)
My idea is to use PNG images for sharing:
- Let's imagine Ctrl-Alt-C hotkey that will create image snapshot of current selection (without of selection marks)
- Encode image as PNG, adding node information as an extended block, invisible outside of MPS
- Provide option to save directly to local file or upload to image-hosting service
On receiving side:
- User copies image to the clipboard (really easy in all browsers)
- Updated Paste handler supports those images (extracts node information, disregards graphics at all)
As result people could share blocks of code, even easier that current (java) code, because for efficient code sharing people now have to use special code-coloring tools which rarely work perfect.
Please sign in to leave a comment.
If i understood your concern properly, If you spend some time you can implement this, mps has the capability. (Just check in MPS 2017.1 how they are cloning a complete language)
We have implemented the same but unfortunately ours is not an opensource.
This is critical funcion for community-centered applications (e.g. financial trading automation).
At least one company choose Scala instead of MPS for the new project because of code excerpts sharing problems.
This looks like a good idea, but it will take some time to discuss and implement.
I've created an issue (http://youtrack.jetbrains.net/issue/MPS-8173) in our bugtracker.
And one question - do you mean copying-and-pasting code inside your team or sending such a "code block" to some people outside your team (e.g. to this forum)? It's ok with the first one, but the second one is hardy doable, because to paste this node into MPS and get it working, we need all the languages it uses to be available on the target computer.
Well, thaks to unique id, it's easy to identify missing languages/solutions and show informative error message.
Anyway, such features will be used only by 'virtual teams' - users from the same problem domain and have similar MPS configurations. Otherwise, there will be no need to paste that code!
Another nice features:
I think the copy-and-paste thing is a good idea, but the "team" implementation should be separated from the "forum" implementation.
For the forum part MPS team should create a special predefined sandbox environment, that all MPS users automatically get with their distribution.
It should only be used for small "code snippets", so users can show other users how it is best to implement this or that functionality.
It would be good to implement it in the way stated above using an additional PNG-picture (or a collection of pictures) for posting it in the forum.