From acc99d1f1812004a2724d896655370bcb965760d Mon Sep 17 00:00:00 2001 From: ematipico Date: Fri, 23 Dec 2022 11:03:02 +0000 Subject: [PATCH] chore: do not show the URL in case it's broken --- crates/rome_lsp/src/utils.rs | 5 +++-- website/src/pages/lint/rules/noInnerDeclarations.md | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/rome_lsp/src/utils.rs b/crates/rome_lsp/src/utils.rs index 798a9daaf39..97517bc5c6c 100644 --- a/crates/rome_lsp/src/utils.rs +++ b/crates/rome_lsp/src/utils.rs @@ -220,8 +220,9 @@ pub(crate) fn diagnostic_to_lsp( let code_description = diagnostic .category() .and_then(|category| category.link()) - .map(|link| CodeDescription { - href: Url::parse(link).unwrap(), + .and_then(|link| { + let href = Url::parse(link).ok()?; + Some(CodeDescription { href }) }); let message = PrintDescription(&diagnostic).to_string(); diff --git a/website/src/pages/lint/rules/noInnerDeclarations.md b/website/src/pages/lint/rules/noInnerDeclarations.md index 7aee4756e92..46e2b1ee0aa 100644 --- a/website/src/pages/lint/rules/noInnerDeclarations.md +++ b/website/src/pages/lint/rules/noInnerDeclarations.md @@ -140,3 +140,7 @@ function f() { } ``` +## Related links + +- [Disable a rule](/linter/#disable-a-lint-rule) +- [Rule options](/linter/#rule-options)