inline_completion_button: Do some cleanup (#15849)

This PR does some cleanup in the `inline_completion_button` after
#15443.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-08-06 08:55:27 -04:00 committed by GitHub
parent 1c3f303594
commit 82310092a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 14 deletions

View file

@ -15,7 +15,7 @@ use language::{
use settings::{update_settings_file, Settings, SettingsStore}; use settings::{update_settings_file, Settings, SettingsStore};
use std::{path::Path, sync::Arc}; use std::{path::Path, sync::Arc};
use supermaven::{AccountStatus, Supermaven}; use supermaven::{AccountStatus, Supermaven};
use util::{with_clone, ResultExt}; use util::ResultExt;
use workspace::{ use workspace::{
create_and_open_local_file, create_and_open_local_file,
item::ItemHandle, item::ItemHandle,
@ -222,22 +222,20 @@ impl InlineCompletionButton {
let fs = self.fs.clone(); let fs = self.fs.clone();
ContextMenu::build(cx, |menu, _| { ContextMenu::build(cx, |menu, _| {
menu.entry("Sign In", None, initiate_sign_in) menu.entry("Sign In", None, initiate_sign_in)
.entry( .entry("Disable Copilot", None, {
"Disable Copilot", let fs = fs.clone();
None, move |cx| hide_copilot(fs.clone(), cx)
with_clone!(fs, move |cx| hide_copilot(fs.clone(), cx)), })
) .entry("Use Supermaven", None, {
.entry( let fs = fs.clone();
"Use Supermaven", move |cx| {
None,
with_clone!(fs, move |cx| {
set_completion_provider( set_completion_provider(
fs.clone(), fs.clone(),
cx, cx,
InlineCompletionProvider::Supermaven, InlineCompletionProvider::Supermaven,
) )
}), }
) })
}) })
} }

View file

@ -42,7 +42,7 @@ use std::{
sync::Arc, sync::Arc,
}; };
use theme::{ActiveTheme, SystemAppearance, ThemeRegistry, ThemeSettings}; use theme::{ActiveTheme, SystemAppearance, ThemeRegistry, ThemeSettings};
use util::{maybe, parse_env_output, with_clone, ResultExt, TryFutureExt}; use util::{maybe, parse_env_output, ResultExt, TryFutureExt};
use uuid::Uuid; use uuid::Uuid;
use welcome::{show_welcome_view, BaseKeymap, FIRST_OPEN}; use welcome::{show_welcome_view, BaseKeymap, FIRST_OPEN};
use workspace::{AppState, WorkspaceSettings, WorkspaceStore}; use workspace::{AppState, WorkspaceSettings, WorkspaceStore};
@ -386,7 +386,10 @@ fn main() {
}) })
}; };
app.on_open_urls(with_clone!(open_listener, move |urls| open_listener.open_urls(urls))); app.on_open_urls({
let open_listener = open_listener.clone();
move |urls| open_listener.open_urls(urls)
});
app.on_reopen(move |cx| { app.on_reopen(move |cx| {
if let Some(app_state) = AppState::try_global(cx).and_then(|app_state| app_state.upgrade()) if let Some(app_state) = AppState::try_global(cx).and_then(|app_state| app_state.upgrade())
{ {