Problems running jupyterlab_open_in_terminal_extension on Windows

I found the extension jupyterlab_open_in_terminal_extension that allows you to open a terminal in the directory of a file you right-click from the file browser.

Unfortunately I have a lot of problems running it on Windows.

For instance, it doesn’t work from the user directory. Looks like ~ is not expanded into a full path.

Also, it doesn’t work if the path contains square brackets ([). Looks like in Windows you need to escape those.

I went in the source code after the path is retrieved from the file browser but before the terminal is opened and added this code to try to convert relative path into absolute one and resolve the ~, but nothing:

// Change relative path into absolute path
let targetPathOld: string = targetPath;
let serverRoot: string = PageConfig.getOption('serverRoot');
targetPath = PathExt.resolve(serverRoot, targetPath);
console.log(`Resolved into absolute path: ${targetPathOld} -> ${targetPath}`);

targetPathOld = targetPath;
// These are grave accents (U+0060), not backticks `
//targetPath = targetPath.replace("[", "`[");
//targetPath = targetPath.replace("]", "`]");
//console.log(`Escaped square brackets: ${targetPathOld} -> ${targetPath}`);

Maybe you could have a better success trying the built-in behavior from JupyterLab 4.6.0 pre-releases? It was added in Add 'Open in Terminal' from file browser context menu by MUFFANUJ · Pull Request #18274 · jupyterlab/jupyterlab · GitHub and alpha builds are already available, we will transition to beta early next month.

Nope, it has the exact same problems :slight_smile:

Would you mind opening an issue on Issues · jupyterlab/jupyterlab · GitHub in that case? It feels more likely to get addressed if reported there as quite a few more folks look at the issues.