Commit d5823be
authored
fix(npm): remove extra quotes in code action version replacements (#29)
* fix(npm): remove extra quotes in code action version replacements
When applying code actions to update package.json versions, the
formatter was adding quotes around version strings. However, the
parser's version_range already excludes quotes (it spans only the
version text itself, not the surrounding JSON quotes).
This caused double-quoting:
Before: "typescript": "5.0.0"
After: "typescript": ""6.0.0"" (WRONG)
Root cause: NpmFormatter.format_version_for_code_action was adding
quotes that already exist in the JSON structure.
Fix: Return version string without quotes. The TextEdit replaces
only the version content (not the quotes), so no additional quotes
should be added.
Cargo ecosystem is unaffected - toml_edit spans include quotes, so
CargoFormatter correctly adds quotes when replacing the full span.
* style: fix formatting in npm formatter tests1 parent 262df87 commit d5823be
1 file changed
+5
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
51 | 49 | | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
| |||
0 commit comments