thombruce / toodles

✅ A super simple todo app
https://toodles.thombruce.com/
GNU General Public License v3.0
0 stars 0 forks source link

[Feature]: Add end of line multiplier highlighting to VS Code extension #111

Closed thombruce closed 3 months ago

thombruce commented 3 months ago

Feature request

This is mainly applicable to shopping lists. The idea is simple: A price appears at the start of the line indicating the price of an individual item, and a multiplier appears at the end of the line indicating how many of that item you wish to get. This pair of values can be used later to calculate the full cost of the line item, and of course the full cost of the shopping list.

Example:

£1.35 Milk x2
£2.00 Butter x3

The scope of this issue is limited only to detecting the multiplier at the end of the line (matching the pattern / x[0-9]+$/) and setting an appropriate color for the matched items.

Code of Conduct

thombruce commented 3 months ago

This would be a good opportunity to look at what other decorations are available to us; e.g. tooltip text.

We could use such a decoration to display the calculated total value of the line item based on the price at the start of the string multiplied by the value at the end of the string.

thombruce commented 3 months ago

It would also be a good opportunity to revise the prices regex, which currently matches currency symbols alone. It should only match values that feature a currency symbol followed by at least one number, optionally separated by a decimal point.

£ should not match
$ should not match
$1 should match
£1.50 should match
$.50 should match

Decimal point should also be allowed to be a , character. At present, I have no plans to allow thousands- or hundreds- separators (be they commas, spaces or underscores); eventually we may reconsider this.