Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 55 #75

Merged
merged 3 commits into from
May 2, 2024
Merged

Fix 55 #75

merged 3 commits into from
May 2, 2024

Commits on May 2, 2024

  1. Fix removal of last key from map in block-mode when value is empty.

    Fixes dart-lang#55.
    
    When the value is empty the `SourceSpan` for the `YamlNode` representing
    the value in a map points to the colon.
    
    Example:
    ```yaml
    foo:
      bar:
    ```
    
    The `YamlNode` for `foo.bar` has a value of `null` and starts and ends
    at the colon `:` following `bar`. This means that removal might leave
    the colon behind, which causes invalid YAML.
    
    We have the same issue when removing `foo.bar` from the following YAML
    document:
    
    ```yaml
    foo:
      baz: true
      bar:
    ```
    
    However, in this case, we have a hack that ensures we always strip away
    the any comments that follows `bar`. We do this by deleting up-to the
    next newline. If we apply the same hack when removing `foo.bar` in the
    first example, then it works.
    
    One could argue that it works by accident, but it's kind of desired that
    trailing comments are removed, when the value they are trailing is
    removed.
    jonasfj committed May 2, 2024
    Configuration menu
    Copy the full SHA
    ff60244 View commit details
    Browse the repository at this point in the history
  2. Added more test cases

    jonasfj committed May 2, 2024
    Configuration menu
    Copy the full SHA
    ef90033 View commit details
    Browse the repository at this point in the history
  3. Improved comment

    jonasfj committed May 2, 2024
    Configuration menu
    Copy the full SHA
    68ffc95 View commit details
    Browse the repository at this point in the history