Open johanrosenkilde opened 7 years ago
It is already possible if you use auto-complete-sage (available from Melpa) or company-sage (not available from Melpa). But they are not tab completion but auto-completion. They just complete global objects in the shell session. Of cource it is easy to implement tab completion in a sage-mode buffer.
OK, thank you! auto-complete-sage
looks very impressive :-)
I added a completion-at-point
function for sage-shell:sage-mode
in 52bf492946726bfbcc127fcc32a3ad2c935ce25a. But I guess using ac-sage
with emacs-jedi or company-mode with anaconda-mode would be more convenient.
@stakemori I am wondering are you still working on it. It seems that this doesn't work.
@iromise, the implementation was done in 2016. But this is still open because I am lazy. To use this feature, please make sure that a Sage process is running in Emacs and sage-shell:process-buffer
is set.
The variable sage-shell:process-buffer
is automatically set when you load a buffer, region or file to the process buffer. You can also set the variable explicitly by M-x sage-shell:set-process-buffer
.
But it seems not ok.. for example
from sage.all import *
m = matrix([1, 2])
m.
I can not get complete at m.
...
@iromise, currently, completion-at-point
in a sage-mode buffer only completes global variables and does not complete methods of global/local variables. In a Sage process buffer, it is possible to complete methods of m
if m = matrix([1, 2])
is already evaluated. sage-shell-mode
does not evaluate user's code that calls methods/functions since it is unsafe. So to complete methods in a sage-mode buffer, I think it is necessary to parse Python and Cython modules and it seems difficult for me. And I am not working on it.
For what it's worth, packages such as jedi.el
or anaconda-mode
provide auto completion for pure Python objects. They can complete methods of variables to some extent.
Ok, thanks a lot. I will try it.
It should be possible to link the completion library with the Sage process in the background to provide tab-completion while editing a
sage-shell:sage-mode
file.Already now we have Eldoc integration in
sage-shell:sage-mode
files, which is awesome, and demonstrates that the plumbing for this sort of communication is already there.