Skip to content

Ingredients with spaces or punctuation not parsed correctly #10

Description

@lucasmelin

Bug Description

Ingredients containing a space, ', -, or other non-letter characters are parsed incorrectly. These characters are interpreted as the end of the ingredient. This omits part of the ingredient name as well as the quantity (if it exists) when displaying tooltips. It also results in incorrect syntax highlighting for the ingredient name and associated quantity.

This issue was observed using cookcli 0.32.0 and version 0.4.2 of the Cooklang VSCode plugin.

Expected Result

Ingredients containing spaces or non-letter characters such as @heavy whipping cream{}, @lady's fingers{20} or @sun-dried tomatoes{1/2%cup} are highlighted as a single ingredient with correct styling. When hovered, the tooltip correctly displays the full ingredient name and quantity, the same as ingredients without non-letter characters.

Actual Result

The syntax highlighting for ingredients stops at the first occurrence of non-letter characters.

Example
Image

When hovering the ingredient, the full ingredient name is not displayed, and the quantity is missing from the tooltip.

Example

Image

Steps to Reproduce

  1. Create a new file named Tiramisu.cook with the following contents:

    Chill @heavy whipping cream{1%cup}.
  2. Notice that @heavy is highlighted separately from whipping cream and 1%cup when viewed in VSCode.

  3. Hover the ingredient to see that the tooltip displays "Ingredient: heavy" instead of "Ingredient: heavy whipping cream Quantity: 1 cup".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions