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

🚀[Feat]: Add Default Code for each Language #52

Closed

Conversation

jainaayush01
Copy link
Contributor

Issue #16

@vercel
Copy link

vercel bot commented Mar 13, 2021

@jainaayush01 is attempting to deploy a commit to a Personal Account owned by @kothariji on Vercel.

@kothariji first needs to authorize it.

@jainaayush01
Copy link
Contributor Author

Should I make a new PR and close this one Because I didn't saw the Contributing guidelines and haven't added a heading and description of commits in a proper way btw its self explanatory not much explanation is there but still let me know if there is something I need to do. Thanks for waiting!

@jainaayush01 jainaayush01 changed the title Add Default Code for each Language 🚀[Feat]: Add Default Code for each Language Mar 13, 2021
@vercel
Copy link

vercel bot commented Mar 13, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/kothariji/syntaxmeets/4bJG8CXxxbK2QVhHUF8wy4U4NCMY
✅ Preview: https://syntaxmeets-git-fork-jainaayush01-jainaayush01-patch-b1b819.vercel.app

@Vishv07
Copy link
Contributor

Vishv07 commented Mar 14, 2021

It would be better if you can implement the logic that will change the code in the editor when you select the diff language.

This would be totally fine too if you end up here.

Copy link
Owner

@kothariji kothariji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jainaayush01 thanks for creating the PR.

But there is a minor change, consider the scenario below.

Scenario - Consider there are two users working in C++, and suddenly one of them changes a language to JAVA, then the entire code is changed(i.e. default code of JAVA is displayed) affecting both the user. So this should not happen right.
Solution (I am able to think of) - once a user starts coding, even if he changes language, the current code should not wipe off, as it will affect another users right!.

Also currently whenever a new user joins, the entire code is replaced with the default code. So this is a bug we need to fix.

Thanks! 🚩

@Vishv07
Copy link
Contributor

Vishv07 commented Mar 14, 2021

We gotta implement cache layer sooner or later @kothariji

@kothariji
Copy link
Owner

kothariji commented Mar 14, 2021

We gotta implement cache layer sooner or later @kothariji

I swear, localStorage will be soon our best friend 😆 @Vishv07

@jainaayush01
Copy link
Contributor Author

Also when a user is already in the room if the Language is changed in one Room it is not reflected in the other.

The solution I am thinking of is: Keeping the code for each particular language in storage(or database) and if the user wants to come back to that particular language same code is visible. and when a new user joins a room the same settings of that room are displayed and not when we create a new room and also if the language is changed it also changes in another room (similar to code).

Thanks for highlighting all the bugs 🚩

@jainaayush01
Copy link
Contributor Author

I missed that scenario @kothariji.

@kothariji
Copy link
Owner

Also when a user is already in the room if the Language is changed in one Room it is not reflected in the other.

The solution I am thinking of is: Keeping the code for each particular language in storage(or database) and if the user wants to come back to that particular language same code is visible. and when a new user joins a room the same settings of that room are displayed and not when we create a new room and also if the language is changed it also changes in another room (similar to code).

Thanks for highlighting all the bugs 🚩

Yes, that too! 🙌

@kothariji kothariji added GSSOC21 Level3 New features, major bug fixing. (level 3) Work In Progress labels Mar 15, 2021
@Vishv07
Copy link
Contributor

Vishv07 commented Mar 15, 2021

Error while executing java code. Kindly check

@jainaayush01
Copy link
Contributor Author

image
why is this error coming on my localhost

@kothariji
Copy link
Owner

image
why is this error coming on my localhost

This might be because you local host may not be connected with backend, please check again

@jainaayush01
Copy link
Contributor Author

image
why is this error coming on my localhost

This might be because you local host may not be connected with backend, please check again

i don't understand what you are saying.
Like i have my server up and running on 4000 and my client is running on 3000.
is there a .env file that i have to setup?
and also i am seeing that this request is made to :3000

@jainaayush01
Copy link
Contributor Author

and also if anyone can help me how to solve this issue will be a great help (above comments).

@kothariji
Copy link
Owner

Hi @jainaayush01, as REDUX is implemented in our code, now we can think over this PR. Please let me know your thought on this

@jainaayush01
Copy link
Contributor Author

Yeah, I was thinking of this PR yesterday.
Now when I saw this from different perspectives, I think it isn't a good idea to change the code each time user changes the language because the thing is might be a user when started might have not noticed and have written code in java but when he changes language at that time his code will disappear, of course, he can get that by CTRL+Z but doesn't make any sense.

However, if we need to make this type of change, we can go like adding a button to add default language code for that particular language.
Please let me know your viewpoints.

@jainaayush01
Copy link
Contributor Author

By the way, Redux's work is done amazingly.

@kothariji
Copy link
Owner

Yeah, I was thinking of this PR yesterday.
Now when I saw this from different perspectives, I think it isn't a good idea to change the code each time user changes the language because the thing is might be a user when started might have not noticed and have written code in java but when he changes language at that time his code will disappear, of course, he can get that by CTRL+Z but doesn't make any sense.

However, if we need to make this type of change, we can go like adding a button to add default language code for that particular language.
Please let me know your viewpoints.

@jainaayush01, yeah I do agree with your point.
But we can have an alternative for that...what if we can have 19 different codes for 19 different languages. And when I am working in C++ only code of C++ will change, and if I switch to python , then python default code will be shown, and then if I again go back to cpp, then we get from where we left.

But I can smell a bug in this implementation.
Imagine a case when we both are working on a code in C++, then if I change language to python, then python default code will be shown, for both of us...and this will create a mess 😄

What's your take on this !!

@jainaayush01
Copy link
Contributor Author

It will be a mess because if we are working on a team we ain't gonna change the language frequently.

And we should let the each member decide which language they want to run and not change it if one of member changes the language. In Short letting members decide what they want to do.

@jainaayush01
Copy link
Contributor Author

Yes and only the user which has changed the language lastly will only be applicable to restore that code as CtRl +Z works for that person only

@kothariji
Copy link
Owner

Correct, so I think we should keep this PR on hold, and then If we get and good solution to this issue, we'll work on it. 🙌

Anyways, thank you so much working on this 🚀

@kothariji kothariji added the hold label Apr 7, 2021
@kothariji
Copy link
Owner

kothariji commented Apr 8, 2021

By the way, Redux's work is done amazingly.

Yes, honestly @Vishv07 did tremendous work.🙌🚀

@jainaayush01
Copy link
Contributor Author

Yup couldn't agree more!

@Vishv07
Copy link
Contributor

Vishv07 commented Apr 8, 2021

🥂 @kothariji @jainaayush01

@kothariji kothariji closed this Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Default Code for each Language
6 participants