matlab_kernel
matlab_kernel copied to clipboard
filesystem completions always relative to root directory of jupyter
A fairly significant annoyance is that file system completions are all relative to the directory the kernel starts up in as opposed to the working directory. So, while cd
works properly to change the working directory for any code that is run through the matlab engine, the auto-complete always thinks your working directory is the directory the kernel started up in. At least that's what happens for me on 2019b. I looked into this a little bit and came up empty for a fix.
This is something Jupyter does explicitly for all kernels.
I'm not sure we're on the same page with this so just wanted to give a concrete example because I don't think the behavior is the same for the python kernel. E.g. suppose my home directory is /home/kb1ooo
and is where I run the jupyter server from. And suppose I have the following sub directories
/home/kb1ooo/tmp
/home/kb1ooo/tmp/baby
When I start up a matlab kernel and type cd tmp
in a cell and run it, then type pwd
in another cell and run it, I get
ans =
'/home/kb1ooo/tmp'
as expected. If I then type cd ba
and then hit tab to get completions, it doesn't give me 'baby' as a possible completion (unless I also happen to have a '/home/kb1ooo/baby' directory). So, from the perspective of the file system tab completion, my working directory is always /home/kb1ooo
, in spite of the fact that pwd
returns the proper working directory. This does not happen in a python kernel where if I run the exact same cells, I get 'baby' as a tab completion as expected.
Ahh, the logic for path completion is here. I'm not sure why .
isn't resolving to the cwd
of the kernel.
Ok, I hadn't realized that the filesystem completion didn't come from the kernel's get_completions
. Can you confirm that this same behavior happens for you with this kernel? I assume it doesn't happen for other kernels built using metakernel?
I don't actually have a copy of Matlab. I just confirmed that the Octave kernel is working as expected.