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

Automatic completion? #52

Open
tarruda opened this issue Aug 7, 2013 · 4 comments
Open

Automatic completion? #52

tarruda opened this issue Aug 7, 2013 · 4 comments

Comments

@tarruda
Copy link

tarruda commented Aug 7, 2013

I'm using this on a project that needs an in-browser javascript repl, and would like to add tab completion support.

After a quick search I didn't found any simple solution, so I will probably have to implement it from the scratch.

Could you give any hint/example of how this can be achieved?

@amasad
Copy link
Contributor

amasad commented Aug 8, 2013

There is an issue (#18) for adding support for emitting events so you can plugin into jqconsole and do things like tab completion. Needless to say, I haven't found the time to implement that. You have two options:

  1. Fork, and hack the source to implement your feature. You'd need to look in the private _HandleKey method.
  2. Fork, implement a general way of extending the console to do things like allowing user code to hook into key events and then send in a pull request :)

If you go withe second option, it could be something like triggering an event before handling the key. And then checking if default was prevented on the event:

var e = $.Event('keypressed');
$(this).trigger(e);
if (!e.isDefaultPrevented()) {
   // Handle the key in jqconsole. 
}

@arichiardi
Copy link
Contributor

@amasad is it really doable with only those few lines?
I woud be interested in adding the functionality, maybe adding to the event what it currently is at the prompt. My goal is to have real-time highlighting.

@amasad
Copy link
Contributor

amasad commented Nov 7, 2015

I can't remember, I haven't looked at this in a long time

@arichiardi
Copy link
Contributor

Yes it is PR #81 :)

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

3 participants