Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit da0dd40

Browse files
committed
feat: enhance duplicate code diagnostic message
Include the count of duplicate locations in the diagnostic message for better clarity. This helps developers quickly understand how many instances of duplicated code exist without having to expand the details.
1 parent f34324f commit da0dd40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/echolysis-lsp/src/server/diagnostic.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ impl Server {
2222
location: &lsp_types::Location,
2323
other_locations: &[lsp_types::Location],
2424
) -> lsp_types::Diagnostic {
25-
let message = "Duplicated code fragments found\n".to_string();
25+
let message = format!(
26+
"Duplicated code fragments found in {} place(s)",
27+
other_locations.len()
28+
);
2629
lsp_types::Diagnostic {
2730
range: location.range,
2831
severity: Some(lsp_types::DiagnosticSeverity::INFORMATION),

0 commit comments

Comments
 (0)