-
Notifications
You must be signed in to change notification settings - Fork 16
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
Failed yaml edit #55
Labels
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Comments
sigurdm
added
the
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
label
May 2, 2024
@jonasfj we should look into this. |
jonasfj
added a commit
to jonasfj/yaml_edit
that referenced
this issue
May 2, 2024
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.
Merged
jonasfj
added a commit
that referenced
this issue
May 2, 2024
Fix removal of last key from map in block-mode when value is empty. Fixes #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.
If the file ends immediately after |
jonasfj
added a commit
to jonasfj/yaml_edit
that referenced
this issue
May 6, 2024
mosuem
pushed a commit
to dart-lang/tools
that referenced
this issue
Dec 11, 2024
Fix removal of last key from map in block-mode when value is empty. Fixes dart-lang/yaml_edit#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.
mosuem
pushed a commit
to dart-lang/tools
that referenced
this issue
Dec 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproduction:
No
pubspec.lock
.The text was updated successfully, but these errors were encountered: