summaryrefslogtreecommitdiff
path: root/cli/lsp/language_server.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-05-12 00:43:00 +1000
committerGitHub <noreply@github.com>2021-05-11 10:43:00 -0400
commit41a3b17de44684365ddad9ba0ad9d9c488d3b065 (patch)
tree8914e308dd75bc06b255cb52e837197bd190dbd2 /cli/lsp/language_server.rs
parent46f0ac59e0cfa2a90d3e7342f890b5090bdc3f90 (diff)
fix(lsp): remove code_action/diagnostics deadlock (#10555)
Landed without test to meet 1.10.0 deadline. See #10587.
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r--cli/lsp/language_server.rs24
1 files changed, 7 insertions, 17 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index b05499b7a..5ed6f693c 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -91,7 +91,7 @@ pub(crate) struct Inner {
/// are part of the TypeScript snapshot and have to be fetched out.
assets: Assets,
/// The LSP client that this LSP server is connected to.
- client: Client,
+ pub(crate) client: Client,
/// Configuration information.
config: Config,
diagnostics_server: diagnostics::DiagnosticsServer,
@@ -117,9 +117,9 @@ pub(crate) struct Inner {
/// A memoized version of fixable diagnostic codes retrieved from TypeScript.
ts_fixable_diagnostics: Vec<String>,
/// An abstraction that handles interactions with TypeScript.
- ts_server: Arc<TsServer>,
+ pub(crate) ts_server: Arc<TsServer>,
/// A map of specifiers and URLs used to translate over the LSP.
- pub url_map: urls::LspUrlMap,
+ pub(crate) url_map: urls::LspUrlMap,
}
impl LanguageServer {
@@ -959,12 +959,8 @@ impl Inner {
let mut code_actions = CodeActionCollection::default();
let file_diagnostics = self
.diagnostics_server
- .get(specifier.clone(), DiagnosticSource::TypeScript)
- .await
- .map_err(|err| {
- error!("Unable to get diagnostics: {}", err);
- LspError::internal_error()
- })?;
+ .get(&specifier, DiagnosticSource::TypeScript)
+ .await;
for diagnostic in &fixable_diagnostics {
match diagnostic.source.as_deref() {
Some("deno-ts") => {
@@ -2484,13 +2480,7 @@ impl Inner {
if let Some(source) = self.documents.content(&referrer).unwrap() {
self.analyze_dependencies(&referrer, &source);
}
- self
- .diagnostics_server
- .invalidate(referrer)
- .map_err(|err| {
- error!("{}", err);
- LspError::internal_error()
- })?;
+ self.diagnostics_server.invalidate(&referrer).await;
}
self.diagnostics_server.update().map_err(|err| {
@@ -4608,7 +4598,7 @@ mod tests {
LspFixture::Path("did_open_notification_code_action.json"),
LspResponse::None,
),
- (LspFixture::None, LspResponse::Delay(500)),
+ (LspFixture::None, LspResponse::Delay(20000)),
(
LspFixture::Path("code_action_request.json"),
LspResponse::RequestFixture(2, "code_action_response.json".to_string()),