serayuzgur / crates

crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).
https://marketplace.visualstudio.com/items?itemName=serayuzgur.crates
MIT License
238 stars 36 forks source link

J32587/add colors to decoration #220

Closed Jacob-32587 closed 11 months ago

Jacob-32587 commented 11 months ago

Purpose

Fix mistake made by my this PR

Description

The pref object used in line 35 was having it's reference passed (instead of a copy). This caused the ${version} replacement inside the decoration() to repeat on every line. This was fixed by adding JSON.parse(JSON.stringfy(pref)) (structuredClone() was not possible because the vs code built-in type contains classes and functions). The error can bee seen in the below examples:

Examples

Error Examples:

example_toml Screenshot from 2023-12-06 20-56-40 In the above examples it can be seen that the version number repeats itself and is not valid.

Fix Example:

Screenshot from 2023-12-06 22-24-57

Jacob-32587 commented 11 months ago

Sorry for creating a branch with this breaking change, I should have been paying more attention in ensuring I did not break anything. This is the first time I've created a change request for an open source repository (not an excuse), but I've definitely learned something for next time.

serayuzgur commented 11 months ago

No worries, people learn like that and I should have tested better. Also thanks for fixing it 0.6.5 published