-
Notifications
You must be signed in to change notification settings - Fork 100
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
Js2coffee Integration (issues/126) #193
base: master
Are you sure you want to change the base?
Conversation
Conflicts: Gruntfile.js
Merge Js2coffee with master
An extra new line is introduced by the coffee script compiler. |
Thanks for working on this change Dinuka - are we able to switch from coffee -> js -> coffee again and get back to the original code? (I'd expect not - how commonly is it different?) Do you think we should remember the most recent version in the old language, and if the user switches back without any edits, then use the remembered version? |
@@ -14,6 +14,7 @@ | |||
"jquery": "latest", | |||
"jquery-deparam": "latest", | |||
"jquery-turtle": "PencilCode/jquery-turtle#master", | |||
"js2coffee": "js2coffee/js2coffee#master", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a tagged version instad of #master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
js2coffee is not available as a bower package. So, I had to add the tagged version
Since this is a translation process, I don't think keeping records of old versions is useful. because what the user should expect is the translation of the code. in case if some one need to switch to the original version, they can close it without saving and open it again. |
What do you think, is it needed to keep records of old versions. |
How different, usually, is the code after translating from js -> coffee -> js? |
"for" loops are unrolled into "while" loops and there are a bunch of It would be nice to fix js2coffee to do better on these; on the other hand On Sat, Sep 12, 2015 at 5:46 PM, Weihang Fan [email protected]
|
Hi Dinuka, I'm thinking of just going ahead and merging this "as-is" to get the functionality. Let me know if there are other things you'd like to change before I merge. |
var saved = {}, editor = paneState.editor, session = editor.session; | ||
saved.selection = session.selection.toJSON() | ||
saved.atend = session.selection.getCursor().row >= session.getLength() - 1; | ||
saved.folds = session.getAllFolds().map(function(fold) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was all this logic deleted as part of this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method had not used anyway according to my knowledge. And also it seems like a copy of another method. So, I saw them as useless things. Anyway, I'l check it again and let you know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidbau Do you have any idea about what these line are. And the need of them here. Appreciate if some one can help me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, so the call to set text is used via external API. The idea is that a tutorial website could set the text on a pencilcode program as part of a tutorial.
All the care with selections etc means that, if a student already has some code, setting the text will modify the code but keep the selection in the same place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidbau is it still required to keep records of selections and scrolled points even after changing the language. And would that be practical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, when changing languages we shouldn't keep selections and things like that. There should probably be an additional argument to this function to control whether it can discard selection. Switching language would set it to "true".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure @davidbau . But, I couldn't find any where else using this method. That's why I changed this. Anyway, it's better to keep a switch.
I would like if you don't merge this right now. Give me some more time to look into this. Because, I need to look into those issues we discussed earlier. |
No description provided.