Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
"pick" event for hint doesn't seem to fire properly. #4729
I registered a helper for hint.. (CodeMirror.registerHelper("hint", "lua", function() ...)
and I got it working, but the "pick" event described in the docs didn't fire when I hooked up this:
If you look at the code here: https://github.com/codemirror/CodeMirror/blob/master/addon/hint/show-hint.js#L88
... you'll see that the first parameter to signal seems to be data, which is what is returned from my helper.
However, if I change "data" to "this.cm" ... the signal I connected then works.
Which seems logical, the editor should be the object sending the signal. There are other places in show-hint.js where signals are sent with data instead of a CodeMirror instance, too, so I think it's a pervasive problem.
Anyhow, maybe I'm wrong but this is what worked for me.
Hi, you should register the handler this on the completion result, i.e. on the object that's returned from your hint source function. There is an
Thanks for the reply!
OK, so you would do something like
I can definitely do this, but this seems different than how other
Ah, OK, you're right it is, apologies. It says...
It's just very quickly mentioned and "completions object" is what's referenced above as:
This all makes sense if you understand how the plugin works, but the documentation is pretty spartan and the "example" demo isn't very informative.
I got confused because the mention was so brief and the documentation for signals for CM is all referencing events from the editor.