-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
remote: Support local terminals in remote projects #46532
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
remote: Support local terminals in remote projects #46532
Conversation
Veykril
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally sounds useful to me, one minor question.
| /// Creates a local terminal even if the project is remote. | ||
| /// Used for "breaking out" of remote to access local shell. | ||
| /// The terminal will open in the Zed process's current directory, | ||
| /// which is where Zed was launched from (if via CLI) or home directory (if via app icon). | ||
| pub fn create_local_terminal( | ||
| &mut self, | ||
| cx: &mut Context<Self>, | ||
| ) -> Task<Result<Entity<Terminal>>> { | ||
| self.create_terminal_shell_internal(None, true, cx) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this, that means if one uses the local terminal creation action in a local project one will not get a relevant working directory either way (despite having one available in theory). I feel like it'd be nice to make that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! That's been fixed in 8b3e4e0
Veykril
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Head branch was pushed to by a user without write access
This PR adds the ability to open local terminals when working in remote
projects. When working in a remote (often actually remoting into a local
container) I always need to run separate terminals outside Zed so I can
run local build tools, scripts, agents, etc. for the related project.
I'd like to be able to run all of these in the same Zed window and this
adds that ability via one-off local terminals.
## Changes
Adds an optional `local` parameter to terminal commands. When set to
`true`, creates a local shell on your machine instead of connecting to
the remote.
### Implementation
- Added `force_local` parameter to terminal creation logic
- Created `create_local_terminal()` method that bypasses remote client
- Updated terminal actions (`NewTerminal`, `NewCenterTerminal`) to
accept optional `local: bool` field (defaults to `false`)
### Usage
**Via keybinding:**
```json
{
"bindings": {
"cmd-t": "workspace::NewCenterTerminal",
"cmd-T": ["workspace::NewCenterTerminal", { "local": true }]
}
},
{
"context": "Terminal",
"bindings": {
"cmd-n": "workspace::NewTerminal",
"cmd-N": ["workspace::NewTerminal", { "local": true }],
},
},
```
**Behavior:**
- Default terminal commands continue to work as before (remote in remote
projects, local in local projects)
- The `local` parameter is optional and defaults to `false`
Release Notes:
- Added support for opening local terminals in remote projects via
`local` parameter on terminal commands.
This PR adds the ability to open local terminals when working in remote projects. When working in a remote (often actually remoting into a local container) I always need to run separate terminals outside Zed so I can run local build tools, scripts, agents, etc. for the related project. I'd like to be able to run all of these in the same Zed window and this adds that ability via one-off local terminals.
Changes
Adds an optional
localparameter to terminal commands. When set totrue, creates a local shell on your machine instead of connecting to the remote.Implementation
force_localparameter to terminal creation logiccreate_local_terminal()method that bypasses remote clientNewTerminal,NewCenterTerminal) to accept optionallocal: boolfield (defaults tofalse)Usage
Via keybinding:
{ "bindings": { "cmd-t": "workspace::NewCenterTerminal", "cmd-T": ["workspace::NewCenterTerminal", { "local": true }] } }, { "context": "Terminal", "bindings": { "cmd-n": "workspace::NewTerminal", "cmd-N": ["workspace::NewTerminal", { "local": true }], }, },Behavior:
localparameter is optional and defaults tofalseRelease Notes:
localparameter on terminal commands.