Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions crates/deps-npm/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ pub struct NpmFormatter;

impl EcosystemFormatter for NpmFormatter {
fn format_version_for_code_action(&self, version: &str) -> String {
format!("\"{}\"", version)
// Don't add quotes - version_range already excludes them from parser
version.to_string()
}

fn package_url(&self, name: &str) -> String {
Expand Down Expand Up @@ -41,14 +42,12 @@ mod tests {
#[test]
fn test_format_version() {
let formatter = NpmFormatter;
// Version should not include quotes - parser's version_range excludes them
assert_eq!(
formatter.format_version_for_code_action("1.0.214"),
"\"1.0.214\""
);
assert_eq!(
formatter.format_version_for_code_action("18.3.1"),
"\"18.3.1\""
"1.0.214"
);
assert_eq!(formatter.format_version_for_code_action("18.3.1"), "18.3.1");
}

#[test]
Expand Down
Loading