Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

languages: Fix ESLint diagnostics not getting shown (#33814)

Umesh Yadavcf1ce1beedb5
diff --git a/Cargo.lock b/Cargo.lock
index c07d311db96..97b1e332111 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -9660,12 +9660,11 @@ dependencies = [
[[package]]
name = "lsp-types"
version = "0.95.1"
-source = "git+https://github.com/zed-industries/lsp-types?rev=c9c189f1c5dd53c624a419ce35bc77ad6a908d18#c9c189f1c5dd53c624a419ce35bc77ad6a908d18"
+source = "git+https://github.com/zed-industries/lsp-types?rev=6add7052b598ea1f40f7e8913622c3958b009b60#6add7052b598ea1f40f7e8913622c3958b009b60"
dependencies = [
"bitflags 1.3.2",
"serde",
"serde_json",
- "serde_repr",
"url",
]
diff --git a/Cargo.toml b/Cargo.toml
index 7e3b43e58a1..dedf5700524 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -492,7 +492,7 @@ libc = "0.2"
libsqlite3-sys = { version = "0.30.1", features = ["bundled"] }
linkify = "0.10.0"
log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] }
-lsp-types = { git = "https://github.com/zed-industries/lsp-types", rev = "c9c189f1c5dd53c624a419ce35bc77ad6a908d18" }
+lsp-types = { git = "https://github.com/zed-industries/lsp-types", rev = "6add7052b598ea1f40f7e8913622c3958b009b60" }
markup5ever_rcdom = "0.3.0"
metal = "0.29"
moka = { version = "0.12.10", features = ["sync"] }
diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rs
index 32c45dfa886..3c1ecdcd5c5 100644
--- a/crates/languages/src/typescript.rs
+++ b/crates/languages/src/typescript.rs
@@ -863,7 +863,7 @@ impl LspAdapter for EsLintLspAdapter {
},
"experimental": {
"useFlatConfig": use_flat_config,
- },
+ }
});
let override_options = cx.update(|cx| {
diff --git a/crates/project/src/lsp_command.rs b/crates/project/src/lsp_command.rs
index 8ed37164361..4538dc4cda5 100644
--- a/crates/project/src/lsp_command.rs
+++ b/crates/project/src/lsp_command.rs
@@ -3822,7 +3822,7 @@ impl GetDocumentDiagnostics {
code,
code_description: match diagnostic.code_description {
Some(code_description) => Some(CodeDescription {
- href: lsp::Url::parse(&code_description).unwrap(),
+ href: Some(lsp::Url::parse(&code_description).unwrap()),
}),
None => None,
},
@@ -3898,7 +3898,7 @@ impl GetDocumentDiagnostics {
tags,
code_description: diagnostic
.code_description
- .map(|desc| desc.href.to_string()),
+ .and_then(|desc| desc.href.map(|url| url.to_string())),
message: diagnostic.message,
data: diagnostic.data.as_ref().map(|data| data.to_string()),
})
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs
index e7afac06897..fd626cf2d68 100644
--- a/crates/project/src/lsp_store.rs
+++ b/crates/project/src/lsp_store.rs
@@ -9130,7 +9130,13 @@ impl LspStore {
}
};
- let lsp::ProgressParamsValue::WorkDone(progress) = progress.value;
+ let progress = match progress.value {
+ lsp::ProgressParamsValue::WorkDone(progress) => progress,
+ lsp::ProgressParamsValue::WorkspaceDiagnostic(_) => {
+ return;
+ }
+ };
+
let language_server_status =
if let Some(status) = self.language_server_statuses.get_mut(&language_server_id) {
status
@@ -10512,7 +10518,7 @@ impl LspStore {
code_description: diagnostic
.code_description
.as_ref()
- .map(|d| d.href.clone()),
+ .and_then(|d| d.href.clone()),
severity: diagnostic.severity.unwrap_or(DiagnosticSeverity::ERROR),
markdown: adapter.as_ref().and_then(|adapter| {
adapter.diagnostic_message_to_markdown(&diagnostic.message)
@@ -10539,7 +10545,7 @@ impl LspStore {
code_description: diagnostic
.code_description
.as_ref()
- .map(|c| c.href.clone()),
+ .and_then(|d| d.href.clone()),
severity: DiagnosticSeverity::INFORMATION,
markdown: adapter.as_ref().and_then(|adapter| {
adapter.diagnostic_message_to_markdown(&info.message)