Tyriar / vscode-terminal-here

VS Code extensions that creates an integrated terminal session at the current file's directory
https://marketplace.visualstudio.com/items?itemName=Tyriar.vscode-terminal-here
33 stars 11 forks source link

Visual glitch #7

Closed carlca closed 6 years ago

carlca commented 6 years ago

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 one cd, and even better if that was > /dev/null. Silent, in other words!

screen shot 2017-11-27 at 21 18 24

carlca commented 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.

carlca commented 6 years ago

Answered on Twitter.

carlca commented 6 years ago

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

DRSDavidSoft commented 5 years ago

The cwd api has been added in case anyone wants to submit a PR for macOS bash. I already submitted a patch for windows