zed icon indicating copy to clipboard operation
zed copied to clipboard

Using detect_venv using Nushell as default shell doesn't automatically execute the command

Open Tom-Boscher opened this issue 11 months ago • 4 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

When using nushell as default and detect_venv, the overlay use "/Users/tom/Desktop/test_venv_activate_script/.venv/bin/activate.nu" command is prompted but not executed, we have to manually hit enter. Capture d’écran 2024-03-06 à 23 37 46

Otherwise using zsh the command is properly executed when a new terminal panel is opened. Capture d’écran 2024-03-06 à 23 25 13

Environment

Zed: v0.126.0 (Zed Preview) OS: macOS 14.3.1 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

Tom-Boscher avatar Mar 06 '24 22:03 Tom-Boscher

It seems similar to #8633. Do you think it's the same problem?

Moshyfawn avatar Mar 07 '24 04:03 Moshyfawn

This is unrelated to #8633, which is about getting the right environment when launching language servers. This here is about launching a terminal.

mrnugget avatar Mar 07 '24 04:03 mrnugget

let Some(activate_script) = activate_script {
            // Paths are not strings so we need to jump through some hoops to format the command without `format!`
            let mut command = Vec::from(activate_command.as_bytes());
            command.push(b' ');
            // Wrapping path in double quotes to catch spaces in folder name
            command.extend_from_slice(b"\"");
            command.extend_from_slice(activate_script.as_os_str().as_encoded_bytes());
            command.extend_from_slice(b"\"");
            // Exectute the command
            command.push(b'\n');

            terminal_handle.update(cx, |this, _| this.input_bytes(command));
        }

This works fine for zsh but doesn't work for Nushell, I don't know why yet

Tom-Boscher avatar Apr 04 '24 22:04 Tom-Boscher

I didn't have time to run other tests but command.push(b'\n'); which add return to line to the vector to execute the command doesn't work for Nushell but works for zsh

Tom-Boscher avatar Apr 11 '24 23:04 Tom-Boscher