n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

";" suggests autocomplete to "$$" #143

Closed mdjaere closed 6 years ago

mdjaere commented 6 years ago

Hi, Thanks for a great project.

I am using the Atom Hydrogen plugin with https://www.npmjs.com/package/itypescript, which is built on IJavascript. When ending the line with a semicolon, it suggests autocompletion to $$. Is this intentional or accidental?

Thank you

n-riesco commented 6 years ago

Yes, it's intentional. After a ;, IJavascript (and ITypescript) include all global variables and keywords in the autocompletion list.

$$ is an important global variable for IJavascript. It's provided by IJavascript so that users can communicate with frontends (hydrogen, nteract, Jupyter notebook, ...).

$$ allows the user to customise an execution result or provide it asynchronously. For more details, see the documentation: doc/async.ipynb and doc/custom.ipynb.

$$ also provides other experimental functionality, like $$.input() and $$.display(), but I haven't documented them yet.

mdjaere commented 6 years ago

Thanks for the explanation! It makes sense to have variables and keywords available, but I'm not sure it improves the user experience in this case. In JS you'll often use a ; followed by a line feed, but now, if you're not careful, you'll end up with $$, losing the line feed. Slightly confusing and hinders coding flow IMO. I am not sure how the system works, but you might want some exclusions/inclusions on what triggers auto-suggestions.

n-riesco commented 6 years ago

This is usually handled by the frontend (in your case, I guess, it's Hydrogen).

I've just opened a request on Hydrogen's repo. See https://github.com/nteract/hydrogen/issues/1198 .

mdjaere commented 6 years ago

Yep, it's Hydrogen. They sent me here. Thanks for the update and follow-up.

n-riesco commented 6 years ago

@mdjaere Note that this issue isn't specific to IJavascript, the python kernel also shows globals and keywords after ;. That's the reason why I think, it should be handled at frontend level.

mdjaere commented 6 years ago

That makes sense, thanks for clearing up. I'll close this now.