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

Js2coffee Integration (issues/126) #193

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dinukadesilva
Copy link
Contributor

No description provided.

@dinukadesilva
Copy link
Contributor Author

An extra new line is introduced by the coffee script compiler.
Still I'm searching how to fix it

@davidbau
Copy link
Member

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",
Copy link
Member

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?

Copy link
Contributor Author

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

@dinukadesilva
Copy link
Contributor Author

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.

@dinukadesilva
Copy link
Contributor Author

What do you think, is it needed to keep records of old versions.

@weihang7
Copy link
Contributor

How different, usually, is the code after translating from js -> coffee -> js?

@davidbau
Copy link
Member

"for" loops are unrolled into "while" loops and there are a bunch of
superfluous extra "myvar = undefined"'s added. Try out the branch!

It would be nice to fix js2coffee to do better on these; on the other hand
this is already pretty neat functionality. What do you think, Frank?
Would you want to merge it?

On Sat, Sep 12, 2015 at 5:46 PM, Weihang Fan [email protected]
wrote:

How different, usually, is the code after translating from js -> coffee ->
js?


Reply to this email directly or view it on GitHub
#193 (comment)
.

@davidbau
Copy link
Member

davidbau commented Nov 8, 2015

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) {
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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".

Copy link
Contributor Author

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.

@dinukadesilva
Copy link
Contributor Author

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.

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.

3 participants