-
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
Fix 55 #75
Fix 55 #75
Conversation
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.
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
@@ -175,9 +176,18 @@ SourceEdit _removeFromBlockMap( | |||
final keySpan = keyNode.span; | |||
var end = getContentSensitiveEnd(valueNode); | |||
final yaml = yamlEdit.toString(); | |||
final lineEnding = getLineEnding(yaml); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side-note - we should probably cache the result of getLineEnding
somewhere.
Not in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, some of this could benefit from more structure.
But performance isn't really much of a concern.
…browser_launcher, cli_util, clock, collection, convert, crypto, csslib, dartdoc, ecosystem, file, fixnum, glob, html, http, http_multi_server, http_parser, json_rpc_2, lints, logging, markdown, matcher, mime, package_config, path, pool, pub_semver, shelf, source_map_stack_trace, source_maps, source_span, sse, stack_trace, stream_channel, string_scanner, sync_http, term_glyph, test, test_descriptor, test_process, test_reflective_loader, tools, typed_data, usage, watcher, web, web_socket_channel, webdev, webdriver, webkit_inspection_protocol, yaml, yaml_edit Revisions updated by `dart tools/rev_sdk_deps.dart`. async (https://github.com/dart-lang/async/compare/4796804..0370a67): 0370a67 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/async#272) 3144df2 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/async#271) bazel_worker (https://github.com/dart-lang/bazel_worker/compare/79d2ad1..d396d3d): d396d3d 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/bazel_worker#90) benchmark_harness (https://github.com/dart-lang/benchmark_harness/compare/197702c..3a6ed5d): 3a6ed5d 2024-05-02 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/benchmark_harness#104) bcbfae5 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/benchmark_harness#103) boolean_selector (https://github.com/dart-lang/boolean_selector/compare/24635df..b353222): b353222 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/boolean_selector#58) fdba29c 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/boolean_selector#59) browser_launcher (https://github.com/dart-lang/browser_launcher/compare/c4b2c81..e5687b4): e5687b4 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/browser_launcher#57) 7c2884c 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/browser_launcher#58) cli_util (https://github.com/dart-lang/cli_util/compare/e222c56..5103eca): 5103eca 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/cli_util#102) 86b7bcb 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/cli_util#101) clock (https://github.com/dart-lang/clock/compare/a732a09..c7e3875): c7e3875 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/clock#63) 14fbff3 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/clock#62) collection (https://github.com/dart-lang/collection/compare/fc616ff..34b7269): 34b7269 2024-05-02 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/collection#338) 3d0082c 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.1 to 4.1.4 (dart-archive/collection#339) convert (https://github.com/dart-lang/convert/compare/186ac22..5da924b): 5da924b 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/convert#103) a58d826 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/convert#104) crypto (https://github.com/dart-lang/crypto/compare/1c7fbad..fc5e7c8): fc5e7c8 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/crypto#169) 2829062 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/crypto#168) csslib (https://github.com/dart-lang/csslib/compare/171ed48..4ab68e4): 4ab68e4 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/csslib#200) 4861bc9 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/csslib#199) dartdoc (https://github.com/dart-lang/dartdoc/compare/d9e31ff..d16bedc): d16bedc2 2024-04-30 Sam Rawlins Bump analyzer to 6.5.0 (dart-lang/dartdoc#3763) 6e100245 2024-04-29 dependabot[bot] Bump actions/checkout from 4.1.3 to 4.1.4 (dart-lang/dartdoc#3759) ecosystem (https://github.com/dart-lang/ecosystem/compare/9fabe46..74942f6): 74942f6 2024-05-01 dependabot[bot] Bump actions/upload-artifact from 4.3.1 to 4.3.3 (dart-lang/ecosystem#254) 1cd571b 2024-05-01 dependabot[bot] Bump peter-evans/find-comment (dart-lang/ecosystem#256) 873d11b 2024-05-01 dependabot[bot] Bump subosito/flutter-action from 2.15.0 to 2.16.0 (dart-lang/ecosystem#255) 3c12e07 2024-05-01 dependabot[bot] Bump actions/download-artifact from 4.1.4 to 4.1.7 (dart-lang/ecosystem#253) file (https://github.com/google/file.dart/compare/f858c6f..8ce0d13): 8ce0d13 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/file.dart#239) bc10194 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/file.dart#238) fixnum (https://github.com/dart-lang/fixnum/compare/dec16eb..2c9f25d): 2c9f25d 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/fixnum#127) 5086bb1 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/fixnum#126) glob (https://github.com/dart-lang/glob/compare/25ee2c2..44e8c22): 44e8c22 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/glob#91) c51e6bd 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/glob#90) html (https://github.com/dart-lang/html/compare/5b99b43..44613e8): 44613e8 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/html#241) e379fa8 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/html#242) http (https://github.com/dart-lang/http/compare/e459e5c..ec73b19): ec73b19 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/http#1187) 78b2a9a 2024-04-30 Nate Bosch Fix runWithClient link in README (dart-lang/http#1184) http_multi_server (https://github.com/dart-lang/http_multi_server/compare/6ce0a13..e45a674): e45a674 2024-05-02 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/http_multi_server#66) c4dc8d8 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/http_multi_server#67) http_parser (https://github.com/dart-lang/http_parser/compare/8ffcaec..ad05810): ad05810 2024-05-02 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/http_parser#89) bc808ed 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/http_parser#88) json_rpc_2 (https://github.com/dart-lang/json_rpc_2/compare/1a4c473..7547bb1): 7547bb1 2024-05-02 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/json_rpc_2#111) 66d9583 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/json_rpc_2#112) lints (https://github.com/dart-lang/lints/compare/df9bcbf..e467d1e): e467d1e 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/lints#185) 1cd93f4 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/lints#186) 7f63963 2024-04-30 Devon Carew remove the 'library_names' lint (dart-lang/lints#183) logging (https://github.com/dart-lang/logging/compare/dcaf249..49d89b1): 49d89b1 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/logging#161) 0fd22d6 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/logging#162) markdown (https://github.com/dart-lang/markdown/compare/782b180..6aaa152): 6aaa152 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/markdown#607) f817544 2024-05-01 dependabot[bot] Bump subosito/flutter-action from 2.15.0 to 2.16.0 (dart-lang/markdown#608) 4ab9083 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/markdown#606) matcher (https://github.com/dart-lang/matcher/compare/54c2798..b42bf10): b42bf10 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/matcher#245) b8102f3 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/matcher#246) mime (https://github.com/dart-lang/mime/compare/0a32241..b01c9a2): b01c9a2 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/mime#120) 84808ac 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/mime#119) package_config (https://github.com/dart-lang/package_config/compare/854dc19..a36e496): a36e496 2024-05-02 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/package_config#151) fba794a 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/package_config#152) path (https://github.com/dart-lang/path/compare/a7284b9..f411b96): f411b96 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/path#162) c96ece1 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/path#161) pool (https://github.com/dart-lang/pool/compare/8055cbb..e6df05a): e6df05a 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/pool#84) 2d1d69a 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/pool#83) pub_semver (https://github.com/dart-lang/pub_semver/compare/7581029..df834e1): df834e1 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/pub_semver#101) f35f47e 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/pub_semver#100) shelf (https://github.com/dart-lang/shelf/compare/7352d1b..c8d8058): c8d8058 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/shelf#428) df86244 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/shelf#427) source_map_stack_trace (https://github.com/dart-lang/source_map_stack_trace/compare/9ed8875..4671c20): 4671c20 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.3 to 1.6.4 (dart-archive/source_map_stack_trace#51) 8ba0097 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/source_map_stack_trace#52) source_maps (https://github.com/dart-lang/source_maps/compare/aedfc39..c4dc7d0): c4dc7d0 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/source_maps#91) 1f859b2 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.3 to 1.6.4 (dart-lang/source_maps#90) source_span (https://github.com/dart-lang/source_span/compare/45e11a3..1695904): 1695904 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/source_span#110) 10e6de5 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/source_span#109) sse (https://github.com/dart-lang/sse/compare/1ab266a..f5ed4d6): f5ed4d6 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/sse#108) e9242cf 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/sse#107) stack_trace (https://github.com/dart-lang/stack_trace/compare/c39ae6e..54c7b9d): 54c7b9d 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/stack_trace#151) e5ffd9e 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/stack_trace#152) stream_channel (https://github.com/dart-lang/stream_channel/compare/5f72035..ba35137): ba35137 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/stream_channel#104) a3ef580 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/stream_channel#103) string_scanner (https://github.com/dart-lang/string_scanner/compare/8dbfddf..6e893af): 6e893af 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/string_scanner#71) 21ebc0c 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/string_scanner#72) sync_http (https://github.com/dart-lang/sync_http/compare/b849559..82553db): 82553db 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.1 to 4.1.4 (google/sync_http.dart#46) term_glyph (https://github.com/dart-lang/term_glyph/compare/2ad48ce..c3e323b): c3e323b 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/term_glyph#49) 1e683e5 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/term_glyph#50) test (https://github.com/dart-lang/test/compare/c7a76b0..0562baf): 0562baf0 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/test#2216) 1f54fd84 2024-05-01 dependabot[bot] Bump actions/upload-artifact from 4.3.0 to 4.3.3 (dart-lang/test#2217) 5815385e 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/test#2214) df708669 2024-05-01 dependabot[bot] Bump github/codeql-action from 3.24.9 to 3.25.3 (dart-lang/test#2215) test_descriptor (https://github.com/dart-lang/test_descriptor/compare/b61cfb4..6695954): 6695954 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/test_descriptor#64) 23be0c9 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/test_descriptor#63) test_process (https://github.com/dart-lang/test_process/compare/94ee46d..69c6894): 69c6894 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/test_process#55) f5701d7 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/test_process#56) test_reflective_loader (https://github.com/dart-lang/test_reflective_loader/compare/d7167a2..537ab5b): 537ab5b 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/test_reflective_loader#59) 0917006 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/test_reflective_loader#60) tools (https://github.com/dart-lang/tools/compare/3e21ae9..d35d633): d35d633 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/tools#267) 498bac0 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/tools#268) typed_data (https://github.com/dart-lang/typed_data/compare/8c7393c..5b3708e): 5b3708e 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/typed_data#85) 82e3b6d 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/typed_data#84) usage (https://github.com/dart-lang/usage/compare/2847cdb..bc4907b): bc4907b 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-archive/usage#205) 28edd72 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-archive/usage#206) watcher (https://github.com/dart-lang/watcher/compare/1bd2f20..42308ea): 42308ea 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/watcher#165) d249a26 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/watcher#164) web (https://github.com/dart-lang/web/compare/9d8c802..ff7185c): ff7185c 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/web#230) 6b598d6 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/web#231) web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/b672220..d86313d): d86313d 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/web_socket_channel#352) 97f33f3 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/web_socket_channel#351) webdev (https://github.com/dart-lang/webdev/compare/50bf268..b41ac34): b41ac34d 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/webdev#2420) 2e5aea71 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/webdev#2421) webdriver (https://github.com/google/webdriver.dart/compare/c80e01e..f85779e): f85779e 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.0 to 1.6.4 (google/webdriver.dart#296) af2d359 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (google/webdriver.dart#297) webkit_inspection_protocol (https://github.com/google/webkit_inspection_protocol.dart/compare/153fea4..5740cc9): 5740cc9 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.1 to 4.1.4 (google/webkit_inspection_protocol.dart#122) yaml (https://github.com/dart-lang/yaml/compare/5a1c4be..022ea64): 022ea64 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/yaml#161) c1497da 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/yaml#162) yaml_edit (https://github.com/dart-lang/yaml_edit/compare/f5a92b3..fe2699d): fe2699d 2024-05-02 Jonas Finnemann Jensen Fix 55 (dart-lang/yaml_edit#75) 9eaed3e 2024-05-01 dependabot[bot] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/yaml_edit#74) 37146b0 2024-05-01 dependabot[bot] Bump coverallsapp/github-action from 2.0.0.pre.rc1 to 2.2.3 (dart-lang/yaml_edit#72) e26f7f6 2024-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/yaml_edit#73) Change-Id: I49e137721e1ff9424609b94f21804d9f68039403 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365301 Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Devon Carew <[email protected]>
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.
please double check golden files during review
Fixes #55.
When the value is empty the
SourceSpan
for theYamlNode
representingthe value in a map points to the colon.
Example:
The
YamlNode
forfoo.bar
has a value ofnull
and starts and endsat the colon
:
followingbar
. This means that removal might leavethe colon behind, which causes invalid YAML.
We have the same issue when removing
foo.bar
from the following YAMLdocument:
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 thenext newline. If we apply the same hack when removing
foo.bar
in thefirst 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.