Open rudimk opened 9 years ago
Yes I've thought about this and I think it's a direction the project will ultimately go. The main issue is that I can't figure out how to get the IPython kernel to return values for autocompletion. Right now we're using jedi https://github.com/yhat/rodeo/blob/master/rodeo/kernel.py#L23-L41https://github.com/yhat/rodeo/blob/master/rodeo/kernel.py#L158-L163 which obviously only works with Python.
If we can get the autocompletion working, the UI changes are fairly trivial.
@glamp
You need to call client.complete and read msgs on the shell_channel. This should more or less work with ipython 3+
def complete(self, code):
s = self.client.complete(code)
msg = self.client.get_shell_msg(timeout=0.1)
results = [{"text":"", "dtype":"---"}]
for completion in msg['content']['matches']:
result = {
"text": completion,
"dtype": "---"
}
if code.endswith("."):
result["dtype"] = "function"
else:
result["dtype"] = "session variable" # type(globals().get(code)).__name__
results.append(result)
return results
If you plan to support older ipython versions, then this may help - https://github.com/ivanov/vim-ipython/blob/master/ftplugin/python/vim_ipython.py#L302
Hmm... I put together some really poor code that gets autocomplete going via ipython kernel in rodeo. However, I now realize that this requires the same sort of checking for msg_ids and kernel states as implemented in
_run_code()
Basically, its everything in the codeblock above, plus checking that msg_ids match and also setting the output to the same json structure as the output of _run_code()
It might be better to do this in _run_code.
@glamp What do you think?
if it works then do a PR!
For a pointer re starting non-python kernels: You can use the MultiKernelManager
to start one of the available kernels. The available kernels can be seen via the KernelSpecManager
(see here: https://github.com/JanSchulz/knitpy/blob/master/knitpy/knitpy.py#L102 and the following commented line)
How to start a new kernel via the kernel manager: https://github.com/JanSchulz/knitpy/blob/master/knitpy/knitpy.py#L640
-> if the current kernel startup would be replaced with one via MultiKernelManager, then adding a new kernel is just a few lines of code and the UI to choose one.
Wow. Let's do this! I'll try and push out something from my end too.
now using ipython kernel for autocomplete 610fd4fb0582bd9adeb4903bc3a7745cab90cd86
Has there been any progress? Would really love to use rodeo with scala and R on spark.
I second @quantsignals
Any progress? Would like support for Go.
A bit of progress, though SQL and R will likely be next.
It would be awesome to have support for Julia!
Seeing that rodeo uses a Jupyter/IPython kernel behind the scenes, are there any plans to support languages like R & Julia, which already have kernels built for Jupyter/IPython? If not, would love some pointers on how one could plug them in - although it should be easy enough, will involve modifying
kernel.py
by the looks of it.