Closed carlca closed 6 years ago
I've been looking at the source for this and it seems that these are the relevant lines:
var dir = path.dirname(uri.fsPath);
var terminal = vscode.window.createTerminal();
terminal.show(false);
terminal.sendText('cd "' + dir + '"');
The change of directory is being achieved by sending the text. Does the terminal
object have some kind of path
property which would achieve the same thing but silently? VSCode shows lots of things if I type terminal. Ctrl+[space]
but it's not clear what types the attributes actually are.
Answered on Twitter.
For anyone else reading this, Daniel's responses were:
@carlcaulkett @code That's just how bash/zsh take it. It works the same way as typing it as the prompt is initialising with will also duplicate the line.
and
@carlcaulkett @code Eventually the cd will go away all together when there's an api added for setting the terminals cwd
The cwd
api has been added in case anyone wants to submit a PR for macOS bash.
I already submitted a patch for windows
macOS 10.13.1 High Sierra 1.18.1 VSCode (stable) 1.19.0 VSCode (insiders)
Hi Daniel, I’ve just installed your Terminal Here extension and it works well. Just one visual glitch, it shows the
cd
command twice. See attached image. Better if there was just be the onecd
, and even better if that was> /dev/null
. Silent, in other words!