diff --git a/compiler/crates/relay-lsp/src/completion/mod.rs b/compiler/crates/relay-lsp/src/completion/mod.rs index 1592cccc45a91..0ced431fc7bf5 100644 --- a/compiler/crates/relay-lsp/src/completion/mod.rs +++ b/compiler/crates/relay-lsp/src/completion/mod.rs @@ -1323,8 +1323,6 @@ pub fn on_completion( state: &impl GlobalState, params: ::Params, ) -> LSPRuntimeResult<::Result> { - state.ensure_documents_are_synced(); - match state.extract_executable_document_from_text(¶ms.text_document_position, 0) { Ok((document, position_span)) => { let project_name = state diff --git a/compiler/crates/relay-lsp/src/server/lsp_state.rs b/compiler/crates/relay-lsp/src/server/lsp_state.rs index 6d5cb556129e4..972c07960da69 100644 --- a/compiler/crates/relay-lsp/src/server/lsp_state.rs +++ b/compiler/crates/relay-lsp/src/server/lsp_state.rs @@ -7,8 +7,6 @@ use std::path::PathBuf; use std::sync::Arc; -use std::sync::Condvar; -use std::sync::Mutex; use common::PerfLogger; use common::SourceLocationKey; @@ -138,8 +136,6 @@ pub trait GlobalState { /// we may need to know who's our current consumer. /// This is mostly for hover handler (where we render markup) fn get_content_consumer_type(&self) -> ContentConsumerType; - - fn ensure_documents_are_synced(&self); } /// This structure contains all available resources that we may use in the Relay LSP message/notification @@ -163,8 +159,6 @@ pub struct LSPState< pub(crate) notify_lsp_state_resources: Arc, pub(crate) project_status: ProjectStatusMap, js_resource: Option>>, - is_syncing: Mutex, - is_syncing_condvar: Condvar, } impl @@ -206,8 +200,6 @@ impl @@ -517,45 +502,32 @@ impl LSPRuntimeResult<()> { - self.set_is_syncing(true); - if let Some(js_server) = self.get_js_language_sever() { js_server.process_js_source(uri, text); } // First we check to see if this document has any GraphQL documents. let embedded_sources = extract_graphql::extract(text); - let result = if embedded_sources.is_empty() { + if embedded_sources.is_empty() { Ok(()) } else { self.process_synced_sources(uri, embedded_sources) - }; - - self.set_is_syncing(false); - - result + } } fn document_changed(&self, uri: &Url, full_text: &str) -> LSPRuntimeResult<()> { - self.set_is_syncing(true); - if let Some(js_server) = self.get_js_language_sever() { js_server.process_js_source(uri, full_text); } // First we check to see if this document has any GraphQL documents. let embedded_sources = extract_graphql::extract(full_text); - let result = if embedded_sources.is_empty() { + if embedded_sources.is_empty() { self.remove_synced_sources(uri); - Ok(()) } else { self.process_synced_sources(uri, embedded_sources) - }; - - self.set_is_syncing(false); - - result + } } fn document_closed(&self, uri: &Url) -> LSPRuntimeResult<()> { @@ -569,18 +541,6 @@ impl ContentConsumerType { ContentConsumerType::Relay } - - fn ensure_documents_are_synced(&self) { - let mut is_syncing = self.is_syncing.lock().unwrap(); - - if *is_syncing { - debug!("waiting for document sync to complete"); - } - - while *is_syncing { - is_syncing = self.is_syncing_condvar.wait(is_syncing).unwrap(); - } - } } #[derive(Debug)]