-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: SSH Terminal to folder #26
Comments
That's something I'm planning on doing quite soon. It's a little bit of a challenge, as the extension API requires me to spawn a process, e.g. the The requirement to have a custom program, while assuming node/ssh/plink isn't available, seems like the biggest challenge here. It's definitely something I'm planning on finishing soon. |
Great! |
Probably gonna wait until the |
Well, my function assume that you have an ssh client install on your computer. |
Any way of making use of the SSHTerminal extension? Maybe combining the two together? |
I tried to use the SSHTerminal extension, but the issue is that you need to configure SSHTerminal as weel with your credentials. I have plenty of configurations and maintain a config for each extension is not possible. The function I wrote use the same method as SSHTerminal Extension, it is simply writing in the VSCode default terminal, "ssh hostname -l username and some other params if necessary". Moreover, It allow you to open a terminal using the same method as opening a workspace with SSH FS, right click and choose the action you want. With SSHTerminal you couldn't do that. |
Feedback added to your pull request (#61) Short version: The requirement of having |
So for Win 10, ssh.exe does exist by default thanks to OpenSSH being ported though that is still a WIP, but works well enough on it's own minus some edge cases of course. But for previous versions of Windows, you'll need to install manually from the project download page. If you want to automate that installation somehow if they aren't running Win 10 that would be helpful. if they are running win 10 then it's simply a matter of enabling the feature and running updates. |
In my case I do not have ssh install on my computer. I use git bash that does the work pretty well. |
That is an acceptable workaround. I'll eventually need to get it...but sometimes I need to ssh without the use of git for other purposes (i have a multi-purpose role) so a MS solution for ssh is preferred as it doesn't have any dependencies other than running a .ps1 to install. |
I'm running Windows 10 but don't have OpenSSH (or any ssh.exe I can find). The only thing related that I have are Right now, with the extension supporting PuTTY sessions, it's easy to use those for the extension, while also allowing you to open a terminal and run |
Ok so not all versions of Windows 10 have it but you can install under Features and Components. you'll find it isn't far from the WSL feature. But if you're running a version of Win 10 that doesn't have the enabling feature, same steps apply as other windows versions for installing openssh. Recommend the latest build if possible as it's first appearance as beta was in 16299 I believe. There are steps to update from what's passed into the kernel for installing as a feature that apply to all windows OS's without having to download again. https://github.com/PowerShell/Win32-OpenSSH/wiki/How-to-retrieve-links-to-latest-packages |
I don't have that feature available yet, but a quick search uncovered that I require the April 2018 update, which I haven't installed yet. But again, it's unlikely people can use this and have it enabled. I'm looking forward to TerminalProvider, which would be a solid solution that makes implementing this enhancement (for all systems) possible. |
Using the latest PSCore 6.1 (because it's better than Win-PS for 7), navigating to the directory that ssh.exe lives in, I successfully managed to use ssh to my Linux box and view my project. Time to get rid of that sshterminal extension. |
Is it somehow possible to pass config values to the terminal? I'd like to run something like: |
I just had another great idea. |
@Morgy93 you actually want |
Has there been any update on this? |
Based on the milestones in microsoft/vscode#67923, the TerminalRenderer API won't be officially released before March, assuming the planned milestone doesn't change. |
I don't particular need this functionality (I arrived in this thread by mistake while looking for a solution to a different problem that I'm having) but I have an idea that seems simpler and easier to implement than what hasbeen suggested so far. While I gather the original request is for spawning an external SSH Terminal window, if there are no objections to using the integrated terminal, you could simply shift focus to that and execute a call to ssh, piping the appropriate parameters from the SSH-FS config..? I'm not sure how you store/access the configuration settings, but if it's in a json file on the local filesystem, you could import/require that file, read the ssh settings, and then call workbench.action.terminal.sendSequence("ssh " + args). Probably need to check if there is an active terminal and create one if there isn't. This assumes that ssh is present on the system and registered, but that should be the case for most people using SSH-FS. (For example, having OpenSSH installed on Windows 10 makes it available.) |
Just realized, since this is functionality being added to the SSH-FS extension, you probably already have the address, port, and security config loaded into the extension. Also, it shouldn't be hard to spawn an external shell either. |
The problem isn't the SSH shell itself, as part of initiating the filesystem is creating a SFTP session over a SSH session. It's having it be rendered in the integrated terminal. Currently the extension API only allows creating terminals for external programs/shells. Remember that this has to be cross-platform, and not every computer, especially Windows ones, don't have the (same) ssh command available on path. I currently can't create a SSH connection and have it "render" in the integrated terminal. Not yet, at least (microsoft/vscode#67923) |
I suppose you could try 'ssh' and just report to the user that it's missing from their path if it fails, but that would definitely be a sub-optimal workaround compared to what you're trying to achieve. Again, sorry for sticking my nose into things without doing any research. |
Part of the problem is indeed it missing for some users. Another problem, although I doubt a less common one, is that some ssh installations might be missing certain command line parameters, or parse/handle them differently. Another "issue" is that I'd want to use the ssh2 library I use for creating the SFTP session. For the SFTP session, I first also create a SSH session. Programming wise, it seems weird to use two different ways of starting SSH (library packed in the extension VS ssh on the local system), especially since that might lead to issues of SFTP working but not the SSH terminal, and the other way around. Basically, it's better to wait until vscode adds an API that allows me to connect the ssh2 library I use to the terminal, without the need for an external program. And since they're already working on such a feature (microsoft/vscode#67923), it's definitely better to wait until that feature is released, instead of basically "hacking" this together using local ssh binaries, proxy programs, ... |
I'd really love to have this configurable, to not get forced on something. |
Similar to how there is a While this is fine for just a terminal, it's difficult to implement and doesn't have much use. If it's just for a ssh terminal, you're better off manually running the command, or adding it as a task in vscode. |
The task thingy looks interesting. |
I've quickly looked into providing command variables, e.g. allowing After a bit of investigating, it seems like using What I could implement, is something like this: {
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "ssh",
"type": "shell",
"command": "ssh ${input:username}:${input:host}",
"group": {
"kind": "build",
"isDefault": true
}
}
],
"inputs": [
{
"type": "command",
"command": "sshfs.echo",
"id": "username",
"args": {
"field": "username"
}
},
{
"type": "command",
"command": "sshfs.echo",
"id": "host",
"args": {
"field": "host"
}
}
]
} Alternatively, I could do something like Basically, there just isn't an easy way to implement this. If you're on Windows and are using PuTTY, you can use a ssh fs config with Also, |
My other idea was to expose the extension's internal mechanism for creating ssh extensions as a callable, i.e. some function or command the user can simply execute from the terminal. I looked through the extension API docs for a while though and didn't see anyway to do this. I was thinking something like how a npm module can be called from the command line. |
@SchoofsKelvin Aside from my note on the related PR, there's another new API that may be of interest that we may need or want: microsoft/vscode#75455 which implements a Shell API. To get idea of how it should look, the python extension is already done most of the work on getting it implemented on their end: microsoft/vscode-python#6403 |
any updates on this? I love how i can edit a remote file but if i want to run it in the terminal its not the remote server its my local |
I really honor the work of @SchoofsKelvin here, but basically this extension is now obsolete because of an extension by Microsoft itself: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack https://github.com/Microsoft/vscode-remote-release I thinks it's fair to "advertise" here since it's done by Microsoft itself and we're all a friendly and forward thinking open source community. |
Indeed, and you do realize that the remote ssh extension is NOT open source. So an open source alternative would be preferable for many. The terminal is part of this but the major drawback is the remote-ssh extension does allow other extensions to be installed onto the remote host so they can be used. This is not currently possible with this extension. Still should be possible to get the extensions to work in an open-source implementation. We just need someone willing to contribute other than @SchoofsKelvin . |
any updates on SSH Terminal ? |
Terminal got added in v1.18.0 (dea6a03...e8ffe0e) I've made use of vscode's new PseudoTerminal API to allow creating terminals that directly make use of the existing connection algorithms. If your configuration works for file systems, it should work for terminals too. No extra hassle. The new feature still lacks a few quality of live improvements. Opening a terminal will use the user's home directory as working directory, similar to what would happen if you connected to a server directly over ssh. In the future, I might add the "Right click folder in explorer > Open remote terminal" feature, along with that opening a terminal for a host should actually set the working directory to its |
Added in ffef5c6, soon available in v1.18.1 of the extension:
|
It would be great if the extension could provide a SSH Terminal window for a configured remote directory.
The text was updated successfully, but these errors were encountered: