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

Syntax error is thrown if there is any commented code #161

Open
KVPasupuleti opened this issue Feb 2, 2021 · 4 comments
Open

Syntax error is thrown if there is any commented code #161

KVPasupuleti opened this issue Feb 2, 2021 · 4 comments

Comments

@KVPasupuleti
Copy link

In my custom JS Console,

  • If we write a commented code in the last line, we are getting syntax error like this

syntax_error_console

multi_line_syntax_error_console

  • But, if we write it before the last line, it is working fine

no_syntax_error_console

It would be of great help if you suggest a solution for this

@remy
Copy link
Owner

remy commented Feb 2, 2021

Sounds like you've already got a solution for it, no?

@KVPasupuleti
Copy link
Author

😄 We are giving this to end users in our code playground.

My question is,
How to handle the above two cases if the user tries to write the code that way. Whereas, they are working fine in Chrome Dev Tools.

chrome_console

chrome_multiline_console

@remy
Copy link
Owner

remy commented Feb 2, 2021

I strongly suspect a parsing fault in the jsconsole ast logic. Happy to take a PR to resolve this, and I can publish to npm so it's consumable again

@KVPasupuleti
Copy link
Author

KVPasupuleti commented Feb 3, 2021

As per our use case, we resolved this issue by just appending a newline character to the command after it is sent to the run method in the run.js file.

export default async function run(inputCommand) { let command = inputCommand + '\n';

It is working as expected.

I Will keep a PR if the workaround is okay. 🙂

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

No branches or pull requests

2 participants