A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/lsp/client.rs')
| -rw-r--r-- | src/lsp/client.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lsp/client.rs b/src/lsp/client.rs index 9bc85b5..ff8d610 100644 --- a/src/lsp/client.rs +++ b/src/lsp/client.rs @@ -537,15 +537,17 @@ impl Client { ) -> rootcause::Result<()> { ceach!(t.cursor, |c| try bikeshed rootcause::Result<()> { let r = self - .request_immediate::<OnEnter>( + .request_by::<OnEnter>( &TextDocumentPositionParams { text_document: f.tid(), position: t.to_l_position(*c).unwrap(), }, + acceptable_duration(), ); match r { - Ok(None) | Err(_) => t.enter(), - Ok(Some(mut r)) => { + Ok(Ok(None)) | Err(_) | Ok(Err(_)) => { println!("hmm") ;t.enter() }, + Ok(Ok(Some(mut r))) => { + println!("applying"); r.sort_tedits(); for f in r { t.apply_snippet_tedit(&f)?; @@ -716,3 +718,7 @@ pub macro tdpp($e:expr) { position: $e.text.to_l_position(*$e.text.cursor.first()).unwrap(), } } + +pub fn acceptable_duration() -> tokio::time::Duration { + tokio::time::Duration::from_millis(50) +} |