Add rough versions of all 3 modals

This commit is contained in:
Mikayla Maki 2023-03-28 18:00:09 -07:00
parent 941da24f73
commit 9d8d2bb8f4
6 changed files with 480 additions and 206 deletions

View file

@ -155,7 +155,10 @@ impl Copilot {
SignInStatus::Authorized { .. } | SignInStatus::Unauthorized { .. } => {
Task::ready(Ok(())).shared()
}
SignInStatus::SigningIn { task, .. } => task.clone(),
SignInStatus::SigningIn { task, .. } => {
cx.notify(); // To re-show the prompt, just in case.
task.clone()
}
SignInStatus::SignedOut => {
let server = server.clone();
let task = cx
@ -463,35 +466,3 @@ async fn get_lsp_binary(http: Arc<dyn HttpClient>) -> anyhow::Result<PathBuf> {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use gpui::TestAppContext;
use util::http;
#[gpui::test]
async fn test_smoke(cx: &mut TestAppContext) {
Settings::test_async(cx);
let http = http::client();
let node_runtime = NodeRuntime::new(http.clone(), cx.background());
let copilot = cx.add_model(|cx| Copilot::start(http, node_runtime, cx));
smol::Timer::after(std::time::Duration::from_secs(2)).await;
copilot
.update(cx, |copilot, cx| copilot.sign_in(cx))
.await
.unwrap();
copilot.read_with(cx, |copilot, _| copilot.status());
let buffer = cx.add_model(|cx| language::Buffer::new(0, "fn foo() -> ", cx));
dbg!(copilot
.update(cx, |copilot, cx| copilot.completion(&buffer, 12, cx))
.await
.unwrap());
dbg!(copilot
.update(cx, |copilot, cx| copilot
.completions_cycling(&buffer, 12, cx))
.await
.unwrap());
}
}