zed/crates
Joseph T. Lyons c1fd648390
Add setting to automatically enable virtual environment (#2882)
This isn't ready to go - I'm opening a PR to ask for some advice. When
activating a python virtual environment, the typical command used is
`source path_to_venv/bin/activate`. The problem is, the activatate
script isn't portable to all shells, so some additional scripts are
bundled in the env, for example, `activate.fish`. We don't have a good
way of knowing what shell we are in, in order to know what script to
run.

Julia gave the alternative of simply activating the virtual environment
while in the zsh context, before the user's custom shell is launched,
which I think does work, but because we activate the virtual environment
before we launch the custom shell, the shell isn't really aware that we
are in the virtual environment and it fails to display the information
in the prompt that is typically shown after activating.

Is there a clean way for us to know for a fact what shell is being ran,
so we know what script to run?

Check out the code comments below for more context.

---


https://github.com/zed-industries/zed/assets/19867440/ddb76aaa-152b-4c93-a513-3cd580b7c40f

I've used Zed to write Python scripts, but working on an actual project
has really magnified where Python dev is falling short. A huge
quality-of-life thing we can do is provide a setting to automaticaly
search for and activate virtual environments when found, when terminals
are created. Manually starting these up in every terminal instance is
such a drag.

A few quirks:
- We don't have a way of knowing if the prompt is ready before we try
run the command, which means we see the text inserted at the top of the
terminal and on the prompt - I dont think this should be a blocker
though.
- If a user has multiple python projects with mutliple virtual
environments, we only detect and activate the first one, since can't
really make any assumptions about which one to activate. I dont think
this should be a blocker either, as I think most users will have a
single project open in Zed.

Release Notes:

- Added a `detect_venv` setting for the terminal. When configured, the
Zed terminal will automatically activate Python virtual environments on
terminal creation.
2023-08-25 15:14:24 -04:00
..
activity_indicator Add components example 2023-08-15 03:06:43 -07:00
ai Format let-else statements 2023-08-25 10:11:32 -07:00
audio chore: remove unused features from rodio crate. (#2869) 2023-08-21 11:07:31 +02:00
auto_update Add components example 2023-08-15 03:06:43 -07:00
breadcrumbs Add components example 2023-08-15 03:06:43 -07:00
call Format let-else statements 2023-08-25 10:11:32 -07:00
channel Make channel notes read-only when disconnected 2023-08-24 16:50:13 -07:00
cli Prevent duplicate instances by coordinating via a socket 2023-07-07 14:19:44 -04:00
client Add buffer integration test 2023-08-23 18:34:43 -07:00
clock Fixed a bug where buffer saved clocks would desynchronize in rare execution paths 2023-06-07 16:10:45 -07:00
collab Format let-else statements 2023-08-25 10:11:32 -07:00
collab_ui Format let-else statements 2023-08-25 10:11:32 -07:00
collections Move command palette filter into collections crate 2023-03-28 20:13:17 -07:00
command_palette Move more window methods off AsyncAppContext 2023-08-08 11:38:07 -06:00
component_test Merge branch 'main' into disclosable-component 2023-08-23 16:30:27 -07:00
context_menu Add components example 2023-08-15 03:06:43 -07:00
copilot Add components example 2023-08-15 03:06:43 -07:00
copilot_button Add components example 2023-08-15 03:06:43 -07:00
db Simplify db tests 2023-07-14 16:09:02 -07:00
diagnostics Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
drag_and_drop Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
editor Format let-else statements 2023-08-25 10:11:32 -07:00
feedback Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
file_finder Store an AnyWindowHandle in WindowContext 2023-08-08 11:08:37 -06:00
fs Fix pathspec in staged_statuses 2023-07-23 21:36:29 -07:00
fsevent 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
fuzzy remove commented line 2023-02-27 12:06:10 -08:00
git Clean up final remaining code paths calling old diff update method 2023-05-25 14:41:09 -04:00
go_to_line Store an AnyWindowHandle in WindowContext 2023-08-08 11:08:37 -06:00
gpui Format let-else statements 2023-08-25 10:11:32 -07:00
gpui_macros Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
install_cli Remove potential osascript hijacking 2023-08-18 17:40:08 -07:00
journal Enable test-support on editor in tests 2023-05-20 09:54:38 -06:00
language Fix rust 1.72 warnings about shadowed glob re-exports 2023-08-25 10:25:21 -07:00
language_selector Add components example 2023-08-15 03:06:43 -07:00
language_tools Format let-else statements 2023-08-25 10:11:32 -07:00
live_kit_client Put LiveKitBridge Swift build directory in target 2023-07-28 18:53:24 -04:00
live_kit_server 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
lsp Fix rust 1.72 warnings about shadowed glob re-exports 2023-08-25 10:25:21 -07:00
media Update rust-bindgen dev-dependencies 2023-06-04 23:34:22 -04:00
menu Position and style the channel editor correctly 2023-08-08 14:06:29 -07:00
node_runtime Reattempt Node installation if the installation itself errors 2023-07-28 15:24:40 -04:00
outline feat(workspace): allow alternative actions to open files and symbols in split 2023-07-14 21:49:15 +02:00
picker Merge branch 'main' into collab-panel 2023-08-15 03:25:45 -07:00
plugin 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
plugin_macros Fix typos 2023-06-02 22:02:19 -04:00
plugin_runtime Fix typos 2023-06-02 22:02:19 -04:00
project Add setting to automatically enable virtual environment (#2882) 2023-08-25 15:14:24 -04:00
project_panel Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
project_symbols Remove TestAppContext::add_view 2023-08-07 22:46:48 -06:00
quick_action_bar Format let-else statements 2023-08-25 10:11:32 -07:00
recent_projects WIP 2023-08-10 10:26:48 -06:00
refineable Mark new crates as publish = false 2023-08-22 20:47:05 -06:00
rope Simplify InlayMap::splice interface 2023-06-29 22:25:49 +03:00
rpc Rebase fixes 2023-08-25 14:30:07 +03:00
search Format let-else statements 2023-08-25 10:11:32 -07:00
semantic_index Format let-else statements 2023-08-25 10:11:32 -07:00
settings Format let-else statements 2023-08-25 10:11:32 -07:00
snippet 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
sqlez Fix typos 2023-06-02 22:02:19 -04:00
sqlez_macros 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
staff_mode 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
sum_tree Ensure collaborators cursor colors are the same in channel buffers as in projects 2023-08-24 11:31:41 -07:00
terminal WIP 2023-08-25 15:06:31 -04:00
terminal_view WIP 2023-08-25 15:06:31 -04:00
text Snapshot channel notes buffers when everyone leaves 2023-08-23 18:37:01 -07:00
theme Ensure collaborators cursor colors are the same in channel buffers as in projects 2023-08-24 11:31:41 -07:00
theme_selector feat(workspace): allow alternative actions to open files and symbols in split 2023-07-14 21:49:15 +02:00
util Fix code that identifies language via extension 2023-08-08 21:35:11 -04:00
vcs_menu Format let-else statements 2023-08-25 10:11:32 -07:00
vim Fix zed-industries/community#1950 2023-08-25 11:34:07 -06:00
welcome WIP 2023-08-10 10:26:48 -06:00
workspace Format let-else statements 2023-08-25 10:11:32 -07:00
xtask Fixup xtask compilation 2023-06-22 18:06:52 +02:00
zed Format let-else statements 2023-08-25 10:11:32 -07:00
zed-actions Add Sign in button for an unregistered user 2023-06-15 22:05:43 -07:00