Add REPL dropdown menu to toolbar (#14493)

TODO: 


- [x] Actions run from menu not firing
- [x] Menu differentiates idle and busy for running kernel

Menu States:
- [x] No session && no support known

No session && no kernel installed for languages of known support
- (TODO after) Intro to REPL
- [x] Link to docs

No session but can start one
- [x] Start REPL
- (TODO after) More info -> Docs?

Yes Session

- [x] Info: Kernel name, language
  example: chatlab-3.7-adsf87fsa (Python)
  example: condapy-3.7 (Python)
- [x] Change Kernel -> https://zed.dev/docs/repl#change-kernel
- ---
- [x] Run
- [x] Interrupt
- [x] Clear Outputs
- ---
- [x] Shutdown


(Release notes left empty as the change will be documented in the REPL
release!)

Reserved for a follow on PR:

```
- [ ] Status should update when the menu is open (missing `cx.notify`?)
- [ ] Shutdown all kernels action
- [ ] Restart action
- [ ] [Default kernel changed - restart (this kernel) to apply] // todo!(kyle): need some kind of state thing that says if this has happened
```


Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
Nate Butler 2024-07-15 14:55:49 -04:00 committed by GitHub
parent 1856320516
commit fa3d29087d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 489 additions and 71 deletions

View file

@ -370,6 +370,14 @@ impl ButtonLike {
}
}
pub fn new_rounded_left(id: impl Into<ElementId>) -> Self {
Self::new(id).rounding(ButtonLikeRounding::Left)
}
pub fn new_rounded_right(id: impl Into<ElementId>) -> Self {
Self::new(id).rounding(ButtonLikeRounding::Right)
}
pub(crate) fn height(mut self, height: DefiniteLength) -> Self {
self.height = Some(height);
self

View file

@ -91,7 +91,7 @@ impl IconSize {
}
#[derive(
Debug, Eq, PartialEq, Copy, Clone, EnumIter, EnumString, IntoStaticStr, Serialize, Deserialize,
Debug, PartialEq, Eq, Copy, Clone, EnumIter, EnumString, IntoStaticStr, Serialize, Deserialize,
)]
pub enum IconName {
Ai,
@ -118,6 +118,8 @@ pub enum IconName {
CaseSensitive,
Check,
ChevronDown,
/// This chevron indicates a popover menu.
ChevronDownSmall,
ChevronLeft,
ChevronRight,
ChevronUp,
@ -160,11 +162,11 @@ pub enum IconName {
Font,
FontSize,
FontWeight,
GenericClose,
GenericMaximize,
GenericMinimize,
GenericRestore,
Github,
GenericMinimize,
GenericMaximize,
GenericClose,
GenericRestore,
Hash,
HistoryRerun,
Indicator,
@ -194,9 +196,6 @@ pub enum IconName {
PullRequest,
Quote,
Regex,
ReplPlay,
ReplOff,
ReplPause,
ReplNeutral,
Replace,
ReplaceAll,
@ -235,12 +234,12 @@ pub enum IconName {
Trash,
TriangleRight,
Update,
Visible,
WholeWord,
XCircle,
ZedAssistant,
ZedAssistantFilled,
ZedXCopilot,
Visible,
}
impl IconName {
@ -270,6 +269,7 @@ impl IconName {
IconName::CaseSensitive => "icons/case_insensitive.svg",
IconName::Check => "icons/check.svg",
IconName::ChevronDown => "icons/chevron_down.svg",
IconName::ChevronDownSmall => "icons/chevron_down_small.svg",
IconName::ChevronLeft => "icons/chevron_left.svg",
IconName::ChevronRight => "icons/chevron_right.svg",
IconName::ChevronUp => "icons/chevron_up.svg",
@ -312,11 +312,11 @@ impl IconName {
IconName::Font => "icons/font.svg",
IconName::FontSize => "icons/font_size.svg",
IconName::FontWeight => "icons/font_weight.svg",
IconName::GenericClose => "icons/generic_close.svg",
IconName::GenericMaximize => "icons/generic_maximize.svg",
IconName::GenericMinimize => "icons/generic_minimize.svg",
IconName::GenericRestore => "icons/generic_restore.svg",
IconName::Github => "icons/github.svg",
IconName::GenericMinimize => "icons/generic_minimize.svg",
IconName::GenericMaximize => "icons/generic_maximize.svg",
IconName::GenericClose => "icons/generic_close.svg",
IconName::GenericRestore => "icons/generic_restore.svg",
IconName::Hash => "icons/hash.svg",
IconName::HistoryRerun => "icons/history_rerun.svg",
IconName::Indicator => "icons/indicator.svg",
@ -346,10 +346,7 @@ impl IconName {
IconName::PullRequest => "icons/pull_request.svg",
IconName::Quote => "icons/quote.svg",
IconName::Regex => "icons/regex.svg",
IconName::ReplPlay => "icons/repl_play.svg",
IconName::ReplPause => "icons/repl_pause.svg",
IconName::ReplNeutral => "icons/repl_neutral.svg",
IconName::ReplOff => "icons/repl_off.svg",
IconName::Replace => "icons/replace.svg",
IconName::ReplaceAll => "icons/replace_all.svg",
IconName::ReplaceNext => "icons/replace_next.svg",
@ -387,12 +384,12 @@ impl IconName {
IconName::Trash => "icons/trash.svg",
IconName::TriangleRight => "icons/triangle_right.svg",
IconName::Update => "icons/update.svg",
IconName::Visible => "icons/visible.svg",
IconName::WholeWord => "icons/word_search.svg",
IconName::XCircle => "icons/error.svg",
IconName::ZedAssistant => "icons/zed_assistant.svg",
IconName::ZedAssistantFilled => "icons/zed_assistant_filled.svg",
IconName::ZedXCopilot => "icons/zed_x_copilot.svg",
IconName::Visible => "icons/visible.svg",
}
}
}