mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Rearrange the state machine
This commit is contained in:
parent
137cbaba34
commit
89af803565
1 changed files with 2 additions and 4 deletions
|
@ -461,14 +461,12 @@ impl Copilot {
|
||||||
pub fn sign_in(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
|
pub fn sign_in(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
|
||||||
if let CopilotServer::Running(server) = &mut self.server {
|
if let CopilotServer::Running(server) = &mut self.server {
|
||||||
let task = match &server.sign_in_status {
|
let task = match &server.sign_in_status {
|
||||||
SignInStatus::Authorized { .. } | SignInStatus::Unauthorized { .. } => {
|
SignInStatus::Authorized { .. } => Task::ready(Ok(())).shared(),
|
||||||
Task::ready(Ok(())).shared()
|
|
||||||
}
|
|
||||||
SignInStatus::SigningIn { task, .. } => {
|
SignInStatus::SigningIn { task, .. } => {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
task.clone()
|
task.clone()
|
||||||
}
|
}
|
||||||
SignInStatus::SignedOut => {
|
SignInStatus::SignedOut | SignInStatus::Unauthorized { .. } => {
|
||||||
let lsp = server.lsp.clone();
|
let lsp = server.lsp.clone();
|
||||||
let task = cx
|
let task = cx
|
||||||
.spawn(|this, mut cx| async move {
|
.spawn(|this, mut cx| async move {
|
||||||
|
|
Loading…
Reference in a new issue