Skip to content

Commit

Permalink
feat(oxc_language_server): add related code for `lsp_types::Diagnosti…
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY authored Oct 12, 2024
1 parent 0784e74 commit 66dccc0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/oxc_language_server/src/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl ErrorWithPosition {
ret_range
},
);

let source = self.miette_err.code().map_or("oxc".to_string(), |code| format!("oxc:{code}"));
let message = self.miette_err.help().map_or_else(
|| self.miette_err.to_string(),
|help| format!("{}\nhelp: {}", self.miette_err, help),
Expand All @@ -118,7 +118,7 @@ impl ErrorWithPosition {
severity,
code: None,
message,
source: Some("oxc".into()),
source: Some(source),
code_description: None,
related_information,
tags: None,
Expand Down Expand Up @@ -176,7 +176,6 @@ impl IsolatedLintHandler {
let Some(ref related_info) = d.diagnostic.related_information else {
continue;
};

let related_information = Some(vec![DiagnosticRelatedInformation {
location: lsp_types::Location {
uri: lsp_types::Url::from_file_path(path).unwrap(),
Expand All @@ -194,7 +193,7 @@ impl IsolatedLintHandler {
severity: Some(DiagnosticSeverity::HINT),
code: None,
message: r.message.clone(),
source: Some("oxc".into()),
source: d.diagnostic.source.clone(),
code_description: None,
related_information: related_information.clone(),
tags: None,
Expand Down

0 comments on commit 66dccc0

Please sign in to comment.