1 year ago
#387180
sunnysnow.hi
How to open a specified ssh host and get connect result or error message in my extension?
In my extensionm, I want to call remote-ssh api to open a remote host in a new window, and then get the connect result and error message, and then I want to parse the error message and suggest some fixes to users. First I tried this method:
vscode.commands.executeCommand('opensshremotes.openEmptyWindow')
But this method requires the user to select a host instead of directly opening the specified host,which is not what I need. Then I used a method which was found in an issue (But I didn't find any API documentation about this) :
const response = vscode.commands.executeCommand("vscode.newWindow", {
remoteAuthority: `ssh-remote+${sshName}`
}
This method can open the specified host, but I can not get result of it. So I want to ask:
- What is the recommended way to open a specified ssh host by code?
- How to get the error message, such as connect timeout or permission denied ?
Thank you~
visual-studio-code
vscode-extensions
vscode-remote
vscode-remote-ssh
0 Answers
Your Answer